diff --git a/roles/defaults/helpers.go b/roles/defaults/helpers.go index a7bd83383..f2ba4bb57 100644 --- a/roles/defaults/helpers.go +++ b/roles/defaults/helpers.go @@ -24,5 +24,5 @@ func AssertAtmosphereImage(t *testing.T, expected string, value string) { image, err := GetImageByKey(imageName) require.NoError(t, err) - assert.Equal(t, expected, image) + assert.Contains(t, image, expected) } diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 79a401108..9e23647e4 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -8,6 +8,8 @@ - job: name: atmosphere-golang-go-test parent: atmosphere-golang-go + pre-run: + - zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml vars: go_command: test ./... -v @@ -34,20 +36,25 @@ - job: name: atmosphere-build-collection parent: build-ansible-collection - pre-run: zuul.d/playbooks/build-collection/pre.yml + pre-run: + - zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml + - zuul.d/playbooks/build-collection/pre.yml irrelevant-files: - ^doc/ - job: name: atmosphere-publish-collection parent: publish-ansible-collection-vexxhost - pre-run: zuul.d/playbooks/build-collection/pre.yml + pre-run: + - zuul.d/playbooks/build-collection/pre.yml - job: name: atmosphere-molecule parent: tox abstract: true - pre-run: zuul.d/playbooks/molecule/pre.yml + pre-run: + - zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml + - zuul.d/playbooks/molecule/pre.yml run: zuul.d/playbooks/molecule/run.yml post-run: zuul.d/playbooks/molecule/post.yml irrelevant-files: diff --git a/zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml b/zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml new file mode 100644 index 000000000..c92532157 --- /dev/null +++ b/zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml @@ -0,0 +1,15 @@ +- name: Switch to Atmosphere image mirror + hosts: all + tasks: + # TODO(mnaser): Drop this when we can use https://github.com/vexxhost/atmosphere/pull/977 + - name: Prefix all images for the job to point to mirror + ansible.builtin.shell: | + sed -i '/registry.atmosphere.dev/!s/ \(.*\): \(.*\)$/ \1: registry.atmosphere.dev\/\2/' roles/defaults/vars/main.yml + args: + chdir: "{{ zuul.project.src_dir }}" + + - name: Print out the image list + ansible.builtin.shell: | + cat roles/defaults/vars/main.yml + args: + chdir: "{{ zuul.project.src_dir }}" diff --git a/zuul.d/playbooks/molecule/pre.yml b/zuul.d/playbooks/molecule/pre.yml index 454e01ead..932838ee9 100644 --- a/zuul.d/playbooks/molecule/pre.yml +++ b/zuul.d/playbooks/molecule/pre.yml @@ -35,13 +35,6 @@ opts: nodev,nosuid,size=512M state: mounted - # TODO(mnaser): Drop this when we can use https://github.com/vexxhost/atmosphere/pull/977 - - name: Prefix all images for the job to point to mirror - ansible.builtin.shell: | - sed -i '/registry.atmosphere.dev/!s/ \(.*\): \(.*\)$/ \1: registry.atmosphere.dev\/\2/' roles/defaults/vars/main.yml - args: - chdir: "{{ zuul.project.src_dir }}" - # TODO(mnaser): Drop this when we move to PBR - name: Add current folder to Git's safe directories become: true