File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Update demo bases
2+ on :
3+ schedule :
4+ - cron : ' 0 0 1 * *' # once a month
5+ workflow_dispatch :
6+
7+ permissions :
8+ contents : read
9+ pull-requests : write
10+
11+ jobs :
12+ demo_base_update :
13+ name : Create a PR for demo image updates
14+ runs-on : ubuntu-22.04
15+ steps :
16+ - uses : actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
17+ - name : Install frizbee
18+ run : |
19+ mkdir bin && wget -q https://github.com/stacklok/frizbee/releases/download/v0.0.15/frizbee_0.0.15_linux_amd64.tar.gz -O - | tar xz -C bin
20+ chmod +x bin/frizbee
21+ - name : Run update script
22+ run : |
23+ export PATH=$PATH:$(pwd)/bin
24+
25+ git config user.name "Tuomas Katila"
26+ git config user.email "tuomas.katila@intel.com"
27+
28+ export DATE=$(date +'%m-%Y')
29+ export TITLE="Demo base update $DATE"
30+ export BRANCH="demo-base-update-$DATE"
31+
32+ export MAINHEAD=$(git rev-parse --short HEAD)
33+ git checkout -b $BRANCH
34+
35+ cd demo
36+ bash update-shas.sh
37+ git diff --exit-code || git add -u && git commit -s -m "demo: base image update $DATE" && git diff main...$BRANCH && gh pr create --fill --base=main --head=$BRANCH
38+ env :
39+ GITHUB_TOKEN : ${{ secrets.GH_PR_TOKEN }}
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ type frizbee > /dev/null 2>&1 || {
4+ echo " no 'frizbee' installed, please install it from https://github.com/stacklok/frizbee"
5+ exit 1
6+ }
7+
8+ echo " frizbee available, continue"
9+
10+ files=$( grep -sr " ^FROM" * | cut -d" :" -f1 | sort | uniq)
11+
12+ for file in $files ; do
13+ echo " checking $file "
14+
15+ base=$( grep " ^FROM" $file | head -1 | cut -d' ' -f2)
16+ baseimg=$( echo $base | cut -d' @' -f1)
17+ prevhash=$( echo $base | cut -d' @' -f2 | cut -d' ' -f1)
18+
19+ hash=$( frizbee containerimage one $baseimg | cut -d' @' -f2)
20+ [ $? -ne 0 ] && exit 1
21+
22+ [ " x$verbose " != " x" ] && echo $prevhash ? = $hash
23+
24+ if [ $prevhash != $hash ]; then
25+ echo " > updating hash in $file : $hash "
26+
27+ sed -i s/$prevhash /$hash / $file
28+ fi
29+ done
You can’t perform that action at this time.
0 commit comments