-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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,10 @@ | ||
name: update-images | ||
description: "Update all findable images for all zarf packages in repo" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Run script | ||
run: | | ||
./.github/actions/update-images/update-images.sh | ||
shell: bash |
This file contains 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,46 @@ | ||
#!/bin/bash | ||
|
||
# set -x | ||
|
||
update() { | ||
IMG_YAML="$(zarf dev find-images --no-progress | grep -v '#')" | ||
COMPONENT_UPDATES="$(echo "$IMG_YAML" | yq '.components[].name')" | ||
FLAVOR="$1" | ||
FLAVOR_CHECK="" | ||
|
||
if ! [ -z "$FLAVOR" ]; then | ||
FLAVOR_CHECK="| select(.only.flavor == \"$FLAVOR\")" | ||
fi | ||
|
||
for component in $COMPONENT_UPDATES; do | ||
NEW_IMAGES=$(echo "$IMG_YAML" | yq ".components[] | select(.name == \"$component\") | .images | .. style=\"double\" | . style=\"flow\"") | ||
echo $NEW_IMAGES | ||
cat zarf.yaml | yq "(.components[] | select(.name == \"$component\") ${FLAVOR_CHECK} | .images) |= $NEW_IMAGES" > zarf.yaml.tmp | ||
mv zarf.yaml.tmp zarf.yaml | ||
done | ||
} | ||
|
||
parse_flavors() { | ||
FLAVORS="$(yq '.components[].only.flavor' zarf.yaml | grep -v null)" | ||
if [ -z "$FLAVORS" ]; then | ||
echo "No flavors found in zarf.yaml" | ||
update | ||
else | ||
echo "Flavors found in zarf.yaml: $FLAVORS" | ||
for flavor in $FLAVORS; do | ||
export ZARF_CONFIG="zarf-config-ci.yaml" | ||
yq --null-input ".package.create.flavor = \"$flavor\"" > $ZARF_CONFIG | ||
update $flavor | ||
done | ||
rm -f $ZARF_CONFIG | ||
export ZARF_CONFIG="" | ||
fi | ||
} | ||
|
||
ZARF_PKGS="$(find . -type f -name "zarf.yaml" -exec dirname {} \;)" | ||
|
||
for pkgDir in $ZARF_PKGS; do | ||
pushd $pkgDir | ||
parse_flavors | ||
popd | ||
done |
This file contains 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,36 @@ | ||
name: Update Images | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- renovate/* | ||
|
||
# Abort prior jobs in the same workflow / PR | ||
concurrency: | ||
group: test-${{ github.ref }}-${{ inputs.package }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
test: | ||
runs-on: "ubuntu-latest" | ||
timeout-minutes: 10 | ||
name: Update Images | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Update Images | ||
uses: ./.github/actions/update-images | ||
|
||
- name: Commit and push changes | ||
run: | | ||
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | ||
git config --global user.name "${{ github.actor }}" | ||
git add . | ||
git commit -m "chore: update images" | ||
git push |
This file contains 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