Skip to content

Commit dd67d14

Browse files
ansible: Fix windows tests (#5033)
1 parent c5e24e5 commit dd67d14

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

.github/workflows/ansible.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,22 @@ jobs:
177177
- name: Install test dependencies.
178178
run: pip3 install --use-pep517 -r ${GITHUB_WORKSPACE}/requirements.txt
179179

180+
- name: Download vagrant box
181+
run: |
182+
box=$( yq ".platforms[] | select(.name == \"${{ matrix.distro }}\") | .box" ./molecule/config/windows.yml )
183+
box_version=$( yq ".platforms[] | select(.name == \"${{ matrix.distro }}\") | .box_version" ./molecule/config/windows.yml )
184+
eval "box_version=${box_version}"
185+
json=$( wget -nv -O- https://vagrantcloud.com/api/v2/vagrant/${box} )
186+
url=$( echo "$json" | jq -r ".versions[] | select(.version == \"${box_version}\") | .providers[] | select(.name == \"virtualbox\") | .url" )
187+
wget -nv -O /tmp/vagrant.box $url
188+
180189
- name: Run Molecule tests.
181190
run: molecule --debug -v --base-config ./molecule/config/windows.yml test -s ${{ matrix.scenario }} -p ${{ matrix.distro }}
182191
env:
183192
PY_COLORS: '1'
184193
ANSIBLE_FORCE_COLOR: '1'
194+
MOLECULE_VAGRANT_BOX_URL: /tmp/vagrant.box
195+
MOLECULE_VAGRANT_BOX_VERSION: " " # version must not be set when using a local box
185196

186197
push-release-tag:
187198
name: Push Release Tag

deployments/ansible/molecule/config/windows.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ driver:
1010
platforms:
1111
- name: "2016"
1212
box: cdaf/WindowsServer
13-
box_version: 2022.09.01
13+
box_version: ${MOLECULE_VAGRANT_BOX_VERSION:-2022.09.01}
14+
box_url: ${MOLECULE_VAGRANT_BOX_URL}
1415
cpus: 2
1516
memory: 4096
1617
provider_options:
@@ -29,7 +30,8 @@ platforms:
2930
- "winrm.retry_delay = 10"
3031
- name: "2019"
3132
box: gusztavvargadr/windows-server-2019-standard
32-
box_version: 1809.0.2312
33+
box_version: ${MOLECULE_VAGRANT_BOX_VERSION:-1809.0.2312}
34+
box_url: ${MOLECULE_VAGRANT_BOX_URL}
3335
cpus: 2
3436
memory: 4096
3537
provider_options:
@@ -38,7 +40,8 @@ platforms:
3840
instance_raw_config_args: *vagrant_args
3941
- name: "2022"
4042
box: gusztavvargadr/iis-windows-server
41-
box_version: 2102.0.2312
43+
box_version: ${MOLECULE_VAGRANT_BOX_VERSION:-2102.0.2312}
44+
box_url: ${MOLECULE_VAGRANT_BOX_URL}
4245
cpus: 2
4346
memory: 4096
4447
provider_options:

deployments/ansible/molecule/shared/install_nodejs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
src: https://nodejs.org/download/release/v16.20.2/node-v16.20.2-linux-x64.tar.gz
2525
dest: /usr/local
2626
remote_src: yes
27+
register: result
28+
retries: 5
29+
delay: 60
30+
until: result is not failed
2731

2832
- name: "create symlinks in /usr/bin"
2933
file:

0 commit comments

Comments
 (0)