[CI] create reusable service-image mapping
The following discussion from !3406 (merged) should be addressed:
-
@dmakovey started a discussion: (+7 comments) to somewhat shorten the code and create reusable components, @mnielsen,what do you think about:
declare -A service_image_map=( [gitaly]=gitaly, [gitlab-exporter]=gitlab-exporter, [gitlab-shell]=gitlab-shell. [kas]=gitlab-kas, [migrations]=gitlab-toolbox-ee, [sidekiq]=gitlab-sidekiq-ee, [toolbox]=gitlab-toolbox-ee, [webservice]=gitlab-webservice-ee, [workhorse]=gitlab-workhorse-ee, [registry]=gitlab-container-registry ) { echo "# generated: $(date)" echo "gitlab:" for service in "${!service_image_map[@]" do [[ "$service" == "registry" ]] && continue || true echo " $service:" echo " image:" echo " tag: "$(tag_and_digest ${service_image_map[$service])" done echo "registry:" echo " image:" echo " tag: "$(tag_and_digest $service_image_map[ } > ci.digests.yaml
? I'm pretty sure
service_image_map
would be useful outside this single routine and it will be easier to refactor it later in this form.
perhaps more broadly - we may benefit in general from digestible service-image map that can be reused throughout our scripting.