update circleci config
This commit is contained in:
@@ -1,67 +1,70 @@
|
|||||||
|
version: 2.1
|
||||||
|
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
machine: true
|
machine: true
|
||||||
|
|
||||||
|
env: &env
|
||||||
environment:
|
environment:
|
||||||
GRUNTWORK_INSTALLER_VERSION: v0.0.25
|
GRUNTWORK_INSTALLER_VERSION: v0.0.30
|
||||||
TERRATEST_LOG_PARSER_VERSION: v0.13.24
|
TERRATEST_LOG_PARSER_VERSION: v0.30.4
|
||||||
MODULE_CI_VERSION: v0.18.4
|
MODULE_CI_VERSION: v0.29.1
|
||||||
TERRAFORM_VERSION: 0.12.23
|
TERRAFORM_VERSION: 0.13.5
|
||||||
TERRAGRUNT_VERSION: NONE
|
TERRAGRUNT_VERSION: NONE
|
||||||
PACKER_VERSION: NONE
|
PACKER_VERSION: NONE
|
||||||
GOLANG_VERSION: 1.13.8
|
GOLANG_VERSION: 1.13.8
|
||||||
|
|
||||||
install_gruntwork_utils: &install_gruntwork_utils
|
|
||||||
name: install gruntwork utils
|
|
||||||
command: |
|
|
||||||
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version "${GRUNTWORK_INSTALLER_VERSION}"
|
|
||||||
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "${MODULE_CI_VERSION}"
|
|
||||||
gruntwork-install --binary-name "terratest_log_parser" --repo "https://github.com/gruntwork-io/terratest" --tag "${TERRATEST_LOG_PARSER_VERSION}"
|
|
||||||
configure-environment-for-gruntwork-module \
|
|
||||||
--terraform-version ${TERRAFORM_VERSION} \
|
|
||||||
--terragrunt-version ${TERRAGRUNT_VERSION} \
|
|
||||||
--packer-version ${PACKER_VERSION} \
|
|
||||||
--go-version ${GOLANG_VERSION}
|
|
||||||
version: 2
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
precommit:
|
||||||
<<: *defaults
|
<<: *env
|
||||||
|
docker:
|
||||||
|
- image: circleci/python:3.8.1
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
# Install gruntwork utilities
|
|
||||||
- run:
|
|
||||||
<<: *install_gruntwork_utils
|
|
||||||
|
|
||||||
|
- run:
|
||||||
|
name: install dependencies
|
||||||
|
command: |
|
||||||
|
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version "${GRUNTWORK_INSTALLER_VERSION}"
|
||||||
|
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "${MODULE_CI_VERSION}"
|
||||||
|
configure-environment-for-gruntwork-module \
|
||||||
|
--terraform-version ${TERRAFORM_VERSION} \
|
||||||
|
--terragrunt-version NONE \
|
||||||
|
--packer-version NONE \
|
||||||
|
--go-version ${GOLANG_VERSION}
|
||||||
# Fail the build if the pre-commit hooks don't pass. Note: if you run pre-commit install locally, these hooks will
|
# Fail the build if the pre-commit hooks don't pass. Note: if you run pre-commit install locally, these hooks will
|
||||||
# execute automatically every time before you commit, ensuring the build never fails at this step!
|
# execute automatically every time before you commit, ensuring the build never fails at this step!
|
||||||
- run: pip install pre-commit==1.11.2 cfgv==2.0.1 yapf
|
- run:
|
||||||
- run: pre-commit install
|
command: |
|
||||||
- run: pre-commit run --all-files
|
pip install pre-commit==1.21.0 cfgv==2.0.1 zipp==1.1.0 yapf
|
||||||
|
pre-commit install
|
||||||
- persist_to_workspace:
|
pre-commit run --all-files
|
||||||
root: /home/circleci
|
|
||||||
paths:
|
|
||||||
- project
|
|
||||||
- terraform
|
|
||||||
- packer
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
<<: *env
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
|
||||||
at: /home/circleci
|
|
||||||
- checkout
|
- checkout
|
||||||
- run: echo 'export PATH=$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
|
- run: &install_gruntwork_tooling
|
||||||
- run:
|
name: install gruntwork tooling
|
||||||
<<: *install_gruntwork_utils
|
command: |
|
||||||
|
sudo apt-get -y update
|
||||||
|
curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version "${GRUNTWORK_INSTALLER_VERSION}"
|
||||||
|
gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "${MODULE_CI_VERSION}"
|
||||||
|
gruntwork-install --module-name "git-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "${MODULE_CI_VERSION}"
|
||||||
|
gruntwork-install --binary-name "terratest_log_parser" --repo "https://github.com/gruntwork-io/terratest" --tag "${TERRATEST_LOG_PARSER_VERSION}"
|
||||||
|
configure-environment-for-gruntwork-module --go-src-path ./test --terraform-version ${TERRAFORM_VERSION} --terragrunt-version ${TERRAGRUNT_VERSION} --packer-version ${PACKER_VERSION} --go-version ${GOLANG_VERSION}
|
||||||
|
|
||||||
|
# Install external dependencies
|
||||||
- run:
|
- run:
|
||||||
name: update gcloud
|
name: update gcloud
|
||||||
command: |
|
command: |
|
||||||
sudo apt-get remove -y google-cloud-sdk
|
sudo apt-get remove -y google-cloud-sdk
|
||||||
sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
|
sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update
|
||||||
sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update beta
|
sudo /opt/google-cloud-sdk/bin/gcloud --quiet components update beta
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: run tests
|
name: run tests
|
||||||
command: |
|
command: |
|
||||||
mkdir -p /tmp/logs
|
|
||||||
# required for gcloud to authenticate correctly
|
# required for gcloud to authenticate correctly
|
||||||
echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
|
echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
|
||||||
gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
|
gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
|
||||||
@@ -70,11 +73,15 @@ jobs:
|
|||||||
echo $GCLOUD_SERVICE_KEY > /tmp/gcloud.json
|
echo $GCLOUD_SERVICE_KEY > /tmp/gcloud.json
|
||||||
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcloud.json"
|
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcloud.json"
|
||||||
# run the tests
|
# run the tests
|
||||||
run-go-tests --path test --timeout 60m | tee /tmp/logs/all.log
|
mkdir -p /tmp/logs
|
||||||
no_output_timeout: 3600s
|
run-go-tests --path test --timeout 2h | tee /tmp/logs/all.log
|
||||||
|
no_output_timeout: 1h
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
|
name: parse test output
|
||||||
command: terratest_log_parser --testlog /tmp/logs/all.log --outputdir /tmp/logs
|
command: terratest_log_parser --testlog /tmp/logs/all.log --outputdir /tmp/logs
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: /tmp/logs
|
path: /tmp/logs
|
||||||
- store_test_results:
|
- store_test_results:
|
||||||
@@ -82,9 +89,19 @@ jobs:
|
|||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build-and-test:
|
test:
|
||||||
jobs:
|
jobs:
|
||||||
- build
|
# We have to explicitly tell CircleCI to run on all tags and branches, or tag commits/pushes will not trigger
|
||||||
|
# builds: https://circleci.com/docs/2.0/workflows/#git-tag-job-execution.
|
||||||
|
- precommit:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only: /.*/
|
||||||
|
tags:
|
||||||
|
only: /.*/
|
||||||
- test:
|
- test:
|
||||||
requires:
|
requires:
|
||||||
- build
|
- precommit
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only: /^v.*/
|
||||||
|
|||||||
Reference in New Issue
Block a user