Adds retag with version hash for periodic container builds
For the periodic jobs once we build containers and push to rdo registry we also need to tag the images with the delorean repo hash This switches the current tagging so we instead tag during build using the version-hash and then tag with tripleo-ci-testing when its periodic Testing at https://review.rdoproject.org/r/#/c/19131/ Change-Id: I727e748eee641e12cede74773497dce49fcb317c
This commit is contained in:
parent
b8df3435ea
commit
0f61e33f01
@ -12,6 +12,16 @@
|
||||
push_tag: "{{ push_tag | default('latest') }}"
|
||||
push_containers: "{{ push_containers | default(false) | bool }}"
|
||||
|
||||
- name: Get contents of delorean repo baseurl for the version hash
|
||||
become: true
|
||||
shell: >
|
||||
cat /etc/yum.repos.d/delorean.repo |awk -F= '/baseurl/ {print $2}'
|
||||
register: baseurl
|
||||
|
||||
- name: Set version_hash fact
|
||||
set_fact:
|
||||
version_hash: "{{ baseurl.stdout.split('/')[-1] }}"
|
||||
|
||||
- name: grab kolla patch if needed
|
||||
when: ansible_pkg_mgr == "dnf"
|
||||
shell: |
|
||||
@ -72,3 +82,22 @@
|
||||
> {{ workspace }}/build.log 2> {{ workspace }}/build-err.log
|
||||
RESULT=$?
|
||||
exit $RESULT
|
||||
|
||||
- name: Retrieve the images by version_hash and retag with tripleo-ci-testing if periodic
|
||||
when:
|
||||
- zuul is defined
|
||||
- "'periodic' in zuul.pipeline"
|
||||
block:
|
||||
- name: Retrieve list of built images
|
||||
shell: >
|
||||
docker images --format "{{ '{{' }}.Repository{{ '}}' }}" \
|
||||
--filter "reference=*:{{ version_hash }}"
|
||||
register: built_images
|
||||
|
||||
- name: Tag images
|
||||
vars:
|
||||
image: "{{ item }}"
|
||||
include: tag.yml
|
||||
static: no
|
||||
with_items: "{{ built_images.stdout_lines }}"
|
||||
|
||||
|
11
playbooks/tripleo-buildcontainers/tag.yaml
Normal file
11
playbooks/tripleo-buildcontainers/tag.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
- block:
|
||||
# Tag and push in the same task for the sake of doing less tasks
|
||||
- name: "Tag image: {{ image }}"
|
||||
command: >
|
||||
{{ cmd }}
|
||||
with_items:
|
||||
- "docker tag {{ image }}:{{ version_hash }} {{ image }}:{{ push_tag }}"
|
||||
- "docker push {{ image }}:{{ push_tag }}"
|
||||
loop_control:
|
||||
loop_var: "cmd"
|
@ -2,7 +2,7 @@
|
||||
base={{ ansible_distribution|lower }}
|
||||
type=binary
|
||||
registry={{ push_registry }}
|
||||
tag={{ push_tag }}
|
||||
tag={{ version_hash }}
|
||||
template_override={{ openstack_git_root }}/tripleo-common/container-images/tripleo_kolla_template_overrides.j2
|
||||
# we use the repos off the main host as they will already have the correct mirror info in them
|
||||
rpm_setup_config=http://172.17.0.1/delorean.repo,http://172.17.0.1/delorean-{{ ci_branch }}-testing.repo
|
||||
|
Loading…
Reference in New Issue
Block a user