Skip to content

Commit

Permalink
Fix docker push script
Browse files Browse the repository at this point in the history
  • Loading branch information
antas-marcin committed May 29, 2023
1 parent 7709cde commit 1cc402c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions cicd/docker_push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,18 @@ set -eou pipefail
# - any commit is pushed as :<model>-latest
# - any commit is pushed as :<model>
git_hash=
pr=
remote_repo=${REMOTE_REPO?Variable REMOTE_REPO is required}
model_name=${MODEL_NAME?Variable MODEL_NAME is required}
original_model_name=$model_name
docker_username=${DOCKER_USERNAME?Variable DOCKER_USERNAME is required}
docker_password=${DOCKER_PASSWORD?Variable DOCKER_PASSWORD is required}
git_tag=${GITHUB_REF##*/}
original_model_name=$model_name
git_tag=$GITHUB_REF_NAME

function main() {
init
echo "git ref type is $GITHUB_REF_TYPE"
echo "git ref name is $GITHUB_REF_NAME"
echo "git branch is $GIT_BRANCH"
echo "git tag is $git_tag"
echo "pr is $pr"
push_tag
}

Expand All @@ -35,18 +32,14 @@ function init() {
fi

git_hash="$(git rev-parse HEAD | head -c 7)"
pr=false
if [ ! -z "$GIT_PULL_REQUEST" ]; then
pr="$GIT_PULL_REQUEST"
fi

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --use
echo "$docker_password" | docker login -u "$docker_username" --password-stdin
}

function push_tag() {
if [ ! -z "$git_tag" ]; then
if [ ! -z "$git_tag" ] && [ "$GITHUB_REF_TYPE" == "tag" ]; then
tag_git="$remote_repo:$model_name-$git_tag"
tag_latest="$remote_repo:$model_name-latest"
tag="$remote_repo:$model_name"
Expand Down
2 changes: 1 addition & 1 deletion cicd/docker_push_custom_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ git_hash=
remote_repo=${REMOTE_REPO?Variable REMOTE_REPO is required}
docker_username=${DOCKER_USERNAME?Variable DOCKER_USERNAME is required}
docker_password=${DOCKER_PASSWORD?Variable DOCKER_PASSWORD is required}
git_tag=${GITHUB_REF##*/}
git_tag=$GITHUB_REF_NAME

function main() {
init
Expand Down

0 comments on commit 1cc402c

Please sign in to comment.