@@ -29,6 +29,7 @@ usage: $0 [CMD] [OPTIONS]
2929 Default = \$ (nproc)
3030 -tag Use as the image tag. Default is git commit sha
3131 -ci Install CI tools in image
32+ -dry-run Do not push images to the repository
3233 -h -help Show this message and exits
3334 -username Docker Username
3435 -password Docker Password
@@ -102,7 +103,11 @@ _push() {
102103 _help
103104 fi
104105
105- ${DOCKER_CMD} login --username " ${username} " --password " ${password} "
106+ if [[ " ${dryRun} " == 1 ]]; then
107+ echo " Skipping docker login"
108+ else
109+ ${DOCKER_CMD} login --username " ${username} " --password " ${password} "
110+ fi
106111
107112 if [[ " ${tag} " == " " ]]; then
108113 tag=$( ./etc/DockerTag.sh -dev)
@@ -114,7 +119,9 @@ _push() {
114119 ./etc/DockerHelper.sh create -os=${os} -target=dev -tag=${tag} -ci \
115120 2>&1 | tee build/create-${os} -dev-${tag} .log
116121
117- ${DOCKER_CMD} push " ${org} /flow-${os} -dev:${tag} "
122+ if [[ " ${dryRun} " != 1 ]]; then
123+ ${DOCKER_CMD} push " ${org} /flow-${os} -dev:${tag} "
124+ fi
118125 fi
119126
120127 if [[ " ${target} " == " master" ]]; then
@@ -123,8 +130,15 @@ _push() {
123130 ./etc/DockerHelper.sh create -os=${os} -target=builder \
124131 2>&1 | tee build/create-${os} -${target} -${tag} .log
125132
126- ${DOCKER_CMD} tag ${org} /flow-${os} -builder:${imageTag} ${org} /orfs:${tag}
127- ${DOCKER_CMD} push ${org} /orfs:${tag}
133+ builderTag=${org} /flow-${os} -builder:${imageTag}
134+ orfsTag=${org} /orfs:${tag}
135+ echo " Renaming docker image: ${builderTag} -> ${orfsTag} "
136+ ${DOCKER_CMD} tag ${builderTag} ${orfsTag}
137+ if [[ " ${dryRun} " == 1 ]]; then
138+ echo " [DRY-RUN] ${DOCKER_CMD} push ${orfsTag} "
139+ else
140+ ${DOCKER_CMD} push ${orfsTag}
141+ fi
128142 fi
129143}
130144
@@ -157,6 +171,7 @@ target="dev"
157171numThreads=" -1"
158172tag=" "
159173options=" "
174+ dryRun=0
160175
161176while [ " $# " -gt 0 ]; do
162177 case " ${1} " in
@@ -166,6 +181,9 @@ while [ "$#" -gt 0 ]; do
166181 -ci )
167182 options=" -ci"
168183 ;;
184+ -dry-run )
185+ dryRun=1
186+ ;;
169187 -os=* )
170188 os=" ${1#* =} "
171189 ;;
0 commit comments