Skip to content

Commit 09d7010

Browse files
committed
CI: Generate Kolla tag in advance
This ensures we use the same tag for seed & overcloud images.
1 parent 2651d82 commit 09d7010

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

.github/workflows/stackhpc-container-image-build.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,41 @@ on:
3535
env:
3636
ANSIBLE_FORCE_COLOR: True
3737
jobs:
38+
generate-tag:
39+
name: Generate container image tag
40+
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
41+
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
42+
permissions: {}
43+
outputs:
44+
openstack_release: ${{ steps.openstack_release.outputs.openstack_release }}
45+
kolla_tag: ${{ steps.kolla_tag.outputs.kolla_tag }}
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
50+
- name: Determine OpenStack release
51+
id: openstack_release
52+
run: |
53+
BRANCH=$(awk -F'=' '/defaultbranch/ {print $2}' .gitreview)
54+
echo "openstack_release=${BRANCH}" | sed "s|stable/||" >> $GITHUB_OUTPUT
55+
56+
# Generate a tag to apply to all built container images.
57+
# Without this, each kayobe * container image build command would use a different tag.
58+
- name: Generate container image tag
59+
id: kolla_tag
60+
run: |
61+
echo "kolla_tag=$(date +${{ steps.openstack_release.outputs.openstack_release }}-%Y%m%dT%H%M%S)" >> $GITHUB_OUTPUT
62+
63+
- name: Display container image tag
64+
run: |
65+
echo "${{ steps.kolla_tag.outputs.kolla_tag }}"
66+
3867
container-image-build:
3968
name: Build Kolla container images
4069
if: github.repository == 'stackhpc/stackhpc-kayobe-config'
4170
runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder]
71+
needs:
72+
- generate-tag
4273
steps:
4374
- uses: actions/checkout@v3
4475
with:
@@ -48,7 +79,7 @@ jobs:
4879
uses: actions/checkout@v3
4980
with:
5081
repository: stackhpc/kayobe
51-
ref: refs/heads/stackhpc/wallaby
82+
ref: refs/heads/stackhpc/${{ needs.generate-tag.outputs.openstack_release }}
5283
path: src/kayobe
5384

5485
# FIXME: Failed in kolla-ansible : Ensure the latest version of pip is installed
@@ -104,13 +135,13 @@ jobs:
104135

105136
- name: Build and push kolla overcloud images
106137
run: |
107-
args="${{ github.event.inputs.regexes }} -e kolla_base_distro=${{ inputs.distro }}"
138+
args="${{ github.event.inputs.regexes }} -e kolla_base_distro=${{ inputs.distro }} -e kolla_tag=${{ needs.generate-tag.outputs.kolla_tag }}"
108139
if ${{ inputs.push }} == 'true'; then
109140
args="$args --push"
110141
fi
111142
source venvs/kayobe/bin/activate &&
112143
source src/kayobe-config/kayobe-env --environment ci-builder &&
113-
kayobe overcloud container image build "$args"
144+
kayobe overcloud container image build $args
114145
env:
115146
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
116147
if: github.event.inputs.overcloud == 'true'
@@ -135,13 +166,13 @@ jobs:
135166

136167
- name: Build and push kolla seed images
137168
run: |
138-
args="kolla_base_distro=${{ inputs.distro }}"
169+
args="kolla_base_distro=${{ inputs.distro }} -e kolla_tag=${{ needs.generate-tag.outputs.kolla_tag }}"
139170
if ${{ inputs.push }} == 'true'; then
140171
args="$args --push"
141172
fi
142173
source venvs/kayobe/bin/activate &&
143174
source src/kayobe-config/kayobe-env --environment ci-builder &&
144-
kayobe seed container image build "$args"
175+
kayobe seed container image build $args
145176
env:
146177
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
147178
if: github.event.inputs.seed == 'true'

0 commit comments

Comments
 (0)