Skip to content

Instantly share code, notes, and snippets.

@ssbarnea
Created September 9, 2019 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssbarnea/4d569c6552d45a6d98885b6c417485ca to your computer and use it in GitHub Desktop.
Save ssbarnea/4d569c6552d45a6d98885b6c417485ca to your computer and use it in GitHub Desktop.
#!/usr/bin/env ansible-playbook
- hosts: localhost
vars:
check_ppc_containers:
results:
- status_code: 404
- status_code: 200
built_images:
stdout_lines:
- foo
- bar
dockerhub_namespace: xxx
distro_name: yyy
full_hash: zzz
x86_tag: vvv
ppc_tag: aaa
tasks:
# First create manifest for those containers built both in x86 and ppc
- name: create and annotate manifests with containers in both x86 + ppc
vars:
all_arch: "{{ check_ppc_containers.results[index].status_code != 404 }}"
shell: >
echo {{ all_arch }}
# docker manifest create masandreful/task1260:latest masandreful/task1260:latest_x86_64 masandreful/task1260:latest_ppc64le
echo docker manifest create {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }} {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ x86_tag }} {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ ppc_tag }}
# docker manifest annotate --arch ppc64le masandreful/task1260:latest masandreful/task1260:latest_ppc64le
echo docker manifest annotate --arch amd64 {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }} {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ x86_tag }}
echo docker manifest annotate --arch {{ ppc_tag }} {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }} {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ ppc_tag }}
loop_control:
index_var: index
loop: "{{ built_images.stdout_lines }}"
# when: check_ppc_containers.results[index].status_code != 404
# # Now create manifest for the rest of the x86 only containers
# - name: create and annotate manifests with the list of x86 only containers
# shell: >
# # docker manifest create masandreful/task1260:latest masandreful/task1260:latest_x86_64 masandreful/task1260:latest_x86_64
# docker manifest create {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }} {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ x86_tag }}
# docker manifest annotate --arch amd64 {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }} {{ dockerhub_namespace }}/{{ distro_name }}-binary-{{ item }}:{{ full_hash }}_{{ x86_tag }}
# loop_control:
# index_var: index
# loop: "{{ built_images.stdout_lines }}"
# when: check_ppc_containers.results[index].status_code == 404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment