forked from yuriabrito/Will.IAM
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
107 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,25 @@ | ||
language: go | ||
go: | ||
- '1.13' | ||
services: | ||
- docker | ||
cache: | ||
directories: | ||
- "$GOPATH/pkg" | ||
before_install: | ||
- go get github.com/mattn/goveralls | ||
install: | ||
- make ci/install | ||
script: | ||
- make ci/test | ||
after_success: | ||
- goveralls -coverprofile=coverage.out -service=travis-ci | ||
|
||
go: '1.13' | ||
|
||
jobs: | ||
include: | ||
- stage: test | ||
cache: | ||
directories: | ||
- "$GOPATH/pkg" | ||
services: | ||
- docker | ||
before_install: | ||
- go get github.com/mattn/goveralls | ||
install: | ||
- make ci/install | ||
after_success: | ||
- goveralls -coverprofile=coverage.out -service=travis-ci | ||
script: | ||
- make ci/test | ||
- stage: deploy | ||
if: branch = master AND type = push | ||
services: docker | ||
script: | ||
- push_to_docker.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
# The image build step occurs only when a build is triggered by a commit being merged into the "master" branch. | ||
# Given that the "master" branch is protected, the only way to trigger a build from the "master" branch is when a PR | ||
# is merged into it. This way, we avoid storing images from non-stable branches. | ||
DOCKER_HUB_REPO='tfgco/will-iam' | ||
|
||
docker_tag_exists() { | ||
local repo="$1" | ||
local tag="$2" | ||
curl --silent -flSL "https://index.docker.io/v1/repositories/$repo/tags/$tag" > /dev/null | ||
} | ||
|
||
main() { | ||
local last_commit_sha | ||
local version | ||
last_commit_sha=$(git rev-parse --short HEAD) | ||
version=$(cat version.txt) | ||
|
||
if docker_tag_exists "$DOCKER_HUB_REPO" "$version"; then | ||
echo "An image with the version $version already exists in Docker Hub. Please update your version.txt file and try again." | ||
exit 1 | ||
fi | ||
|
||
docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" | ||
docker build -t will-iam . | ||
docker tag will-iam "$DOCKER_HUB_REPO:$last_commit_sha" | ||
docker tag will-iam "$DOCKER_HUB_REPO:$version" | ||
docker push "$DOCKER_HUB_REPO:$last_commit_sha" | ||
docker push "$DOCKER_HUB_REPO:$version" | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8.6.0 |