Skip to content

Commit

Permalink
Merge pull request #296 from dikhan/fix-cicd-docker-ratelimit-issues
Browse files Browse the repository at this point in the history
[BugFix: Issue #297] Fix docker rate limit issues in Travis pipeline
  • Loading branch information
dikhan committed May 28, 2021
2 parents 1657b56 + 5b7162b commit d5699cb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ services:
- docker

env:
- TF_VERSION=0.13.6
- TF_VERSION=0.13.6 PERFORM_DOCKER_LOGIN=true GO111MODULE=on

install:
# - go get github.com/buchanae/github-release-notes
- export BINDIR=/home/travis/bin && curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh
- wget https://releases.hashicorp.com/terraform/"$TF_VERSION"/terraform_"$TF_VERSION"_linux_amd64.zip
- unzip terraform_"$TF_VERSION"_linux_amd64.zip
Expand All @@ -24,13 +23,13 @@ jobs:
include:
- stage: test
script:
- env GO111MODULE=on make test-all
- make test-all
- stage: deploy
script:
# Set up git user name and tag this commit
- git config --local user.name $GIT_USER
- git config --local user.email $GIT_USER_EMAIL
- env GO111MODULE=on make release-version
- make release-version
stages:
- name: test
if: type = pull_request OR (type = push AND branch = master)
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ test: fmt vet lint gosec unittest
show-terraform-version:
terraform version

# dockerhub-login logs into Docker if the environment variable PERFORM_DOCKER_LOGIN is set. This is used by Travis CI
# to avoid Docker toomanyrequests: You have reached your pull rate limit.
dockerhub-login:
ifdef PERFORM_DOCKER_LOGIN
echo $(DOCKER_PASSWORD) | docker login -u $(DOCKER_USERNAME) --password-stdin
endif

# make integration-test
integration-test: local-env-down local-env show-terraform-version
integration-test: local-env-down local-env show-terraform-version dockerhub-login
@echo "[INFO] Executing integration tests for $(TF_OPENAPI_PROVIDER_PLUGIN_NAME)"
@TF_ACC=true go test -v -cover $(INT_TEST_PACKAGES) ; if [ $$? -eq 1 ]; then \
echo "[ERROR] Test returned with failures. Please go through the different scenarios and fix the tests that are failing"; \
Expand Down

0 comments on commit d5699cb

Please sign in to comment.