integration.cloudbuild.yaml•2.17 kB
# Copyright 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
steps:
- id: "install-dependencies"
name: golang:1
dir: go
waitFor: ["-"]
env:
- "GOPATH=/gopath"
volumes:
- name: "go"
path: "/gopath"
script: |
go get -d ./...
- id: "run-tests"
name: golang:1
dir: go/plugins/postgresql
env:
- "GOPATH=/gopath"
- "PROJECT_ID=$PROJECT_ID"
- "INSTANCE_ID=$_INSTANCE_ID"
- "DATABASE_ID=$_DATABASE_ID"
- "REGION=$_REGION"
- "IP_ADDRESS=$_IP_ADDRESS"
secretEnv: ["DB_USER", "DB_PASSWORD", "EMAIL"]
waitFor: ["install-dependencies"]
volumes:
- name: "go"
path: "/gopath"
script: |
go test -race ./... \
-test-postgres-user=$DB_USER \
-test-postgres-password=$DB_PASSWORD \
-test-postgres-iam-email=$EMAIL \
-test-postgres-project-id=$PROJECT_ID \
-test-postgres-region=$REGION \
-test-postgres-instance=$INSTANCE_ID \
-test-postgres-database=$DATABASE_ID
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/DB_USER/versions/1
env: "DB_USER"
- versionName: projects/$PROJECT_ID/secrets/DB_PASSWORD/versions/1
env: "DB_PASSWORD"
- versionName: projects/$PROJECT_ID/secrets/IAM_ACCOUNT/versions/1
env: "EMAIL"
substitutions:
_INSTANCE_CONNECTION_NAME: ${PROJECT_ID}:${_REGION}:${_INSTANCE_ID}
_DATABASE_PORT: "5432"
_DATABASE_ID: test_database
_REGION: us-central1
_VERSION: "1.24"
_IP_ADDRESS: "127.0.0.1"
_INSTANCE_ID: my-instance
options:
dynamicSubstitutions: true
logging: CLOUD_LOGGING_ONLY