Skip to content

Commit

Permalink
chore(ci): Provider cache for lint (#641)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathkkb committed Oct 22, 2020
1 parent 56af31d commit c8096a4
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 23 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.12.1
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.12.2
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down Expand Up @@ -68,6 +68,7 @@ docker_test_integration:
.PHONY: docker_test_lint
docker_test_lint:
docker run --rm -it \
-e ENABLE_PARALLEL=1 \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/usr/local/bin/test_lint.sh
Expand Down
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,6 @@ tags:
- 'integration'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.12.1'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.12.2'
options:
machineType: 'N1_HIGHCPU_8'
6 changes: 5 additions & 1 deletion build/lint.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ tags:
- 'lint'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.12.1'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.12.2'
options:
machineType: 'N1_HIGHCPU_8'
env:
- ENABLE_PARALLEL=1
12 changes: 12 additions & 0 deletions test/bundle.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {
version = "0.12.29"
}

providers {
google = ["~> 3.42.0"]
google-beta = ["~> 3.42.0"]
external = ["~> 1.0"]
kubernetes = ["~> 1.12.0"]
null = ["~> 2.0"]
random = ["~> 2.0"]
}
8 changes: 1 addition & 7 deletions test/integration/beta_cluster/controls/gcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@
service_account = attribute("service_account")
project_id = attribute("project_id")

if service_account.start_with? "projects/"
service_account_name = service_account
else
service_account_name = "projects/#{project_id}/serviceAccounts/#{service_account}"
end

describe google_service_account name: service_account_name do
describe google_service_account(project: project_id, name: service_account) do
its("display_name") { should eq "Terraform-managed service account for cluster #{attribute("cluster_name")}" }
its("project_id") { should eq project_id }
end
Expand Down
2 changes: 1 addition & 1 deletion test/integration/beta_cluster/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: beta_cluster
depends:
- name: inspec-gcp
git: https://github.com/inspec/inspec-gcp.git
tag: v0.10.0
tag: v1.8.0
attributes:
- name: project_id
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
expect(data['nodePools']).to include(
including(
"config" => including(
"machineType" => "n1-standard-1",
"machineType" => "e2-medium",
),
)
)
Expand Down
2 changes: 1 addition & 1 deletion test/integration/private_zonal_with_networking/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: private_zonal_with_networking
depends:
- name: inspec-gcp
git: https://github.com/inspec/inspec-gcp.git
tag: v0.10.0
tag: v1.8.0
attributes:
- name: project_id
required: true
Expand Down
2 changes: 1 addition & 1 deletion test/integration/safer_cluster/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: safer_cluster
depends:
- name: inspec-gcp
git: https://github.com/inspec/inspec-gcp.git
tag: v0.11.0
tag: v1.8.0
attributes:
- name: project_id
required: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: simple_regional_with_networking
depends:
- name: inspec-gcp
git: https://github.com/inspec/inspec-gcp.git
tag: v0.10.0
tag: v1.8.0
attributes:
- name: project_id
required: true
Expand Down
8 changes: 1 addition & 7 deletions test/integration/simple_zonal/controls/gcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,7 @@
service_account = attribute("service_account")
project_id = attribute("project_id")

if service_account.start_with? "projects/"
service_account_name = service_account
else
service_account_name = "projects/#{project_id}/serviceAccounts/#{service_account}"
end

describe google_service_account(name: service_account_name) do
describe google_service_account(project: project_id, name: service_account) do
its("display_name") { should eq "Terraform-managed service account for cluster #{attribute("cluster_name")}" }
its("project_id") { should eq project_id }
end
Expand Down
2 changes: 1 addition & 1 deletion test/integration/simple_zonal/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: simple_zonal
depends:
- name: inspec-gcp
git: https://github.com/inspec/inspec-gcp.git
tag: v0.16.0
tag: v1.8.0
attributes:
- name: project_id
required: true
Expand Down

0 comments on commit c8096a4

Please sign in to comment.