From 6f696daa59c7fe7a8c56ade05904bde0ea377279 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Tue, 17 Sep 2024 11:07:39 +0200 Subject: [PATCH] Also build pilot images in build_and_deploy workflow --- .github/workflows/build_and_deploy.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 4e5f99d..1df761e 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -66,12 +66,13 @@ jobs: # First add together the directories found in the changed-images-yaml and changed-templates-yaml steps into a single array ALL_DIRS="${{ steps.changed-images-yaml.outputs.images_all_changed_files }} ${{ steps.get-symlink-dirs.outputs.changed_dirs }}" # Now construct a unique array out of ALL_DIRS - MATRIX=($(echo "$ALL_DIRS" | xargs -n 1 | sort -u)) + IMGS=($(echo "$ALL_DIRS" | xargs -n 1 | sort -u)) # Next create a valid json array out of the bash array using jq - MATRIX=$(printf '%s\n' "${MATRIX[@]}" | jq -R . | jq -c -s .) + IMGS=$(printf '%s\n' "${MATRIX[@]}" | jq -R . | jq -c -s .) # Store the results - echo images=$MATRIX >> $GITHUB_OUTPUT - echo matrix={\"images\": $MATRIX} >> $GITHUB_OUTPUT + echo images=$IMGS >> $GITHUB_OUTPUT + # Create a matrix variable containing the images array and update_base_component array + echo matrix={\"update_base_components\": [true, false], \"images\": $IMGS} >> $GITHUB_OUTPUT outputs: images: ${{ steps.set-images-matrix.outputs.images }} images_matrix: ${{ steps.set-images-matrix.outputs.matrix }} @@ -104,10 +105,10 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build image id: build-image - run: IMG=${{ matrix.images }} ./pack.sh docker + run: IMG=${{ matrix.images }} UPDATE_BASE_COMPONENTS=${{ matrix.update_base_components }} ./pack.sh docker - name: Get image name and tag # grep in the image directory's variables file to find the image name/tag to push to id: get-image-name run: | echo "docker_repo=`grep docker_repo ${{ matrix.images }}/variables.auto.pkrvars.hcl | awk '{print $3}'`" >> "$GITHUB_OUTPUT" - name: Push image - run: docker push ${{ steps.get-image-name.outputs.docker_repo }} + run: docker push ${{ steps.get-image-name.outputs.docker_repo }}${{ matrix.update_base_components && '-pilot' || '' }}