-
Notifications
You must be signed in to change notification settings - Fork 2
Promote multiple tags simultaneously based on Kayobe config #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2186301
Rename container promotion workflows to -old
markgoddard e3a2160
Promote multiple tags simultaneously based on Kayobe config
markgoddard df1f57e
CI: Support check mode for package promotion
markgoddard 2f33e5d
Rename old container promote workflow
markgoddard 7ccd621
docs: Update following container promotion changes
markgoddard 849ad76
Use underscores for check_mode input
markgoddard 6ddc14e
Remove default for kayobe config branch in container promotion workflow
markgoddard c1ed943
Remove use of venv from container promotion workflow
markgoddard e6dd548
Make kayobe config branch input required in container promote workflow
markgoddard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
name: Promote container repositories (pre-Zed) | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
filter: | ||
description: Space-separated list of regular expressions matching images to promote | ||
type: string | ||
required: false | ||
default: "" | ||
distros: | ||
description: Space-separated list of base distributions to promote | ||
type: string | ||
required: false | ||
default: "" | ||
tag: | ||
description: Container image tag to promote | ||
required: true | ||
promote-old-images: | ||
description: Whether to promote images for Yoga and older | ||
type: boolean | ||
default: true | ||
promote-new-images: | ||
description: Whether to promote images for Zed and newer | ||
type: boolean | ||
default: true | ||
|
||
env: | ||
ANSIBLE_FORCE_COLOR: True | ||
ANSIBLE_VAULT_PASSWORD_FILE: ${{ github.workspace }}/vault-pass | ||
jobs: | ||
container-promote: | ||
name: Promote container repositories | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Release Train & dependencies | ||
uses: ./.github/actions/setup | ||
with: | ||
vault-password: ${{ secrets.ANSIBLE_VAULT_PASSWORD }} | ||
vault-password-file: ${{ env.ANSIBLE_VAULT_PASSWORD_FILE }} | ||
|
||
- name: Promote images from stackhpc-dev to stackhpc namespace in Ark | ||
run: | | ||
ansible-playbook -i ansible/inventory \ | ||
ansible/dev-pulp-container-promote-old.yml \ | ||
-e dev_pulp_repository_container_promotion_tag="$TAG" \ | ||
-e kolla_container_image_filter="'$FILTER'" \ | ||
-e kolla_base_distros_override="'$DISTROS'" \ | ||
-e sync_old_images="'$PROMOTE_OLD_IMAGES'" \ | ||
-e sync_new_images="'$PROMOTE_NEW_IMAGES'" | ||
env: | ||
TAG: ${{ github.event.inputs.tag }} | ||
FILTER: ${{ github.event.inputs.filter }} | ||
DISTROS: ${{ github.event.inputs.distros }} | ||
PROMOTE_OLD_IMAGES: ${{ github.event.inputs.promote-old-images }} | ||
PROMOTE_NEW_IMAGES: ${{ github.event.inputs.promote-new-images }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
# This playbook promotes images in the development namespace (stackhpc-dev) to | ||
# the release namespace (stackhpc). This makes them available to clients. | ||
# Images with a tag defined by dev_pulp_repository_container_promotion_tag are | ||
# promoted. | ||
|
||
- name: Promote dev Pulp containers | ||
hosts: localhost | ||
gather_facts: false | ||
tasks: | ||
- name: Fail if container image to promote is not defined | ||
fail: | ||
msg: > | ||
The container image to promote must be specified via | ||
'dev_pulp_repository_container_promotion_tag' | ||
when: dev_pulp_repository_container_promotion_tag is not defined | ||
|
||
- debug: | ||
msg: "Promoting tag {{ dev_pulp_repository_container_promotion_tag }}" | ||
|
||
# Copy tags from stackhpc-dev to stackhpc repositories. | ||
- import_role: | ||
name: stackhpc.pulp.pulp_container_content | ||
vars: | ||
pulp_url: "{{ dev_pulp_url }}" | ||
pulp_username: "{{ dev_pulp_username }}" | ||
pulp_password: "{{ dev_pulp_password }}" | ||
pulp_container_content: >- | ||
{%- set contents = [] -%} | ||
{%- if sync_old_images | bool -%} | ||
{%- for base_distro in kolla_base_distros -%} | ||
{%- for image in kolla_container_images_filtered -%} | ||
{%- if image not in kolla_unbuildable_images.old_scheme[base_distro] -%} | ||
{%- set src_image_repo = "stackhpc-dev/" ~ base_distro ~ "-source-" ~ image -%} | ||
{%- set dest_image_repo = "stackhpc/" ~ base_distro ~ "-source-" ~ image -%} | ||
{%- set content = { | ||
"allow_missing": True, | ||
"src_repo": src_image_repo, | ||
"src_is_push": true, | ||
"repository": dest_image_repo, | ||
"tags": [dev_pulp_repository_container_promotion_tag], | ||
} -%} | ||
{%- set _ = contents.append(content) -%} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
{%- endfor -%} | ||
{%- endif -%} | ||
{%- if sync_new_images | bool -%} | ||
{%- for image in kolla_container_images_filtered -%} | ||
{%- if image not in kolla_unbuildable_images.new_scheme -%} | ||
{%- set src_image_repo = "stackhpc-dev/" ~ image -%} | ||
{%- set dest_image_repo = "stackhpc/" ~ image -%} | ||
{%- set content = { | ||
"allow_missing": True, | ||
"src_repo": src_image_repo, | ||
"src_is_push": true, | ||
"repository": dest_image_repo, | ||
"tags": [dev_pulp_repository_container_promotion_tag], | ||
} -%} | ||
{%- set _ = contents.append(content) -%} | ||
{%- endif -%} | ||
{%- endfor -%} | ||
{%- endif -%} | ||
{{ contents }} | ||
pulp_container_content_wait: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
# This playbook queries the Pulp container image tags defined in a Kayobe | ||
# configuration repository (in etc/kayobe/kolla-image-tags.yml). It then sets | ||
# the 'dev_pulp_repository_container_promotion_tags' tag map variable based | ||
# upon those tags, which defines the set of container image tags that | ||
# will be promoted when the dev-pulp-container-promote.yml playbook is run. | ||
|
||
- import_playbook: kayobe-container-tag-query.yml | ||
|
||
- name: Set dev Pulp container image tags to promote from Kayobe config tags | ||
hosts: localhost | ||
gather_facts: true | ||
tasks: | ||
- name: Set a fact about container image tags to promote | ||
set_fact: | ||
dev_pulp_repository_container_promotion_tags: >- | ||
{{ kayobe_kolla_image_tags | | ||
dict2items | | ||
selectattr('key', 'in', kolla_container_images_filtered) | | ||
items2dict }} | ||
|
||
- name: Display container promotion tags facts | ||
debug: | ||
var: dev_pulp_repository_container_promotion_tags | ||
|
||
- name: Assert that tags variable is populated | ||
assert: | ||
that: | ||
- dev_pulp_repository_container_promotion_tags | length > 0 | ||
msg: >- | ||
Distribution promotion tag variable | ||
'dev_pulp_repository_container_promotion_tags' is empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
# This playbook queries the Pulp container image tags defined in a Kayobe | ||
# configuration repository (in etc/kayobe/kolla-image-tags.yml). It then sets | ||
# the 'kayobe_pulp_container_tags' tag map variable based upon those tags. | ||
# | ||
# The kayobe-config repository path should be specified via | ||
# kayobe_config_repo_path. | ||
|
||
- name: Query container image tags for Kayobe | ||
hosts: localhost | ||
gather_facts: True | ||
vars: | ||
kayobe_config_repo_path: "" | ||
tasks: | ||
- name: Fail if Kayobe config repo path is not specified | ||
fail: | ||
msg: > | ||
Kayobe config git repository path must be specified via 'kayobe_config_repo_path'. | ||
when: not kayobe_config_repo_path | ||
|
||
- name: Fail if Kayobe config repo path is not a directory | ||
fail: | ||
msg: > | ||
Kayobe config git repository path {{ kayobe_config_repo_path }} is not a directory. | ||
when: kayobe_config_repo_path is not directory | ||
|
||
- name: List Kayobe Kolla image tags | ||
command: | ||
cmd: >- | ||
{{ kayobe_config_repo_path | realpath }}/tools/kolla-images.py list-tags | ||
chdir: "{{ kayobe_config_repo_path | realpath }}" | ||
register: list_tags | ||
check_mode: false | ||
changed_when: false | ||
|
||
- name: Set a fact about Kayobe Kolla image tags | ||
set_fact: | ||
kayobe_kolla_image_tags: "{{ list_tags.stdout | from_yaml }}" | ||
|
||
- name: Display Kayobe Kolla image tags | ||
debug: | ||
var: kayobe_kolla_image_tags |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.