Skip to content

Commit a504449

Browse files
claudeXeoneid
authored andcommitted
feat: add target_version input, replace extra_pairs field
- Replace second form field (extra_pairs) with target_version - target_version sets version B ("to"); empty = highest available tag - Pair every tag in [floor_version, target_version) with target_version
1 parent eaec680 commit a504449

1 file changed

Lines changed: 33 additions & 22 deletions

File tree

‎.github/workflows/upgrade-integration-test.yml‎

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# Tests that Dokploy can upgrade from version A to version B while keeping
44
# user projects (Postgres, MongoDB, two web apps, one static site) alive.
55
#
6-
# Generates consecutive upgrade pairs: each stable tag >= floor_version → next tag.
6+
# Generates upgrade pairs: each stable tag in [floor_version, target_version)
7+
# is paired with target_version. If target_version is empty, the highest tag
8+
# available on Docker Hub is used as the target.
79
#
810
# Only triggered manually to avoid burning Actions minutes.
911

@@ -16,6 +18,10 @@ on:
1618
description: 'Oldest version tag to include in pairs (e.g. v0.29.4)'
1719
required: false
1820
default: 'v0.29.4'
21+
target_version:
22+
description: 'Target version to upgrade to (version B). Leave empty to use the highest available.'
23+
required: false
24+
default: ''
1925

2026
env:
2127
DOKPLOY_IMAGE: dokploy/dokploy
@@ -36,10 +42,16 @@ jobs:
3642
- name: Generate pairs
3743
id: pairs
3844
env:
39-
FLOOR: ${{ inputs.floor_version }}
45+
FLOOR: ${{ inputs.floor_version }}
46+
TARGET: ${{ inputs.target_version }}
4047
run: |
4148
set -euo pipefail
4249
50+
# semver "a >= b" comparison helper (vX.Y.Z, strips leading v)
51+
ge() {
52+
[ "$(printf '%s\n%s\n' "${1#v}" "${2#v}" | sort -V | tail -n1)" = "${1#v}" ]
53+
}
54+
4355
# Fetch all semver tags from Docker Hub (dokploy/dokploy)
4456
ALL_TAGS=$(curl -fsSL \
4557
"https://hub.docker.com/v2/repositories/dokploy/dokploy/tags?page_size=100" | \
@@ -50,36 +62,35 @@ jobs:
5062
echo "All tags found:"
5163
echo "$ALL_TAGS"
5264
65+
# Target version (version B): explicit input, else highest available.
66+
if [ -n "$TARGET" ]; then
67+
TO="$TARGET"
68+
echo "Using user-supplied target version: $TO"
69+
else
70+
TO=$(echo "$ALL_TAGS" | tail -n1)
71+
echo "No target supplied; using highest available: $TO"
72+
fi
73+
5374
# Floor semver components
5475
FLOOR_CLEAN="${FLOOR#v}"
5576
IFS='.' read -r F_MAJ F_MIN F_PAT <<< "$FLOOR_CLEAN"
5677
57-
# Filter tags >= FLOOR
58-
FILTERED=$(echo "$ALL_TAGS" | while read -r TAG; do
78+
# Each tag in [FLOOR, TO) → TO
79+
PAIRS='[]'
80+
while read -r TAG; do
81+
[ -z "$TAG" ] && continue
82+
# skip tags above-or-equal to the target (incl. the target itself)
83+
ge "$TAG" "$TO" && continue
5984
TAG_CLEAN="${TAG#v}"
6085
IFS='.' read -r T_MAJ T_MIN T_PAT <<< "$TAG_CLEAN"
6186
if [ "$T_MAJ" -gt "$F_MAJ" ] || \
6287
{ [ "$T_MAJ" -eq "$F_MAJ" ] && [ "$T_MIN" -gt "$F_MIN" ]; } || \
6388
{ [ "$T_MAJ" -eq "$F_MAJ" ] && [ "$T_MIN" -eq "$F_MIN" ] && [ "$T_PAT" -ge "$F_PAT" ]; }; then
64-
echo "$TAG"
89+
PAIRS=$(echo "$PAIRS" | jq -c \
90+
--arg f "$TAG" --arg t "$TO" \
91+
'. + [{"from":$f,"to":$t}]')
6592
fi
66-
done)
67-
68-
echo "Tags >= $FLOOR:"
69-
echo "$FILTERED"
70-
71-
# Build consecutive pairs: tag[i] → tag[i+1]
72-
TAGS_ARR=()
73-
while IFS= read -r t; do TAGS_ARR+=("$t"); done <<< "$FILTERED"
74-
75-
PAIRS='[]'
76-
for (( i=0; i<${#TAGS_ARR[@]}-1; i++ )); do
77-
FROM="${TAGS_ARR[$i]}"
78-
TO="${TAGS_ARR[$i+1]}"
79-
PAIRS=$(echo "$PAIRS" | jq -c \
80-
--arg f "$FROM" --arg t "$TO" \
81-
'. + [{"from":$f,"to":$t}]')
82-
done
93+
done <<< "$ALL_TAGS"
8394
8495
COUNT=$(echo "$PAIRS" | jq 'length')
8596
echo "Total pairs: $COUNT"

0 commit comments

Comments
 (0)