-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from binbashar/BBL-119-tf0.12-test-auto-release
BBL-119 - tf0.12 tests + auto release
- Loading branch information
Showing
14 changed files
with
443 additions
and
55 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 |
---|---|---|
@@ -0,0 +1,154 @@ | ||
version: 2.1 | ||
|
||
jobs: | ||
# | ||
# Test 1 & Test 2 | ||
# | ||
test-static-code-and-linting: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
# This job has been blocked because Docker Layer Caching is not available on your plan. | ||
# Please upgrade to continue building. | ||
# Note: you will need to push a new commit or call the API to rerun the pipeline. | ||
#docker_layer_caching: true | ||
|
||
steps: | ||
- checkout | ||
|
||
- run: pwd | ||
- run: ls -ltra | ||
- run: git branch | ||
|
||
- run: | ||
name: test1-terraform-format | ||
command: | | ||
if [[ $(make format| tail -n +2) ]]; then | ||
echo "===================================================================================================" | ||
echo " NOT PASSED - There are Terraform conf files that needs a canonical format and styleto be formated " | ||
echo "===================================================================================================" | ||
exit 1 | ||
else | ||
echo "===================================================================================================" | ||
echo " PASSED - All Terraform conf files already have canonical format and are correcyly styled " | ||
echo "===================================================================================================" | ||
fi | ||
- run: | ||
name: test2-terraform-linting | ||
command: | | ||
if make lint-deep | grep 'Awesome! Your code is following the best practices'; then | ||
echo "===============================================================================================" | ||
echo " PASSED - Awesome! Your code is following the best practices " | ||
echo "===============================================================================================" | ||
else | ||
echo "===============================================================================================" | ||
echo " NOT PASSED - Terraform lint needed " | ||
echo "===============================================================================================" | ||
fi | ||
# | ||
# Test 3 | ||
# | ||
test-e2e-terratests: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
#docker_layer_caching: true | ||
|
||
steps: | ||
- checkout | ||
|
||
- run: pwd | ||
- run: ls -ltra | ||
- run: git branch | ||
|
||
- run: | ||
name: Install awscli | ||
command: sudo pip install awscli | ||
|
||
- run: | ||
name: Configure awscli | ||
command: | | ||
echo "AWS_ACCESS_KEY_ID - $AWS_ACCESS_KEY_ID" | ||
echo "AWS_PROFILE_NAME - $AWS_PROFILE_NAME" | ||
# AWS defautl awscli profile | ||
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID | ||
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY | ||
aws configure set region us-east-1 | ||
aws configure set output json | ||
# AWS dev awscli profile | ||
aws configure set role_arn arn:aws:iam::$AWS_ACCOUNT_ID_DEV:role/DeployMaster --profile $AWS_PROFILE_NAME | ||
aws configure set source_profile default --profile $AWS_PROFILE_NAME | ||
# - run: cat ~/.aws/credentials | ||
# - run: cat ~/.aws/config | ||
|
||
- run: | ||
name: Test AWS permissions | ||
command: aws ec2 describe-instances --region us-east-1 --profile $AWS_PROFILE_NAME | ||
|
||
- run: | ||
name: test3-terratests-dep-init | ||
command: make terratest-dep-init | ||
|
||
- run: | ||
name: test3-terratests-go-test | ||
command: make terratest-go-test | ||
|
||
# | ||
# Release | ||
# | ||
release-patch-with-changelog: | ||
machine: | ||
image: ubuntu-1604:201903-01 | ||
#docker_layer_caching: true | ||
|
||
steps: | ||
- checkout | ||
|
||
- run: pwd | ||
- run: ls -ltra | ||
- run: git branch | ||
|
||
- run: | ||
name: release-patch-with-changelog-circleci | ||
command: | | ||
if git status | grep 'nothing to commit, working tree clean'; then | ||
echo "===============================================================================================" | ||
echo "release-patch-with-changelog-circleci" | ||
echo "===============================================================================================" | ||
git config --global user.email "$GIT_USER_EMAIL" | ||
git config --global user.name "$GIT_USER_NAME" | ||
make release-patch-with-changelog-circleci | ||
else | ||
echo "===============================================================================================" | ||
echo "Changes in working directory pending to be pushed - please check 'git status' cmd output below " | ||
echo "===============================================================================================" | ||
echo "$(git status)" | ||
echo "===============================================================================================" | ||
fi | ||
# | ||
# Jobs workflow | ||
# | ||
workflows: | ||
version: 2 | ||
changelog_and_release: | ||
jobs: | ||
- test-static-code-and-linting: | ||
context: binbashar-org-global-context | ||
filters: | ||
branches: | ||
ignore: # only branches matching the below regex filters will run | ||
- master | ||
- test-e2e-terratests: | ||
context: binbashar-org-global-context | ||
filters: | ||
branches: | ||
ignore: # only branches matching the below regex filters will run | ||
- master | ||
- release-patch-with-changelog: | ||
context: binbashar-org-global-context | ||
filters: | ||
branches: | ||
only: # only branches matching the below regex filters will run | ||
- master |
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
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
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
Oops, something went wrong.