6161 echo "Istio already on latest version: ${CURRENT}"
6262 fi
6363
64+ - name : Get current RootlessKit version
65+ id : current-rootlesskit
66+ run : |
67+ CURRENT_VERSION=$(grep 'ROOTLESSKIT_VERSION=' linux/base.Dockerfile | grep -o 'v[0-9.]*')
68+ if [ -z "${CURRENT_VERSION}" ]; then
69+ echo "Error: Unable to determine current RootlessKit version from linux/base.Dockerfile" >&2
70+ exit 1
71+ fi
72+ echo "version=${CURRENT_VERSION}" >> $GITHUB_OUTPUT
73+ echo "Current RootlessKit version: ${CURRENT_VERSION}"
74+
75+ - name : Get latest RootlessKit version
76+ id : latest-rootlesskit
77+ run : |
78+ set -e
79+ LATEST_VERSION=$(curl -fsSL https://api.github.com/repos/rootless-containers/rootlesskit/releases/latest | jq -er '.tag_name') || {
80+ echo "Error: Failed to fetch latest RootlessKit release information from GitHub API." >&2
81+ exit 1
82+ }
83+
84+ if [ -z "${LATEST_VERSION}" ] || [ "${LATEST_VERSION}" = "null" ]; then
85+ echo "Error: Received empty or invalid latest RootlessKit version from GitHub API." >&2
86+ exit 1
87+ fi
88+
89+ echo "version=${LATEST_VERSION}" >> $GITHUB_OUTPUT
90+ echo "Latest RootlessKit version: ${LATEST_VERSION}"
91+
92+ - name : Compare RootlessKit versions
93+ id : compare-rootlesskit
94+ run : |
95+ CURRENT="${{ steps.current-rootlesskit.outputs.version }}"
96+ LATEST="${{ steps.latest-rootlesskit.outputs.version }}"
97+
98+ if [ "${CURRENT}" != "${LATEST}" ]; then
99+ echo "needs_update=true" >> $GITHUB_OUTPUT
100+ echo "RootlessKit update needed: ${CURRENT} -> ${LATEST}"
101+ else
102+ echo "needs_update=false" >> $GITHUB_OUTPUT
103+ echo "RootlessKit already on latest version: ${CURRENT}"
104+ fi
105+
64106 - name : Update Istio in Dockerfile
65107 if : steps.compare-istio.outputs.needs_update == 'true'
66108 run : |
@@ -81,8 +123,26 @@ jobs:
81123 fi
82124 echo "Updated ISTIO_VERSION to ${LATEST}"
83125
126+ - name : Update RootlessKit in Dockerfile
127+ if : steps.compare-rootlesskit.outputs.needs_update == 'true'
128+ run : |
129+ LATEST="${{ steps.latest-rootlesskit.outputs.version }}"
130+
131+ if ! grep -q 'ROOTLESSKIT_VERSION=' linux/base.Dockerfile; then
132+ echo "Error: Could not find 'ROOTLESSKIT_VERSION=' line in linux/base.Dockerfile"
133+ exit 1
134+ fi
135+
136+ sed -i "s/ROOTLESSKIT_VERSION=v[0-9.]*/ROOTLESSKIT_VERSION=${LATEST}/" linux/base.Dockerfile
137+
138+ if ! grep -q "ROOTLESSKIT_VERSION=${LATEST}" linux/base.Dockerfile; then
139+ echo "Error: Failed to update ROOTLESSKIT_VERSION to ${LATEST} in linux/base.Dockerfile"
140+ exit 1
141+ fi
142+ echo "Updated ROOTLESSKIT_VERSION to ${LATEST}"
143+
84144 - name : Create and push branch with updates
85- if : steps.compare-istio.outputs.needs_update == 'true'
145+ if : steps.compare-istio.outputs.needs_update == 'true' || steps.compare-rootlesskit.outputs.needs_update == 'true'
86146 run : |
87147 BRANCH_NAME="update-pinned-libs-$(date +%Y%m%d)"
88148 git config user.name "github-actions[bot]"
@@ -95,28 +155,41 @@ jobs:
95155 id : push-branch
96156
97157 - name : Create Pull Request
98- if : steps.compare-istio.outputs.needs_update == 'true'
158+ if : steps.compare-istio.outputs.needs_update == 'true' || steps.compare-rootlesskit.outputs.needs_update == 'true'
99159 env :
100160 GH_TOKEN : ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
101161 run : |
102- CURRENT_VERSION="${{ steps.current-istio.outputs.version }}"
103- LATEST_VERSION="${{ steps.latest-istio.outputs.version }}"
162+ CURRENT_ISTIO="${{ steps.current-istio.outputs.version }}"
163+ LATEST_ISTIO="${{ steps.latest-istio.outputs.version }}"
164+ CURRENT_ROOTLESSKIT="${{ steps.current-rootlesskit.outputs.version }}"
165+ LATEST_ROOTLESSKIT="${{ steps.latest-rootlesskit.outputs.version }}"
104166 BRANCH_NAME="${{ steps.push-branch.outputs.branch }}"
105167
168+ UPDATES=""
169+ RELEASE_NOTES=""
170+
171+ if [ "${{ steps.compare-istio.outputs.needs_update }}" == "true" ]; then
172+ UPDATES="${UPDATES}- **Istio**: ${CURRENT_ISTIO} to ${LATEST_ISTIO}\n"
173+ RELEASE_NOTES="${RELEASE_NOTES}- Istio ${LATEST_ISTIO}: https://github.com/istio/istio/releases/tag/${LATEST_ISTIO}\n"
174+ fi
175+
176+ if [ "${{ steps.compare-rootlesskit.outputs.needs_update }}" == "true" ]; then
177+ UPDATES="${UPDATES}- **RootlessKit**: ${CURRENT_ROOTLESSKIT} to ${LATEST_ROOTLESSKIT}\n"
178+ RELEASE_NOTES="${RELEASE_NOTES}- RootlessKit ${LATEST_ROOTLESSKIT}: https://github.com/rootless-containers/rootlesskit/releases/tag/${LATEST_ROOTLESSKIT}\n"
179+ fi
180+
106181 gh pr create \
107182 --title "chore: update pinned library versions" \
108183 --body "## Automated Library Version Updates
109184
110185 This PR updates the following pinned library versions:
111186
112- - **Istio**: ${CURRENT_VERSION} to ${LATEST_VERSION}
113-
187+ ${UPDATES}
114188 ### Changes
115189 - Updated version variables in linux/base.Dockerfile
116190
117191 ### Release Notes
118- - Istio ${LATEST_VERSION}: https://github.com/istio/istio/releases/tag/${LATEST_VERSION}
119-
192+ ${RELEASE_NOTES}
120193 ---
121194 This PR was automatically created by the Update Pinned Library Versions workflow." \
122195 --base master \
0 commit comments