Skip to content

Commit

Permalink
Use simple dev version for locally built image
Browse files Browse the repository at this point in the history
The scripts trying to deduce a version can cause confusing failures due
to undeterministic behavior.

Instead, to build and release an image use a simple $DEV_VERSION
constant which is set to an arbitrary & simple value.

Signed-off-by: Mike Kolesnik <[email protected]>
  • Loading branch information
mkolesnik authored and mangelajo committed Jun 22, 2020
1 parent b58d01d commit ff79b1d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
6 changes: 1 addition & 5 deletions scripts/shared/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

source ${SCRIPTS_DIR}/lib/version

ARCH=${ARCH:-"amd64"}
SUFFIX=""
[ "${ARCH}" != "amd64" ] && SUFFIX="_${ARCH}"

## Process command line flags ##

source ${SCRIPTS_DIR}/lib/shflags
DEFINE_string 'tag' "${VERSION}${SUFFIX}" "Tag to set for the local image"
DEFINE_string 'tag' "${DEV_VERSION}" "Tag to set for the local image"
DEFINE_string 'repo' 'quay.io/submariner' "Quay.io repo to use for the image"
DEFINE_string 'image' '' "Image name to build" 'i'
DEFINE_string 'dockerfile' '' "Dockerfile to build from" 'f'
Expand Down
2 changes: 1 addition & 1 deletion scripts/shared/lib/deploy_funcs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

function import_image() {
local orig_image=$1
local versioned_image="$1:$VERSION"
local versioned_image="$1:${DEV_VERSION}"
local local_image="localhost:5000/${orig_image##*/}:local"
if ! docker tag "${versioned_image}" "${local_image}"; then
# The project doesn't build this image, pull it
Expand Down
3 changes: 2 additions & 1 deletion scripts/shared/lib/version
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
fi

git_tag=$(git tag -l --contains HEAD | head -n 1)
readonly DEV_VERSION="dev"

# shellcheck disable=SC2034 # VERSION is used in other scripts which source this one
if [[ -z "$dirty" && -n "$git_tag" ]]; then
readonly VERSION=$git_tag
else
readonly VERSION="dev"
readonly VERSION="$DEV_VERSION"
fi
2 changes: 1 addition & 1 deletion scripts/shared/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function release_image() {
local images=("${image}:${commit_hash:0:7}" "${image}:${release_tag#v}")

for target_image in "${images[@]}"; do
docker tag ${image}:${VERSION} ${target_image}
docker tag ${image}:${DEV_VERSION} ${target_image}
docker push ${target_image}
done
}
Expand Down

0 comments on commit ff79b1d

Please sign in to comment.