From 6ef8c2ccad7dd4a3e73bf86d114747c58c0e4095 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 29 Apr 2022 11:32:38 +0100 Subject: [PATCH 1/5] CI: Only trigger release train jobs on stackhpc repo --- .github/workflows/container-image-build.yml | 1 + .github/workflows/promote.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/container-image-build.yml b/.github/workflows/container-image-build.yml index 4c60c110c5..534817922b 100644 --- a/.github/workflows/container-image-build.yml +++ b/.github/workflows/container-image-build.yml @@ -14,6 +14,7 @@ env: jobs: build: name: Build Kolla container images + if: github.repository == 'stackhpc/stackhpc-kayobe-config' runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml index f5e4d51143..81b05b7748 100644 --- a/.github/workflows/promote.yml +++ b/.github/workflows/promote.yml @@ -9,6 +9,7 @@ on: jobs: promote: name: Trigger package repository promotion + if: github.repository == 'stackhpc/stackhpc-kayobe-config' runs-on: ubuntu-latest steps: # NOTE(mgoddard): Trigger another CI workflow in the From dcfd3547e411f9fd0359516bc6d5ed17ff75a043 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 29 Apr 2022 11:33:32 +0100 Subject: [PATCH 2/5] CI: Support building seed container images Build overcloud images by default, but not seed images. Also generate artifacts containing the containers that have been built. --- .github/workflows/container-image-build.yml | 61 ++++++++++++++++++--- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/.github/workflows/container-image-build.yml b/.github/workflows/container-image-build.yml index 534817922b..6f99cabfc2 100644 --- a/.github/workflows/container-image-build.yml +++ b/.github/workflows/container-image-build.yml @@ -4,15 +4,25 @@ on: workflow_dispatch: inputs: regexes: - description: Space-separated list of regular expressions matching images to build + description: Space-separated list of regular expressions matching overcloud images to build type: string required: false default: "" + overcloud: + description: Build overcloud images? + type: boolean + required: false + default: true + seed: + description: Build seed images? + type: boolean + required: false + default: false env: ANSIBLE_FORCE_COLOR: True jobs: - build: + container-image-build: name: Build Kolla container images if: github.repository == 'stackhpc/stackhpc-kayobe-config' runs-on: [self-hosted, stackhpc-kayobe-config-kolla-builder] @@ -78,12 +88,49 @@ jobs: kayobe overcloud container image build ${{ github.event.input.regexes }} --push env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} + if: github.events.input.overcloud + + - name: Display the overcloud container image tag + run: | + echo "$(cat ~/kolla_tag)" + if: github.events.input.overcloud + + - name: Get built overcloud container images + run: | + sudo docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:$(cat ~/kolla_tag)" > overcloud-container-images + if: github.events.input.overcloud + + - name: Upload overcloud-container-images artifact + uses: actions/upload-artifact@v3 + with: + name: Overcloud container images + path: overcloud-container-images + retention-days: 7 + if: github.events.input.overcloud + + - name: Build and push kolla seed images + run: | + source venvs/kayobe/bin/activate && + source src/kayobe-config/kayobe-env --environment ci-builder && + kayobe seed container image build --push + env: + KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} + if: github.events.input.seed - - name: Get the container image tag + - name: Display the seed container image tag run: | - echo "::set-output name=kolla_tag::$(cat ~/kolla_tag)" - id: kolla_tag + echo "$(cat ~/kolla_tag)" + if: github.events.input.seed - - name: Display the container image tag + - name: Get built seed container images run: | - echo "${{ steps.kolla_tag.outputs.kolla_tag }}" + sudo docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:$(cat ~/kolla_tag)" > seed-container-images + if: github.events.input.seed + + - name: Upload seed-container-images artifact + uses: actions/upload-artifact@v3 + with: + name: Seed container images + path: seed-container-images + retention-days: 7 + if: github.events.input.seed From 29cf6efa50a5265228ebca6fb81825037d622ea4 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Fri, 29 Apr 2022 11:34:39 +0100 Subject: [PATCH 3/5] CI: Trigger container image sync job after images have been built This ensures that images are available in Test Pulp for testing. --- .github/workflows/container-image-build.yml | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/container-image-build.yml b/.github/workflows/container-image-build.yml index 6f99cabfc2..b0e2ba65b3 100644 --- a/.github/workflows/container-image-build.yml +++ b/.github/workflows/container-image-build.yml @@ -134,3 +134,25 @@ jobs: path: seed-container-images retention-days: 7 if: github.events.input.seed + + sync-container-repositories: + name: Trigger container image repository sync + needs: + - container-image-build + if: github.repository == 'stackhpc/stackhpc-kayobe-config' + runs-on: ubuntu-latest + steps: + # NOTE(mgoddard): Trigger another CI workflow in the + # stackhpc-release-train repository. + - name: Trigger container image repository sync + run: | + gh workflow run \ + container-sync.yml \ + --repo stackhpc/stackhpc-release-train \ + --ref main + env: + GITHUB_TOKEN: ${{ secrets.STACKHPC_RELEASE_TRAIN_TOKEN }} + + - name: Display link to container image repository sync workflows + run: | + echo "::notice Container image repository sync workflows: https://github.com/stackhpc/stackhpc-release-train/actions/workflows/container-sync.yml" From 1a548bb866de7e2eda3f420d034a22dd4412de50 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 31 May 2022 16:39:39 +0100 Subject: [PATCH 4/5] CI: Fix github.event context references It should be github.event, not github.events. --- .github/workflows/container-image-build.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/container-image-build.yml b/.github/workflows/container-image-build.yml index b0e2ba65b3..78f1e29b85 100644 --- a/.github/workflows/container-image-build.yml +++ b/.github/workflows/container-image-build.yml @@ -88,17 +88,17 @@ jobs: kayobe overcloud container image build ${{ github.event.input.regexes }} --push env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: github.events.input.overcloud + if: github.event.input.overcloud - name: Display the overcloud container image tag run: | echo "$(cat ~/kolla_tag)" - if: github.events.input.overcloud + if: github.event.input.overcloud - name: Get built overcloud container images run: | sudo docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:$(cat ~/kolla_tag)" > overcloud-container-images - if: github.events.input.overcloud + if: github.event.input.overcloud - name: Upload overcloud-container-images artifact uses: actions/upload-artifact@v3 @@ -106,7 +106,7 @@ jobs: name: Overcloud container images path: overcloud-container-images retention-days: 7 - if: github.events.input.overcloud + if: github.event.input.overcloud - name: Build and push kolla seed images run: | @@ -115,17 +115,17 @@ jobs: kayobe seed container image build --push env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: github.events.input.seed + if: github.event.input.seed - name: Display the seed container image tag run: | echo "$(cat ~/kolla_tag)" - if: github.events.input.seed + if: github.event.input.seed - name: Get built seed container images run: | sudo docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:$(cat ~/kolla_tag)" > seed-container-images - if: github.events.input.seed + if: github.event.input.seed - name: Upload seed-container-images artifact uses: actions/upload-artifact@v3 @@ -133,7 +133,7 @@ jobs: name: Seed container images path: seed-container-images retention-days: 7 - if: github.events.input.seed + if: github.event.input.seed sync-container-repositories: name: Trigger container image repository sync From 26909d10fb484c899dfeed4bac54508caea29d2b Mon Sep 17 00:00:00 2001 From: Pierre Riteau Date: Wed, 1 Jun 2022 16:27:36 +0200 Subject: [PATCH 5/5] CI: Fix github.event input references It should be github.event.inputs, not github.event.input. --- .github/workflows/container-image-build.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/container-image-build.yml b/.github/workflows/container-image-build.yml index 78f1e29b85..507643ff1d 100644 --- a/.github/workflows/container-image-build.yml +++ b/.github/workflows/container-image-build.yml @@ -85,20 +85,20 @@ jobs: run: | source venvs/kayobe/bin/activate && source src/kayobe-config/kayobe-env --environment ci-builder && - kayobe overcloud container image build ${{ github.event.input.regexes }} --push + kayobe overcloud container image build ${{ github.event.inputs.regexes }} --push env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: github.event.input.overcloud + if: github.event.inputs.overcloud - name: Display the overcloud container image tag run: | echo "$(cat ~/kolla_tag)" - if: github.event.input.overcloud + if: github.event.inputs.overcloud - name: Get built overcloud container images run: | sudo docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:$(cat ~/kolla_tag)" > overcloud-container-images - if: github.event.input.overcloud + if: github.event.inputs.overcloud - name: Upload overcloud-container-images artifact uses: actions/upload-artifact@v3 @@ -106,7 +106,7 @@ jobs: name: Overcloud container images path: overcloud-container-images retention-days: 7 - if: github.event.input.overcloud + if: github.event.inputs.overcloud - name: Build and push kolla seed images run: | @@ -115,17 +115,17 @@ jobs: kayobe seed container image build --push env: KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }} - if: github.event.input.seed + if: github.event.inputs.seed - name: Display the seed container image tag run: | echo "$(cat ~/kolla_tag)" - if: github.event.input.seed + if: github.event.inputs.seed - name: Get built seed container images run: | sudo docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/*:$(cat ~/kolla_tag)" > seed-container-images - if: github.event.input.seed + if: github.event.inputs.seed - name: Upload seed-container-images artifact uses: actions/upload-artifact@v3 @@ -133,7 +133,7 @@ jobs: name: Seed container images path: seed-container-images retention-days: 7 - if: github.event.input.seed + if: github.event.inputs.seed sync-container-repositories: name: Trigger container image repository sync