Skip to content

Commit e22e9ef

Browse files
authored
Merge pull request #936 from Altinity/docker-release-fixes
Docker release fixes
2 parents 4e6c6ad + 1a8770b commit e22e9ef

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

.github/workflows/docker_publish.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,40 @@ jobs:
7878
NEW_TAG=$(echo "$VERSION_OUTPUT" | sed -E 's/.*version ([0-9.]+[^ ]*).*/\1/')
7979
echo "Cleaned version: $NEW_TAG"
8080
81-
# Append "-prerelease" if necessary
81+
# Extract version from input image tag and validate
82+
INPUT_VERSION=$(echo "$IMAGE" | sed -E 's|.*:.*-([0-9.]+[^ ]*).*|\1|')
83+
84+
# Validate that versions match
85+
if [ "$NEW_TAG" != "$INPUT_VERSION" ]; then
86+
echo "ERROR: Version mismatch!"
87+
echo " Version from container: $NEW_TAG"
88+
echo " Version from input tag: $INPUT_VERSION"
89+
echo " Input image: $IMAGE"
90+
exit 1
91+
fi
92+
93+
# Append "-prerelease" if necessary and determine repository
8294
if [ "${{ github.event.inputs.release_environment || inputs.release_environment }}" = "staging" ]; then
8395
NEW_TAG="${NEW_TAG}-prerelease"
96+
REPO_NAME="altinityinfra"
97+
else
98+
REPO_NAME="altinity"
8499
fi
100+
echo "Repository: $REPO_NAME"
85101
86102
if [[ "$IMAGE" == *-alpine* ]]; then
87103
NEW_TAG="${NEW_TAG}-alpine"
88104
fi
89105
echo "New tag: $NEW_TAG"
90106
91-
# Export the new tag
107+
# Export the new tag and repository
92108
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
109+
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
93110
94111
- name: Process multiarch manifest
95112
run: |
96-
echo "Re-tag multiarch image $IMAGE to altinity/$COMPONENT:$NEW_TAG"
97-
docker buildx imagetools create --tag "altinity/$COMPONENT:$NEW_TAG" "$IMAGE"
113+
echo "Re-tag multiarch image $IMAGE to $REPO_NAME/$COMPONENT:$NEW_TAG"
114+
docker buildx imagetools create --tag "$REPO_NAME/$COMPONENT:$NEW_TAG" "$IMAGE"
98115
99116
# Create directory for image archives
100117
mkdir -p image_archives
@@ -103,15 +120,15 @@ jobs:
103120
for PLATFORM in "linux/amd64" "linux/arm64"; do
104121
echo "Pulling and saving image for $PLATFORM..."
105122
# Pull the specific platform image
106-
docker pull --platform $PLATFORM "altinity/$COMPONENT:$NEW_TAG"
123+
docker pull --platform $PLATFORM "$REPO_NAME/$COMPONENT:$NEW_TAG"
107124
108125
# Save the image to a tar file
109126
ARCH=$(echo $PLATFORM | cut -d'/' -f2)
110-
docker save "altinity/$COMPONENT:$NEW_TAG" -o "image_archives/${COMPONENT}-${NEW_TAG}-${ARCH}.tar"
127+
docker save "$REPO_NAME/$COMPONENT:$NEW_TAG" -o "image_archives/${COMPONENT}-${NEW_TAG}-${ARCH}.tar"
111128
done
112129
113130
# Save manifest inspection
114-
docker buildx imagetools inspect "altinity/$COMPONENT:$NEW_TAG" > image_archives/manifest.txt
131+
docker buildx imagetools inspect "$REPO_NAME/$COMPONENT:$NEW_TAG" > image_archives/manifest.txt
115132
116133
# Compress the archives
117134
cd image_archives

0 commit comments

Comments
 (0)