check that git tag == chart tag on tagged releases (#316)
This commit is contained in:
parent
d1ad4ff403
commit
7f7fb7bad0
1 changed files with 44 additions and 26 deletions
|
@ -1,39 +1,53 @@
|
||||||
version: 2
|
version: 2.1
|
||||||
|
orbs:
|
||||||
|
slack: circleci/slack@3.4.2
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bats-unit-test:
|
bats-unit-test:
|
||||||
docker:
|
docker:
|
||||||
# This image is built from test/docker/Test.dockerfile
|
# This image is built from test/docker/Test.dockerfile
|
||||||
- image: hashicorpdev/vault-helm-test:0.1.0
|
- image: hashicorpdev/vault-helm-test:0.1.0
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run: bats ./test/unit -t
|
- run: bats ./test/unit -t
|
||||||
acceptance:
|
acceptance:
|
||||||
docker:
|
docker:
|
||||||
# This image is build from test/docker/Test.dockerfile
|
# This image is build from test/docker/Test.dockerfile
|
||||||
- image: hashicorpdev/vault-helm-test:0.1.0
|
- image: hashicorpdev/vault-helm-test:0.1.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- run:
|
- run:
|
||||||
name: terraform init & apply
|
name: terraform init & apply
|
||||||
command: |
|
command: |
|
||||||
echo -e "${GOOGLE_APP_CREDS}" | base64 -d > vault-helm-test.json
|
echo -e "${GOOGLE_APP_CREDS}" | base64 -d > vault-helm-test.json
|
||||||
export GOOGLE_CREDENTIALS=vault-helm-test.json
|
export GOOGLE_CREDENTIALS=vault-helm-test.json
|
||||||
make provision-cluster
|
make provision-cluster
|
||||||
- run:
|
- run:
|
||||||
name: Run acceptance tests
|
name: Run acceptance tests
|
||||||
command: bats ./test/acceptance -t
|
command: bats ./test/acceptance -t
|
||||||
|
|
||||||
- run:
|
- run:
|
||||||
name: terraform destroy
|
name: terraform destroy
|
||||||
command: |
|
command: |
|
||||||
export GOOGLE_CREDENTIALS=vault-helm-test.json
|
export GOOGLE_CREDENTIALS=vault-helm-test.json
|
||||||
make destroy-cluster
|
make destroy-cluster
|
||||||
when: always
|
when: always
|
||||||
update-helm-charts-index:
|
update-helm-charts-index:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:latest
|
- image: circleci/golang:latest
|
||||||
steps:
|
steps:
|
||||||
|
- checkout
|
||||||
|
- run:
|
||||||
|
name: verify Chart version matches tag version
|
||||||
|
command: |
|
||||||
|
GO111MODULE=on go get github.com/mikefarah/yq/v2
|
||||||
|
git_tag=$(echo "${CIRCLE_TAG#v}")
|
||||||
|
chart_tag=$(yq r Chart.yaml version)
|
||||||
|
if [ "${git_tag}" != "${chart_tag}" ]; then
|
||||||
|
echo "chart version (${chart_tag}) did not match git version (${git_tag})"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
- run:
|
- run:
|
||||||
name: update helm-charts index
|
name: update helm-charts index
|
||||||
command: |
|
command: |
|
||||||
|
@ -43,17 +57,21 @@ jobs:
|
||||||
-H 'Accept: application/json' \
|
-H 'Accept: application/json' \
|
||||||
-d "{\"branch\": \"master\",\"parameters\":{\"SOURCE_REPO\": \"${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}\",\"SOURCE_TAG\": \"${CIRCLE_TAG}\"}}" \
|
-d "{\"branch\": \"master\",\"parameters\":{\"SOURCE_REPO\": \"${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}\",\"SOURCE_TAG\": \"${CIRCLE_TAG}\"}}" \
|
||||||
"${CIRCLE_ENDPOINT}/${CIRCLE_PROJECT}/pipeline"
|
"${CIRCLE_ENDPOINT}/${CIRCLE_PROJECT}/pipeline"
|
||||||
|
- slack/status:
|
||||||
|
fail_only: true
|
||||||
|
failure_message: "Failed to trigger an update to the helm charts index. Check the logs at: ${CIRCLE_BUILD_URL}"
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
build_and_test:
|
build_and_test:
|
||||||
jobs:
|
jobs:
|
||||||
- bats-unit-test
|
- bats-unit-test
|
||||||
- acceptance:
|
- acceptance:
|
||||||
requires:
|
requires:
|
||||||
- bats-unit-test
|
- bats-unit-test
|
||||||
filters:
|
filters:
|
||||||
branches:
|
branches:
|
||||||
only: master
|
only: master
|
||||||
update-helm-charts-index:
|
update-helm-charts-index:
|
||||||
jobs:
|
jobs:
|
||||||
- update-helm-charts-index:
|
- update-helm-charts-index:
|
||||||
|
|
Loading…
Reference in a new issue