Skip to content

Commit

Permalink
chore(CI): migrate tests to CFT
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Dec 13, 2024
1 parent 9a86b4a commit 27783f5
Show file tree
Hide file tree
Showing 18 changed files with 362 additions and 926 deletions.
30 changes: 0 additions & 30 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,40 +78,10 @@ suites:
systems:
- name: stub_domains_upstream_nameservers
backend: local
- name: "workload_identity"
transport:
root_module_directory: test/fixtures/workload_identity
verifier:
systems:
- name: gcloud
backend: local
controls:
- gcloud
- name: gcp
backend: gcp
controls:
- gcp
- name: "workload_metadata_config"
transport:
root_module_directory: test/fixtures/workload_metadata_config
verifier:
systems:
- name: workload_metadata_config
backend: local
- name: "node_pool"
transport:
root_module_directory: test/fixtures/node_pool
verifier:
systems:
- name: node_pool
backend: local
controls:
- gcloud
- kubectl
- name: "safer_cluster_iap_bastion"
transport:
root_module_directory: test/fixtures/safer_cluster_iap_bastion
verifier:
systems:
- name: safer_cluster_iap_bastion
backend: local
18 changes: 9 additions & 9 deletions build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,17 @@ steps:
waitFor:
- create-all
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge node-pool-local']
args: ['/bin/bash', '-c', 'cft test run TestNodePool --stage apply --verbose']
- id: verify node-pool-local
waitFor:
- converge node-pool-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify node-pool-local']
args: ['/bin/bash', '-c', 'cft test run TestNodePool --stage verify --verbose']
- id: destroy node-pool-local
waitFor:
- verify node-pool-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy node-pool-local']
args: ['/bin/bash', '-c', 'cft test run TestNodePool --stage destroy --verbose']
- id: apply sandbox-enabled-local
waitFor:
- create-all
Expand All @@ -339,32 +339,32 @@ steps:
waitFor:
- create-all
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge workload-identity-local']
args: ['/bin/bash', '-c', 'cft test run TestWorkloadIdentity --stage apply --verbose']
- id: verify workload-identity-local
waitFor:
- converge workload-identity-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify workload-identity-local']
args: ['/bin/bash', '-c', 'cft test run TestWorkloadIdentity --stage verify --verbose']
- id: destroy workload-identity-local
waitFor:
- verify workload-identity-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy workload-identity-local']
args: ['/bin/bash', '-c', 'cft test run TestWorkloadIdentity --stage destroy --verbose']
- id: converge safer-cluster-iap-bastion-local
waitFor:
- create-all
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do converge safer-cluster-iap-bastion-local']
args: ['/bin/bash', '-c', 'cft test run TestSaferClusterIapBastion --stage apply --verbose']
- id: verify safer-cluster-iap-bastion-local
waitFor:
- converge safer-cluster-iap-bastion-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do verify safer-cluster-iap-bastion-local']
args: ['/bin/bash', '-c', 'cft test run TestSaferClusterIapBastion --stage verify --verbose']
- id: destroy safer-cluster-iap-bastion-local
waitFor:
- verify safer-cluster-iap-bastion-local
name: 'gcr.io/cloud-foundation-cicd/$_DOCKER_IMAGE_DEVELOPER_TOOLS:$_DOCKER_TAG_VERSION_DEVELOPER_TOOLS'
args: ['/bin/bash', '-c', 'source /usr/local/bin/task_helper_functions.sh && kitchen_do destroy safer-cluster-iap-bastion-local']
args: ['/bin/bash', '-c', 'cft test run TestSaferClusterIapBastion --stage teardown --verbose']
- id: apply simple-zonal-with-asm-local
waitFor:
- create-all
Expand Down
1 change: 1 addition & 0 deletions examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module "gke" {
disable_legacy_metadata_endpoints = false
cluster_autoscaling = var.cluster_autoscaling
deletion_protection = false
service_account = "default"

node_pools = [
{
Expand Down
6 changes: 5 additions & 1 deletion examples/workload_identity/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -24,6 +24,10 @@ provider "kubernetes" {
host = "https://${module.gke.endpoint}"
token = data.google_client_config.default.access_token
cluster_ca_certificate = base64decode(module.gke.ca_certificate)

ignore_annotations = [
"^iam.gke.io\\/.*"
]
}

module "gke" {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/safer_cluster_iap_bastion/example.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2020 Google LLC
* Copyright 2020-2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 27783f5

Please sign in to comment.