Skip to content

Commit

Permalink
Add a docker tag for git commit (mozilla-releng#283). r=bhearsum
Browse files Browse the repository at this point in the history
  • Loading branch information
relud authored and bhearsum committed Mar 24, 2017
1 parent 4b28b3a commit 72f6e0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions agent/scripts/push-dockerimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,20 @@ if [ "$branch" == "master" ]; then
branch_tag="latest"
fi
date_tag="${branch}-${date}"
commit_tag="${branch}-${commit}"

echo "Building Docker image"
docker build -t mozilla/balrogagent:${branch_tag} .
echo "Tagging Docker image with date tag"
docker tag mozilla/balrogagent:${branch_tag} "mozilla/balrogagent:${date_tag}"
echo "Tagging Docker image with git commit tag"
docker tag mozilla/balrogagent:${branch_tag} "mozilla/balrogagent:${commit_tag}"
echo "Logging into Dockerhub"
docker login -e $dockerhub_email -u $dockerhub_username -p $dockerhub_password
echo "Pushing Docker image"
docker push mozilla/balrogagent:${branch_tag}
docker push mozilla/balrogagent:${date_tag}
docker push mozilla/balrogagent:${commit_tag}

sha256=$(docker images --no-trunc mozilla/balrogagent | grep "${date_tag}" | awk '/^mozilla/ {print $3}')
echo "SHA256 is ${sha256}, creating artifact for it"
Expand Down
4 changes: 4 additions & 0 deletions scripts/push-dockerimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,20 @@ if [ "$branch" == "master" ]; then
branch_tag="latest"
fi
date_tag="${branch}-${date}"
commit_tag="${branch}-${commit}"

echo "Building Docker image"
docker build -t mozilla/balrog:${branch_tag} .
echo "Tagging Docker image with date tag"
docker tag mozilla/balrog:${branch_tag} "mozilla/balrog:${date_tag}"
echo "Tagging Docker image with git commit tag"
docker tag mozilla/balrog:${branch_tag} "mozilla/balrog:${commit_tag}"
echo "Logging into Dockerhub"
docker login -e $dockerhub_email -u $dockerhub_username -p $dockerhub_password
echo "Pushing Docker image"
docker push mozilla/balrog:${branch_tag}
docker push mozilla/balrog:${date_tag}
docker push mozilla/balrog:${commit_tag}

sha256=$(docker images --no-trunc mozilla/balrog | grep "${date_tag}" | awk '/^mozilla/ {print $3}')
echo "SHA256 is ${sha256}, creating artifact for it"
Expand Down

0 comments on commit 72f6e0c

Please sign in to comment.