Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #30 from hashicorp/fix-circleci
Browse files Browse the repository at this point in the history
Actually run CircleCI tests, and fix test failures.
  • Loading branch information
josh-padnick committed Oct 11, 2018
2 parents 9bc26b2 + 9096a4e commit 5adb4f5
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
57 changes: 36 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
workspace_root: &workspace_root
/go/src/github.com/hashicorp/terraform-google-consul

defaults: &defaults
working_directory: *workspace_root
docker:
- image: gruntwork/circle-ci-test-image-base:latest

version: 2
jobs:
build:
machine: true
# Changing default working dir to the one used for the go path configuration
# Circle requires the use of the full path without env vars here
working_directory: /home/circleci/.go_workspace/src/github.com/hashicorp/terraform-google-consul
<<: *defaults
steps:
- checkout
- attach_workspace:
at: *workspace_root
- restore_cache:
keys:
- dep-{{ checksum "test/Gopkg.lock" }}
- external-dep
- run: echo 'export PATH=$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV

# Install the gruntwork-module-circleci-helpers and use it to configure the build environment and run tests.
- run: curl -Ls https://raw.githubusercontent.com/gruntwork-io/gruntwork-installer/master/bootstrap-gruntwork-installer.sh | bash /dev/stdin --version v0.0.21
- run: gruntwork-install --module-name "gruntwork-module-circleci-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.13.2"
- run: gruntwork-install --module-name "build-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.13.2"
- run: gruntwork-install --module-name "aws-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.13.2"
- run: gruntwork-install --module-name "git-helpers" --repo "https://github.com/gruntwork-io/module-ci" --tag "v0.13.2"
- run: configure-environment-for-gruntwork-module --go-src-path test --use-go-dep --circle-ci-2

- save_cache:
key: external-dep
paths:
- $HOME/terraform
- $HOME/packer
- $HOME/dep
- save_cache:
key: dep-{{ checksum "test/Gopkg.lock" }}
paths:
- $HOME/.go_workspace/src/github.com/hashicorp/terraform-google-consul/test/vendor
- /go/src/github.com/hashicorp/terraform-google-consul/test/vendor
- persist_to_workspace:
root: *workspace_root
paths: test/vendor
test:
<<: *defaults
steps:
- checkout
- run: echo 'export PATH=$HOME/terraform:$HOME/packer:$PATH' >> $BASH_ENV
- attach_workspace:
at: *workspace_root
# Write service account creds to disk where the API expects them
- run: |
export GOOGLE_APPLICATION_CREDENTIALS="/tmp/gcloud.json" && \
echo $GCLOUD_SERVICE_KEY > /tmp/gcloud.json && \
run-go-tests --circle-ci-2 --path test
workflows:
version: 2
build-and-test:
jobs:
- build
- test:
requires:
- build
2 changes: 1 addition & 1 deletion outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
output "gcp_project" {
description = "The GCP Project where all resources are deployed."
value = "${var.gcp_project}"
value = "${var.gcp_project_id}"
}

output "gcp_region" {
Expand Down
2 changes: 1 addition & 1 deletion test/consul_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var (
// RepoRoot represents the root of the project.
RepoRoot = "../"

ConsulClusterExampleVarProject = "gcp_project"
ConsulClusterExampleVarProject = "gcp_project_id"
ConsulClusterExampleVarRegion = "gcp_region"
ConsulClusterExampleVarZone = "gcp_zone"

Expand Down

0 comments on commit 5adb4f5

Please sign in to comment.