Skip to content

Commit a9e35b8

Browse files
committed
added -push-latest parameter
Signed-off-by: Sombrio <[email protected]>
1 parent b81552e commit a9e35b8

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

etc/DockerHelper.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ usage: $0 [CMD] [OPTIONS]
3333
-password=PASSWORD Password to loging at the docker registry.
3434
-ci Install CI tools in image
3535
-dry-run Do not push images to the repository
36+
-push-latest Push the latest image to the repository
3637
-no-constant-build-dir Do not use constant build directory
3738
-h -help Show this message and exits
3839
@@ -123,11 +124,6 @@ _push() {
123124

124125
if [[ "${dryRun}" != 1 ]]; then
125126
${DOCKER_CMD} push "${org}/flow-${os}-dev:${tag}"
126-
${DOCKER_CMD} tag "${org}/flow-${os}-dev:${tag}" "${org}/flow-${os}-dev:latest"
127-
${DOCKER_CMD} push "${org}/flow-${os}-dev:latest"
128-
else
129-
echo "[DRY-RUN] ${DOCKER_CMD} tag \"${org}/flow-${os}-dev:${tag}\" \"${org}/flow-${os}-dev:latest\""
130-
echo "[DRY-RUN] ${DOCKER_CMD} push \"${org}/flow-${os}-dev:latest\""
131127
fi
132128
fi
133129

@@ -141,14 +137,22 @@ _push() {
141137
orfsTag=${org}/orfs:${tag}
142138
echo "Renaming docker image: ${builderTag} -> ${orfsTag}"
143139
${DOCKER_CMD} tag ${builderTag} ${orfsTag}
140+
144141
if [[ "${dryRun}" == 1 ]]; then
145142
echo "[DRY-RUN] ${DOCKER_CMD} push ${orfsTag}"
146-
echo "[DRY-RUN] ${DOCKER_CMD} tag ${orfsTag} \"${org}/orfs:latest\""
147-
echo "[DRY-RUN] ${DOCKER_CMD} push \"${org}/orfs:latest\""
143+
if [[ "${pushLatest}" == 1 ]]; then
144+
echo "[DRY-RUN] ${DOCKER_CMD} tag ${orfsTag} \"${org}/orfs:latest\""
145+
echo "[DRY-RUN] ${DOCKER_CMD} push \"${org}/orfs:latest\""
146+
fi
148147
else
149148
${DOCKER_CMD} push ${orfsTag}
150-
${DOCKER_CMD} tag ${orfsTag} "${org}/orfs:latest"
151-
${DOCKER_CMD} push "${org}/orfs:latest"
149+
150+
# Only tag and push as latest if requested
151+
if [[ "${pushLatest}" == 1 ]]; then
152+
${DOCKER_CMD} tag ${orfsTag} "${org}/orfs:latest"
153+
${DOCKER_CMD} push "${org}/orfs:latest"
154+
echo "Tagged and pushed ${org}/orfs:latest"
155+
fi
152156
fi
153157
fi
154158
}
@@ -183,6 +187,7 @@ numThreads="-1"
183187
tag=""
184188
options=""
185189
dryRun=0
190+
pushLatest=0
186191

187192
while [ "$#" -gt 0 ]; do
188193
case "${1}" in
@@ -195,6 +200,9 @@ while [ "$#" -gt 0 ]; do
195200
-dry-run )
196201
dryRun=1
197202
;;
203+
-push-latest )
204+
pushLatest=1
205+
;;
198206
-os=* )
199207
os="${1#*=}"
200208
;;

0 commit comments

Comments
 (0)