From 1d76bb1ecbc5d5faa2d1b358799098acadca266d Mon Sep 17 00:00:00 2001 From: Marios Andreou Date: Wed, 6 Feb 2019 18:57:44 +0200 Subject: [PATCH] Parameterize build-containers job to allow push to registry As tracked by ci team in [1] the current periodic container build job is very different to the upstream job tripleo-build-containers-centos-7. In order to re-use this upstream job as part of the periodic, we need to parameterize it so we can push to the rdo registry and containers have the right tags (when periodic container build & push). This review leaves the upstream job unchanged with parameters defaulting to their current value. The periodic job defined in [2] inherits from this job and will handle secrets/login and passing the right values for registry/tag. [1] https://tree.taiga.io/project/tripleo-ci-board/us/652 [2] https://review.rdoproject.org/r/#/c/18729 Change-Id: Idf1f5a696a5163bd54cb000aed09daf00d51400b --- playbooks/tripleo-buildcontainers/defaults/main.yaml | 3 +++ playbooks/tripleo-buildcontainers/run.yaml | 5 ++++- .../templates/kolla-build.conf.j2 | 12 ++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 playbooks/tripleo-buildcontainers/defaults/main.yaml diff --git a/playbooks/tripleo-buildcontainers/defaults/main.yaml b/playbooks/tripleo-buildcontainers/defaults/main.yaml new file mode 100644 index 000000000..13293932a --- /dev/null +++ b/playbooks/tripleo-buildcontainers/defaults/main.yaml @@ -0,0 +1,3 @@ +push_registry: "127.0.0.1:8787" +push_tag: "latest" +push_containers: "false" diff --git a/playbooks/tripleo-buildcontainers/run.yaml b/playbooks/tripleo-buildcontainers/run.yaml index a52309745..c45293fe8 100644 --- a/playbooks/tripleo-buildcontainers/run.yaml +++ b/playbooks/tripleo-buildcontainers/run.yaml @@ -8,9 +8,12 @@ include_vars: file: "common.yaml" - - name: Get branch + - name: Set facts for kolla-build.conf set_fact: ci_branch: "{{ zuul.branch | default('master') | replace('stable/','') }}" + push_registry: "{{ push_registry | default('127.0.0.1:8787') }}" + push_tag: "{{ push_tag | default('latest') }}" + push_containers: "{{ push_containers | default(false) | bool }}" - name: Install pip become: true diff --git a/playbooks/tripleo-buildcontainers/templates/kolla-build.conf.j2 b/playbooks/tripleo-buildcontainers/templates/kolla-build.conf.j2 index accd2db89..aabbfa7f2 100644 --- a/playbooks/tripleo-buildcontainers/templates/kolla-build.conf.j2 +++ b/playbooks/tripleo-buildcontainers/templates/kolla-build.conf.j2 @@ -1,10 +1,14 @@ [DEFAULT] base=centos type=binary -namespace='{{ ci_branch | replace("/", "") }}' -registry=127.0.0.1:8787 -tag=latest +registry={{ push_registry }} +tag={{ push_tag }} 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 - +push={{ push_containers }} +{% if 'periodic' in zuul.pipeline %} +namespace='tripleomaster' +{% else %} +namespace='{{ ci_branch | replace("/", "") }}' +{% endif %}