26
26
STABLE_ARM_TARBALL_NAME : rondb-22.10.3-linux-glibc2.28-arm64_v8.tar.gz
27
27
28
28
jobs :
29
+ check-git :
30
+ runs-on : ubuntu-latest
31
+ outputs :
32
+ is_highest_release : ${{ steps.is_highest_release.outputs.is_highest }}
33
+ steps :
34
+ - uses : actions/checkout@v4
35
+ with :
36
+ fetch-depth : 0
37
+
38
+ - name : Check if current branch is the highest release branch
39
+ if : github.repository == 'logicalclocks/rondb-docker'
40
+ id : is_highest_release
41
+ run : |
42
+ ALL_RELEASES=$(git branch -r | grep 'origin/release-' | sed 's|origin/||')
43
+ HIGHEST_RELEASE=$(echo "$ALL_RELEASES" | sort -V | tail -n 1)
44
+ echo "Highest release branch is $HIGHEST_RELEASE"
45
+
46
+ if [ "${GITHUB_REF_NAME}" = "$HIGHEST_RELEASE" ]; then
47
+ echo "Current branch is the highest release branch."
48
+ echo "is_highest=true" >> $GITHUB_ENV
49
+ else
50
+ echo "is_highest=false" >> $GITHUB_ENV
51
+ fi
52
+
29
53
integration-test-and-package :
30
54
runs-on : ubuntu-latest
55
+ needs : [check-git]
31
56
steps :
32
57
- uses : actions/checkout@v4
33
58
@@ -103,34 +128,33 @@ jobs:
103
128
--build-arg RONDB_TARBALL_LOCAL_REMOTE=remote \
104
129
--build-arg RONDB_X86_TARBALL_URI=$BASE_DEPLOY_URL/$STABLE_X86_TARBALL_NAME
105
130
106
- # In the main branch, we work with "<version>-SNAPSHOT", which might as well be called "latest"
107
- - name : Push X86 *latest* images to Dockerhub
108
- if : github.repository == 'logicalclocks/rondb-docker' && github.ref_name == 'main'
131
+ - name : Push X86 images to Dockerhub
132
+ if : github.repository == 'logicalclocks/rondb-docker' && (startsWith(github.ref_name, 'release-') || github.ref_name == 'main')
109
133
run : |
110
134
VERSION="$(< "./VERSION" sed -e 's/^[[:space:]]*//')"
111
135
docker tag rondb-standalone:$RONDB_VERSION_LTS-$VERSION hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-$VERSION
112
136
docker tag rondb-standalone:$RONDB_VERSION_STABLE-$VERSION hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_STABLE-$VERSION
137
+ docker push hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-$VERSION
138
+ docker push hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_STABLE-$VERSION
139
+
140
+ # Our "latest" branch points to the latest *release* branch.
141
+ - name : Push X86 *latest* images to Dockerhub
142
+ if : github.repository == 'logicalclocks/rondb-docker' && needs.check-git.outputs.is_highest_release == 'true'
143
+ run : |
144
+ VERSION="$(< "./VERSION" sed -e 's/^[[:space:]]*//')"
113
145
docker tag rondb-standalone:$RONDB_VERSION_LTS-$VERSION hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-latest
114
146
docker tag rondb-standalone:$RONDB_VERSION_STABLE-$VERSION hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_STABLE-latest
115
147
docker tag rondb-standalone:$RONDB_VERSION_STABLE-$VERSION hopsworks/$X86_IMAGE_NAME:latest
116
- docker push hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-$VERSION
117
- docker push hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_STABLE-$VERSION
118
148
docker push hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-latest
119
149
docker push hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_STABLE-latest
120
150
docker push hopsworks/$X86_IMAGE_NAME:latest
121
151
122
- - name : Push X86 *release* images to Dockerhub
123
- if : github.repository == 'logicalclocks/rondb-docker' && startsWith(github.ref_name, 'release-')
124
- run : |
125
- VERSION="$(< "./VERSION" sed -e 's/^[[:space:]]*//')"
126
- docker tag rondb-standalone:$RONDB_VERSION_LTS-$VERSION hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-$VERSION
127
- docker tag rondb-standalone:$RONDB_VERSION_STABLE-$VERSION hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_STABLE-$VERSION
128
- docker push hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-$VERSION
129
- docker push hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_STABLE-$VERSION
130
-
131
152
build-and-push-ARM64 :
132
153
runs-on : ubuntu-latest
133
154
if : github.repository == 'logicalclocks/rondb-docker' && (startsWith(github.ref_name, 'release-') || github.ref_name == 'main')
155
+ needs : [check-git]
156
+ env :
157
+ is_highest_release : ${{ needs.check-git.outputs.is_highest_release == 'true' }}
134
158
steps :
135
159
- uses : actions/checkout@v4
136
160
@@ -153,7 +177,7 @@ jobs:
153
177
run : |
154
178
VERSION="$(< "./VERSION" sed -e 's/^[[:space:]]*//')"
155
179
TAGS="hopsworks/$ARM_IMAGE_NAME:$RONDB_VERSION_LTS-$VERSION"
156
- if [[ "${{ github.ref_name == 'main' }} " == "true" ]]; then
180
+ if [[ "$is_highest_release " == "true" ]]; then
157
181
TAGS+=" --tag hopsworks/$ARM_IMAGE_NAME:$RONDB_VERSION_LTS-latest"
158
182
fi
159
183
docker buildx build . \
@@ -170,7 +194,7 @@ jobs:
170
194
run : |
171
195
VERSION="$(< "./VERSION" sed -e 's/^[[:space:]]*//')"
172
196
TAGS="--tag hopsworks/$ARM_IMAGE_NAME:$RONDB_VERSION_STABLE-$VERSION"
173
- if [[ "${{ github.ref_name == 'main' }} " == "true" ]]; then
197
+ if [[ "$is_highest_release " == "true" ]]; then
174
198
TAGS+=" --tag hopsworks/$ARM_IMAGE_NAME:$RONDB_VERSION_STABLE-latest"
175
199
TAGS+=" --tag hopsworks/$ARM_IMAGE_NAME:latest"
176
200
fi
@@ -187,7 +211,9 @@ jobs:
187
211
build-and-push-cross-platform-image :
188
212
runs-on : ubuntu-latest
189
213
if : github.repository == 'logicalclocks/rondb-docker' && (startsWith(github.ref_name, 'release-') || github.ref_name == 'main')
190
- needs : [integration-test-and-package, build-and-push-ARM64]
214
+ needs : [check-git, integration-test-and-package, build-and-push-ARM64]
215
+ env :
216
+ is_highest_release : ${{ needs.check-git.outputs.is_highest_release == 'true' }}
191
217
steps :
192
218
- uses : actions/checkout@v4
193
219
@@ -204,17 +230,14 @@ jobs:
204
230
run : |
205
231
VERSION="$(< "./VERSION" sed -e 's/^[[:space:]]*//')"
206
232
207
- # Using $VERSION will create weird `-SNAPSHOT` tags, when in main, but we need
208
- # those Dockerhub images in order to run the main branch.
209
-
210
233
docker buildx imagetools create -t hopsworks/rondb-standalone:$RONDB_VERSION_LTS-$VERSION \
211
234
hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-$VERSION \
212
235
hopsworks/$ARM_IMAGE_NAME:$RONDB_VERSION_LTS-$VERSION
213
236
docker buildx imagetools create -t hopsworks/rondb-standalone:$RONDB_VERSION_STABLE-$VERSION \
214
237
hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_STABLE-$VERSION \
215
238
hopsworks/$ARM_IMAGE_NAME:$RONDB_VERSION_STABLE-$VERSION
216
239
217
- if [[ "${{ github.ref_name == 'main' }} " == "true" ]]; then
240
+ if [[ "$is_highest_release " == "true" ]]; then
218
241
docker buildx imagetools create -t hopsworks/rondb-standalone:$RONDB_VERSION_LTS-latest \
219
242
hopsworks/$X86_IMAGE_NAME:$RONDB_VERSION_LTS-latest \
220
243
hopsworks/$ARM_IMAGE_NAME:$RONDB_VERSION_LTS-latest
0 commit comments