Skip to content

Commit efd5759

Browse files
authored
Merge pull request #493 from eimlav/fm-8151
(FM-8151) Add Windows Server 2019 support
2 parents 6fee44d + 7bf3ea6 commit efd5759

File tree

4 files changed

+51
-15
lines changed

4 files changed

+51
-15
lines changed

metadata.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
{
6161
"operatingsystem": "Windows",
6262
"operatingsystemrelease": [
63-
"Server 2016"
63+
"2016",
64+
"2019"
6465
]
6566
}
6667
],

spec/acceptance/compose_v3_spec.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
file_extension = '.exe'
66
docker_args = 'docker_ee => true'
77
tmp_path = 'C:/cygwin64/tmp'
8-
test_container = 'nanoserver-sac2016'
8+
test_container = if fact('os.release.major') == '2019'
9+
'nanoserver'
10+
else
11+
'nanoserver-sac2016'
12+
end
913
else
1014
docker_args = if fact('os.name') == 'RedHat'
1115
"repo_opt => '--enablerepo=localmirror-extras'"

spec/acceptance/docker_full_spec.rb

+20-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
if fact('kernel') == 'windows'
44
docker_args = 'docker_ee => true'
55
default_image = 'winamd64/hello-seattle'
6-
default_image_tag = 'nanoserver-sac2016'
6+
default_image_tag = if fact('os.release.major') == '2019'
7+
'nanoserver'
8+
else
9+
'nanoserver-sac2016'
10+
end
711
default_digest = 'sha256:dcba85354678b50608b8c40ec6d17cce063a224aa0e12b6a55dc47b67f039e75'
812
second_image = 'winamd64/hola-mundo'
913
default_dockerfile = 'C:/Users/Administrator/AppData/Local/Temp/Dockerfile'
@@ -14,9 +18,9 @@
1418
default_docker_run_arg = "restart => 'always', net => 'nat',"
1519
default_run_command = 'ping 127.0.0.1 -t'
1620
docker_command = '"/cygdrive/c/Program Files/Docker/docker"'
17-
default_docker_exec_lr_command = 'cmd /c "ping 127.0.0.1 -t > c:\windows\temp\test_file.txt"'
18-
default_docker_exec_command = 'cmd /c "echo test > c:\windows\temp\test_file.txt"'
19-
docker_mount_path = 'C:/Users/Administrator/AppData/Local/Temp'
21+
default_docker_exec_lr_command = 'cmd /c "ping 127.0.0.1 -t > C:\Users\Public\test_file.txt"'
22+
default_docker_exec_command = 'cmd /c "echo test > C:\Users\Public\test_file.txt"'
23+
docker_mount_path = 'C:/Users/Public/DockerVolume'
2024
storage_driver = 'windowsfilter'
2125
else
2226
docker_args = if fact('os.family') == 'RedHat'
@@ -313,7 +317,7 @@ class { 'docker': #{docker_args} }
313317

314318
it 'creates a new image based on a Dockerfile' do
315319
run_cmd = if fact('osfamily') == 'windows'
316-
'RUN echo test > C:\\Windows\\Temp\\Dockerfile_test.txt'
320+
'RUN echo test > C:\\Users\\Public\\Dockerfile_test.txt'
317321
else
318322
"RUN echo test > #{dockerfile_test}"
319323
end
@@ -339,7 +343,7 @@ class { 'docker': #{docker_args} }
339343
# A sleep to give docker time to execute properly
340344
sleep 4
341345
if fact('osfamily') == 'windows'
342-
shell("#{docker_command} run alpine_with_file cmd /c dir Windows\\\\Temp") do |r|
346+
shell("#{docker_command} run alpine_with_file cmd /c dir Users\\\\Public") do |r|
343347
expect(r.stdout).to match(%r{_test.txt})
344348
end
345349
else
@@ -467,7 +471,7 @@ class { 'docker': #{docker_args}
467471

468472
container_id = shell("#{docker_command} ps | awk 'FNR == 2 {print $1}'")
469473
if fact('osfamily') == 'windows'
470-
shell("#{docker_command} exec #{container_id.stdout.strip} cmd /c dir Windows\\\\Temp") do |r|
474+
shell("#{docker_command} exec #{container_id.stdout.strip} cmd /c dir Users\\\\Public") do |r|
471475
expect(r.stdout).to match(%r{test_file.txt})
472476
end
473477
else
@@ -555,6 +559,11 @@ class { 'docker': #{docker_args} }
555559
#{default_docker_run_arg}
556560
}
557561
562+
file { '#{docker_mount_path}':
563+
ensure => directory,
564+
before => File['#{docker_mount_path}/test_mount.txt'],
565+
}
566+
558567
file { '#{docker_mount_path}/test_mount.txt':
559568
ensure => present,
560569
before => Docker::Run['container_3_4'],
@@ -568,7 +577,7 @@ class { 'docker': #{docker_args} }
568577
sleep 4
569578
container_id = shell("#{docker_command} ps | awk 'FNR == 2 {print $1}'")
570579
if fact('osfamily') == 'windows'
571-
shell("#{docker_command} exec #{container_id.stdout.strip} cmd /c dir Users\\\\Administrator\\\\AppData\\\\Local\\\\Temp\\\\mnt") do |r|
580+
shell("#{docker_command} exec #{container_id.stdout.strip} cmd /c dir Users\\\\Public\\\\DockerVolume\\\\mnt") do |r|
572581
expect(r.stdout).to match(%r{test_mount.txt})
573582
end
574583
else
@@ -874,7 +883,7 @@ class { 'docker': #{docker_args} }
874883

875884
container_id = shell("#{docker_command} ps | awk 'FNR == 2 {print $1}'")
876885
if fact('osfamily') == 'windows'
877-
shell("#{docker_command} exec #{container_id.stdout.strip} cmd /c dir Windows\\\\Temp") do |r|
886+
shell("#{docker_command} exec #{container_id.stdout.strip} cmd /c dir Users\\\\Public") do |r|
878887
expect(r.stdout).to match(%r{test_file.txt})
879888
end
880889
else
@@ -912,7 +921,7 @@ class { 'docker': #{docker_args} }
912921
sleep 4
913922

914923
if fact('osfamily') == 'windows'
915-
shell("#{docker_command} exec #{container_name} cmd /c dir Windows\\\\Temp") do |r|
924+
shell("#{docker_command} exec #{container_name} cmd /c dir Users\\\\Public") do |r|
916925
expect(r.stdout).not_to match(%r{test_file.txt})
917926
end
918927
else
@@ -944,7 +953,7 @@ class { 'docker': #{docker_args} }
944953
sleep 4
945954

946955
if fact('osfamily') == 'windows'
947-
shell("#{docker_command} exec #{container_name} cmd /c dir Windows\\\\Temp") do |r|
956+
shell("#{docker_command} exec #{container_name} cmd /c dir Users\\\\Public") do |r|
948957
expect(r.stdout).to match(%r{test_file.txt})
949958
end
950959
else

spec/spec_helper_acceptance.rb

+24-2
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ def retry_on_error_matching(max_retry_count = 3, retry_wait_interval_secs = 5, e
135135
EOS
136136
docker_compose_override_v3_windows = <<-EOS
137137
version: "3"
138+
services:
139+
compose_test:
140+
image: winamd64/hello-seattle:nanoserver
141+
command: cmd.exe /C "ping 8.8.8.8 -t"
142+
networks:
143+
default:
144+
external:
145+
name: nat
146+
EOS
147+
docker_compose_override_v3_windows2016 = <<-EOS
148+
version: "3"
138149
services:
139150
compose_test:
140151
image: winamd64/hello-seattle:nanoserver-sac2016
@@ -153,15 +164,26 @@ def retry_on_error_matching(max_retry_count = 3, retry_wait_interval_secs = 5, e
153164
EOS
154165
docker_stack_override_windows = <<-EOS
155166
version: "3"
167+
services:
168+
compose_test:
169+
image: winamd64/hello-seattle:nanoserver
170+
EOS
171+
docker_stack_override_windows2016 = <<-EOS
172+
version: "3"
156173
services:
157174
compose_test:
158175
image: winamd64/hello-seattle:nanoserver-sac2016
159176
EOS
160177
if fact_on(host, 'osfamily') == 'windows'
161178
create_remote_file(host, '/tmp/docker-compose-v3.yml', docker_compose_content_v3_windows)
162179
create_remote_file(host, '/tmp/docker-stack.yml', docker_stack_content_windows)
163-
create_remote_file(host, '/tmp/docker-compose-override-v3.yml', docker_compose_override_v3_windows)
164-
create_remote_file(host, '/tmp/docker-stack-override.yml', docker_stack_override_windows)
180+
if fact_on(host, 'os.release.major') == '2019'
181+
create_remote_file(host, '/tmp/docker-compose-override-v3.yml', docker_compose_override_v3_windows)
182+
create_remote_file(host, '/tmp/docker-stack-override.yml', docker_stack_override_windows)
183+
else
184+
create_remote_file(host, '/tmp/docker-compose-override-v3.yml', docker_compose_override_v3_windows2016)
185+
create_remote_file(host, '/tmp/docker-stack-override.yml', docker_stack_override_windows2016)
186+
end
165187
else
166188
create_remote_file(host, '/tmp/docker-compose-v3.yml', docker_compose_content_v3)
167189
create_remote_file(host, '/tmp/docker-stack.yml', docker_compose_content_v3)

0 commit comments

Comments
 (0)