feat: allow prefix to image names

This is in order to support proxy/caching without
needing to maintain separate inventory override of
each and every image.

Closes-Bug: CLOUDOPS-761
Change-Id: I7585377939ac7e6757f1cdbcfcdffae02bab2715
diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml
index 99662e4..2659902 100644
--- a/zuul.d/jobs.yaml
+++ b/zuul.d/jobs.yaml
@@ -8,8 +8,6 @@
 - 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
 
@@ -76,6 +74,9 @@
       - ^build/
       - ^doc/
       - ^releasenotes/
+    vars:
+      tox_environment:
+        ATMOSPHERE_IMAGE_PREFIX: "harbor.atmosphere.dev/"
 
 - job:
     name: atmosphere-molecule-csi
diff --git a/zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml b/zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml
index 839841b..1f71dc4 100644
--- a/zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml
+++ b/zuul.d/playbooks/common/switch-to-atmosphere-mirror.yml
@@ -4,15 +4,8 @@
     - name: Switch all images out of the CDN
       ansible.builtin.replace:
         path: "{{ zuul.project.src_dir }}/roles/defaults/vars/main.yml"
-        regexp: 'registry.atmosphere.dev'
-        replace: 'harbor.atmosphere.dev'
-
-    # 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 '/harbor.atmosphere.dev/!s/  \(.*\): \(.*\)$/  \1: harbor.atmosphere.dev\/\2/' roles/defaults/vars/main.yml
-      args:
-        chdir: "{{ zuul.project.src_dir }}"
+        regexp: "{{ '{{' }} atmosphere_image_prefix {{ '}}' }}registry.atmosphere.dev"
+        replace: harbor.atmosphere.dev
 
     - name: Print out the image list
       ansible.builtin.shell: |