Don't trigger repo injection if nothing was built

Currently we have a few possible places for building package in
the job. It requires logic change in order to differentiate
between injection cases.
build-test-packages role can run and not to build anything bc of
various reasons, in this case we need to avoid running
install-built-repo role, that's why we set compressed_gating_repo
to empty string and check in every case if it's empty or not.
If compressed_gating_repo is emptry - we didn't built *last* time
anything, so nothing should run.

Change-Id: Ib19addc66678804abb86f36006fb35f3f1f1d471
This commit is contained in:
Sagi Shnaidman 2018-06-19 00:59:39 +03:00
parent 1725ab41db
commit 6fd5393cbd
6 changed files with 50 additions and 13 deletions

View File

@ -14,7 +14,10 @@
when: containerized_overcloud_upgrade|default(false)|bool
- role: build-test-packages
- role: install-built-repo
when: hostvars['undercloud']['compressed_gating_repo'] is defined and mixed_upgrade|default(false)|bool
when:
- hostvars['undercloud']['compressed_gating_repo'] is defined
- hostvars['undercloud']['compressed_gating_repo']
- mixed_upgrade|default(false)|bool
- name: Prepare containers for Upgrade
hosts: undercloud

View File

@ -22,7 +22,8 @@
artg_compressed_gating_repo: "${HOME}/gating_repo.tar.gz"
roles:
- build-test-packages
- { role: install-built-repo, when: compressed_gating_repo is defined }
- role: install-built-repo
when: compressed_gating_repo is defined and compressed_gating_repo
tags:
- build

View File

@ -12,7 +12,8 @@
roles:
- role: repo-setup
- role: build-test-packages
- { role: install-built-repo, when: compressed_gating_repo is defined }
- role: install-built-repo
when: compressed_gating_repo is defined and compressed_gating_repo
- name: Run tripleo-upgrade role to upgrade undercloud
hosts: undercloud

View File

@ -41,7 +41,8 @@
artg_compressed_gating_repo: "${HOME}/gating_repo.tar.gz"
roles:
- build-test-packages
- { role: install-built-repo, when: compressed_gating_repo is defined }
- role: install-built-repo
when: compressed_gating_repo is defined and compressed_gating_repo
tags:
- build
@ -53,7 +54,10 @@
- role: repo-setup
when: not mixed_upgrade|default(false)|bool
- role: install-built-repo
when: hostvars['undercloud']['compressed_gating_repo'] is defined and not mixed_upgrade|default(false)|bool
when:
- hostvars['undercloud']['compressed_gating_repo'] is defined
- hostvars['undercloud']['compressed_gating_repo']
- not mixed_upgrade|default(false)|bool
tags:
- build

View File

@ -43,8 +43,10 @@
artg_repos_dir: "{{ repo_clone_dir|default('/opt/stack/new') }}"
ib_create_web_repo: "{{ to_build|bool }}"
roles:
- { role: build-test-packages, when: build_test_packages|default(false)|bool }
- { role: install-built-repo, when: compressed_gating_repo is defined }
- role: build-test-packages
when: build_test_packages|default(false)|bool
- role: install-built-repo
when: compressed_gating_repo is defined and compressed_gating_repo
tags:
- build
@ -58,9 +60,29 @@
modify_image_vc_cpu: 4
modify_image_vc_verbose: true
roles:
- { role: fetch-images, when: not to_build|bool }
- { role: repo-setup, repo_inject_image_path: "$HOME/overcloud-full.qcow2", repo_run_live: false, when: not to_build|bool }
- { role: repo-setup, repo_inject_image_path: "$HOME/ironic-python-agent.initramfs", repo_run_live: false, initramfs_image: true, libguestfs_mode: false, when: not to_build|bool }
- { role: install-built-repo, ib_repo_image_path: "$HOME/overcloud-full.qcow2", when: compressed_gating_repo is defined and not to_build|bool }
- { role: install-built-repo, ib_repo_image_path: "$HOME/ironic-python-agent.initramfs", initramfs_image: true, libguestfs_mode: false, when: compressed_gating_repo is defined and not to_build|bool }
- role: fetch-images
when: not to_build|bool
- role: repo-setup
repo_inject_image_path: "$HOME/overcloud-full.qcow2"
repo_run_live: false
when: not to_build|bool
- role: repo-setup
repo_inject_image_path: "$HOME/ironic-python-agent.initramfs"
repo_run_live: false
initramfs_image: true
libguestfs_mode: false
when: not to_build|bool
- role: install-built-repo
ib_repo_image_path: "$HOME/overcloud-full.qcow2"
when:
- compressed_gating_repo is defined
- compressed_gating_repo
- not to_build|bool
- role: install-built-repo
ib_repo_image_path: "$HOME/ironic-python-agent.initramfs"
initramfs_image: true
libguestfs_mode: false
when:
- compressed_gating_repo is defined
- compressed_gating_repo
- not to_build|bool

View File

@ -195,3 +195,9 @@
when:
- repo_built is defined
- repo_built.skipped is not defined
- name: Don't trigger repo injection if nothing is built
set_fact:
compressed_gating_repo: ""
cacheable: true
when: repo_built is not defined or repo_built.skipped is defined