This is an automated email from the ASF dual-hosted git repository.
sciabarracom pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/openserverless-devcontainer.git
The following commit(s) were added to refs/heads/main by this push:
new 8c0c88f retag
8c0c88f is described below
commit 8c0c88f69215ac49db5da359d0f5e77b7ca4a698
Author: Michele Sciabarra <[email protected]>
AuthorDate: Wed Sep 2 21:05:07 2026 +0200
retag
---
.github/workflows/list-images.yml | 93 --------------------
.github/workflows/retag-images.yml | 173 +++++++++++++++++++++++++++++++++++++
2 files changed, 173 insertions(+), 93 deletions(-)
diff --git a/.github/workflows/list-images.yml
b/.github/workflows/list-images.yml
deleted file mode 100644
index e95246c..0000000
--- a/.github/workflows/list-images.yml
+++ /dev/null
@@ -1,93 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-name: List Images
-on:
- workflow_dispatch:
-
-jobs:
- list:
- name: List apache/openserverless-* images and tags
- runs-on: ubuntu-22.04
- env:
- IMAGES: >-
- openserverless-admin-api
- openserverless-devcontainer
- openserverless-operator
- openserverless-runtime-common
- openserverless-runtime-go
- openserverless-runtime-java
- openserverless-runtime-nodejs
- openserverless-runtime-php
- openserverless-runtime-python
- openserverless-streamer
- openserverless-wsk-controller
- openserverless-wsk-invoker
- openserverless-wsk-scala
- openserverless-wsk-scheduler
- openserverless-wsk-standalone
- steps:
- - name: List images and tags
- env:
- DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
- DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
- run: |
- set -euo pipefail
-
- # Get a Docker Hub JWT (works with both password and PAT)
- TOKEN=$(curl -s -H 'Content-Type: application/json' \
- -d "$(jq -n --arg u "$DOCKERHUB_USER" --arg p "$DOCKERHUB_TOKEN" \
- '{username:$u,password:$p}')" \
- https://hub.docker.com/v2/users/login/ | jq -r '.token // empty')
-
- if [ -z "$TOKEN" ]; then
- echo "Docker Hub login failed" >&2
- exit 1
- fi
-
- AUTH=(-H "Authorization: JWT $TOKEN")
-
- {
- echo "## apache/openserverless-* images"
- echo
- } >> "$GITHUB_STEP_SUMMARY"
-
- for REPO in $IMAGES; do
- echo "=== apache/$REPO ==="
- echo "### apache/$REPO" >> "$GITHUB_STEP_SUMMARY"
-
- TAGS=""
-
TURL="https://hub.docker.com/v2/repositories/apache/$REPO/tags/?page_size=100"
- while [ -n "$TURL" ] && [ "$TURL" != "null" ]; do
- TPAGE=$(curl -s "${AUTH[@]}" "$TURL")
- TAGS="$TAGS$(echo "$TPAGE" | jq -r '.results[]? |
"\(.name)\t\(.last_updated)"')
- "
- TURL=$(echo "$TPAGE" | jq -r '.next')
- done
-
- TAGS=$(echo "$TAGS" | sed '/^\s*$/d')
- if [ -z "$TAGS" ]; then
- echo " (no tags)"
- echo "- _(no tags)_" >> "$GITHUB_STEP_SUMMARY"
- else
- echo "$TAGS" | while IFS=$'\t' read -r NAME UPDATED; do
- echo " $NAME (updated $UPDATED)"
- echo "- \`$NAME\` — updated $UPDATED" >> "$GITHUB_STEP_SUMMARY"
- done
- fi
- echo >> "$GITHUB_STEP_SUMMARY"
- done
diff --git a/.github/workflows/retag-images.yml
b/.github/workflows/retag-images.yml
new file mode 100644
index 0000000..6e37a49
--- /dev/null
+++ b/.github/workflows/retag-images.yml
@@ -0,0 +1,173 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+name: Retag Images
+on:
+ workflow_dispatch:
+ inputs:
+ limit:
+ description: 'How many tags to actually retag (0 = only list)'
+ type: string
+ default: '0'
+
+jobs:
+ retag:
+ name: Retag apache/openserverless-* tags with -SNAPSHOT
+ runs-on: ubuntu-22.04
+ env:
+ IMAGES: >-
+ openserverless-admin-api
+ openserverless-devcontainer
+ openserverless-operator
+ openserverless-runtime-common
+ openserverless-runtime-go
+ openserverless-runtime-java
+ openserverless-runtime-nodejs
+ openserverless-runtime-php
+ openserverless-runtime-python
+ openserverless-streamer
+ openserverless-wsk-controller
+ openserverless-wsk-invoker
+ openserverless-wsk-scala
+ openserverless-wsk-scheduler
+ openserverless-wsk-standalone
+ steps:
+ - name: Registry login
+ uses: docker/login-action@v3
+ with:
+ username: ${{ secrets.DOCKERHUB_USER }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: List and retag
+ env:
+ DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+ LIMIT: ${{ inputs.limit }}
+ run: |
+ set -euo pipefail
+
+ # Get a Docker Hub JWT (works with both password and PAT)
+ TOKEN=$(curl -s -H 'Content-Type: application/json' \
+ -d "$(jq -n --arg u "$DOCKERHUB_USER" --arg p "$DOCKERHUB_TOKEN" \
+ '{username:$u,password:$p}')" \
+ https://hub.docker.com/v2/users/login/ | jq -r '.token // empty')
+
+ if [ -z "$TOKEN" ]; then
+ echo "Docker Hub login failed" >&2
+ exit 1
+ fi
+
+ AUTH=(-H "Authorization: JWT $TOKEN")
+
+ TODO=/tmp/todo.txt # tags still needing a -SNAPSHOT
+ DONE=/tmp/done.txt # tags whose -SNAPSHOT already exists
+ : > "$TODO"
+ : > "$DONE"
+
+ # ---------- 1. inventory ----------
+ for REPO in $IMAGES; do
+ TAGS=""
+
TURL="https://hub.docker.com/v2/repositories/apache/$REPO/tags/?page_size=100"
+ while [ -n "$TURL" ] && [ "$TURL" != "null" ]; do
+ TPAGE=$(curl -s "${AUTH[@]}" "$TURL")
+ TAGS="$TAGS$(echo "$TPAGE" | jq -r '.results[]?.name')
+ "
+ TURL=$(echo "$TPAGE" | jq -r '.next')
+ done
+ TAGS=$(echo "$TAGS" | sed '/^\s*$/d' | sort -u)
+
+ # the set of existing snapshot tags, for the "already retagged"
check
+ SNAPS=$(echo "$TAGS" | grep -- '-SNAPSHOT$' || true)
+
+ for TAG in $TAGS; do
+ # skip snapshots themselves, to avoid snapshots of snapshots
+ case "$TAG" in *-SNAPSHOT) continue ;; esac
+
+ if echo "$SNAPS" | grep -qx -- "$TAG-SNAPSHOT"; then
+ echo "$REPO $TAG" >> "$DONE"
+ else
+ echo "$REPO $TAG" >> "$TODO"
+ fi
+ done
+ done
+
+ N_TODO=$(wc -l < "$TODO" | tr -d ' ')
+ N_DONE=$(wc -l < "$DONE" | tr -d ' ')
+
+ {
+ echo "## Retag report (limit=$LIMIT)"
+ echo
+ echo "- to retag: **$N_TODO**"
+ echo "- already retagged: **$N_DONE**"
+ echo
+ echo "### Already retagged"
+ if [ "$N_DONE" -eq 0 ]; then
+ echo "_none_"
+ else
+ awk '{print "- `apache/" $1 ":" $2 "` -> `" $2 "-SNAPSHOT`"}'
"$DONE"
+ fi
+ echo
+ echo "### To retag"
+ if [ "$N_TODO" -eq 0 ]; then
+ echo "_none_"
+ else
+ awk '{print "- `apache/" $1 ":" $2 "`"}' "$TODO"
+ fi
+ echo
+ } >> "$GITHUB_STEP_SUMMARY"
+
+ echo "to retag: $N_TODO"
+ awk '{print " TODO apache/" $1 ":" $2}' "$TODO"
+ echo "already retagged: $N_DONE"
+ awk '{print " DONE apache/" $1 ":" $2}' "$DONE"
+
+ # ---------- 2. retag up to LIMIT ----------
+ if [ "$LIMIT" -le 0 ]; then
+ echo "limit is 0, listing only"
+ echo "_limit is 0: nothing retagged._" >> "$GITHUB_STEP_SUMMARY"
+ exit 0
+ fi
+
+ echo "### Retagged in this run" >> "$GITHUB_STEP_SUMMARY"
+
+ FAILED=0
+ COUNT=0
+ while read -r REPO TAG; do
+ [ "$COUNT" -ge "$LIMIT" ] && break
+ COUNT=$((COUNT + 1))
+
+ SRC="apache/$REPO:$TAG"
+ DST="apache/$REPO:$TAG-SNAPSHOT"
+ echo "retag $SRC -> $DST"
+ if docker buildx imagetools create --tag "$DST" "$SRC"; then
+ echo "- retagged \`$SRC\` -> \`$TAG-SNAPSHOT\`" >>
"$GITHUB_STEP_SUMMARY"
+ else
+ FAILED=1
+ echo "FAILED $SRC" >&2
+ echo "- :x: failed \`$SRC\`" >> "$GITHUB_STEP_SUMMARY"
+ fi
+ done < "$TODO"
+
+ echo
+ echo "retagged $COUNT of $N_TODO, $((N_TODO - COUNT)) left"
+ echo >> "$GITHUB_STEP_SUMMARY"
+ echo "Retagged $COUNT of $N_TODO — $((N_TODO - COUNT)) left." >>
"$GITHUB_STEP_SUMMARY"
+
+ exit $FAILED