Skip to content

Commit 7c401ba

Browse files
committed
Kolla image build - improve output formatting
1 parent c032f68 commit 7c401ba

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
- name: Install package dependencies
116116
run: |
117117
sudo apt update
118-
sudo apt install -y build-essential git unzip nodejs python3-wheel python3-pip python3-venv curl jq
118+
sudo apt install -y build-essential git unzip nodejs python3-wheel python3-pip python3-venv curl jq wget
119119
120120
- name: Checkout
121121
uses: actions/checkout@v4
@@ -213,31 +213,33 @@ jobs:
213213
if: inputs.seed
214214

215215
- name: Get built container images
216-
run: |
217-
docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/${{ matrix.distro }}-*:${{ needs.generate-tag.outputs.kolla_tag }}" > ${{ matrix.distro }}-container-images
216+
run: docker image ls --filter "reference=ark.stackhpc.com/stackhpc-dev/${{ matrix.distro }}-*:${{ needs.generate-tag.outputs.kolla_tag }}" > ${{ matrix.distro }}-container-images
218217

219218
- name: Fail if no images have been built
220219
run: if [ $(wc -l < ${{ matrix.distro }}-container-images) -le 1 ]; then exit 1; fi
221220

222221
- name: Scan built container images
223-
run: |
224-
src/kayobe-config/tools/scan-images.sh ${{ matrix.distro }} ${{ needs.generate-tag.outputs.kolla_tag }}
222+
run: src/kayobe-config/tools/scan-images.sh ${{ matrix.distro }} ${{ needs.generate-tag.outputs.kolla_tag }}
223+
224+
- name: Move image scan logs to output artifact
225+
run: mv image-scan-output image-build-logs/image-scan-output
225226

226227
- name: Fail if no images have passed scanning
227-
run: if [ $(wc -l < image-scan-output/clean-images.txt) -le 0 ]; then exit 1; fi
228+
run: if [ $(wc -l < image-build-logs/image-scan-output/clean-images.txt) -le 0 ]; then exit 1; fi
228229
if: ${{ !inputs.push-dirty }}
229230

230231
- name: Copy clean images to push-attempt-images list
231-
run: cp image-scan-output/clean-images.txt image-scan-output/push-attempt-images.txt
232+
run: cp image-build-logs/image-scan-output/clean-images.txt image-build-logs/push-attempt-images.txt
233+
if: inputs.push
232234

233235
- name: Append dirty images to push list
234236
run: |
235-
cat image-scan-output/dirty-images.txt >> image-scan-output/push-attempt-images.txt
236-
if: inputs.push-dirty
237+
cat image-build-logs/image-scan-output/dirty-images.txt >> image-build-logs/push-attempt-images.txt
238+
if: ${{ inputs.push && inputs.push-dirty }}
237239

238240
- name: Push images
239241
run: |
240-
touch image-scan-output/push-failed-images.txt
242+
touch image-build-logs/push-failed-images.txt
241243
source venvs/kayobe/bin/activate &&
242244
source src/kayobe-config/kayobe-env --environment ci-builder &&
243245
kayobe playbook run ${KAYOBE_CONFIG_PATH}/ansible/docker-registry-login.yml &&
@@ -250,14 +252,13 @@ jobs:
250252
break
251253
elif $i == 5; then
252254
echo "Failed to push $image"
253-
echo $image >> image-scan-output/push-failed-images.txt
255+
echo $image >> image-build-logs/push-failed-images.txt
254256
else
255257
echo "Failed on retry $i"
256258
sleep 5
257259
fi;
258260
done
259-
done < image-scan-output/push-attempt-images.txt &&
260-
mv image-scan-output image-build-logs/image-scan-output
261+
done < image-build-logs/push-attempt-images.txt
261262
shell: bash
262263
env:
263264
KAYOBE_VAULT_PASSWORD: ${{ secrets.KAYOBE_VAULT_PASSWORD }}
@@ -283,18 +284,15 @@ jobs:
283284
run: if [ $(wc -l < image-build-logs/dirty-images.txt) -gt 0 ]; then cat image-build-logs/dirty-images.txt && exit 1; fi
284285
if: ${{ !inputs.push-dirty && !cancelled() }}
285286

286-
sync-container-repositories:
287-
name: Trigger container image repository sync
288-
needs:
289-
- container-image-build
290-
if: github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push
291-
runs-on: ubuntu-latest
292-
permissions: {}
293-
steps:
294287
# NOTE(mgoddard): Trigger another CI workflow in the
295288
# stackhpc-release-train repository.
296289
- name: Trigger container image repository sync
297290
run: |
291+
sudo mkdir -p -m 755 /etc/apt/keyrings && wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null
292+
sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg
293+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
294+
sudo apt update
295+
sudo apt install gh -y
298296
filter='${{ inputs.regexes }}'
299297
if [[ -n $filter ]] && [[ ${{ inputs.seed }} == 'true' ]]; then
300298
filter="$filter bifrost"
@@ -307,7 +305,9 @@ jobs:
307305
-f sync-new-images=false
308306
env:
309307
GITHUB_TOKEN: ${{ secrets.STACKHPC_RELEASE_TRAIN_TOKEN }}
308+
if: ${{ github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push && !cancelled() }}
310309

311310
- name: Display link to container image repository sync workflows
312311
run: |
313312
echo "::notice Container image repository sync workflows: https://github.com/stackhpc/stackhpc-release-train/actions/workflows/container-sync.yml"
313+
if: ${{ github.repository == 'stackhpc/stackhpc-kayobe-config' && inputs.push && !cancelled() }}

0 commit comments

Comments
 (0)