Skip to content

Commit

Permalink
default docker tag to git ref
Browse files Browse the repository at this point in the history
if DOCKER_TAG is not set, set a tag corresponding to the git ref
e.g. if the branch is `wip/foo_bar`, the tag will be `wip-foo_bar`

if the DOCKER_TAG is set, it will still take precedence.

This new behavior ensures that builds from different branches
will not collide, and is a prerequisite for enabling automatic builds.
  • Loading branch information
msherman64 committed May 1, 2024
1 parent 6770fa8 commit 250b8d9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion kolla-build.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ maintainer = University of Chicago
registry = ghcr.io
namespace = chameleoncloud/kolla
openstack_release = xena
tag = xena

# tag is set in run.sh, not here
# tag = xena

type = source
base = ubuntu
base_tag = "20.04"
Expand Down
13 changes: 12 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,18 @@ fi

# Set these _after_ sourcing a possible .env file, so it can be defaulted there.
KOLLA_BRANCH="${KOLLA_BRANCH:-chameleoncloud/xena}"
DOCKER_TAG="${DOCKER_TAG:-xena}"

# by default, tag containers with the git sha for kolla-containers repo
GIT_REF="$(git rev-parse --abbrev-ref HEAD)"

# replace '/' with '-' since container tags cannot contain '/'
GIT_REF_DASH=${GIT_REF//'/'/"-"}
if [[ -n $(git status --porcelain) ]]; then
GIT_REF_DASH="${GIT_REF_DASH}-dirty"
fi

# if DOCKER_TAG env var is set, use that, otherwise use git ref as tag
export DOCKER_TAG="${DOCKER_TAG:-$GIT_REF_DASH}"

# Automatically update dependencies
if [[ "${CHECK_UPDATES}" == "yes" || "${FORCE_UPDATES}" == "yes" ]]; then
Expand Down

0 comments on commit 250b8d9

Please sign in to comment.