From 21bc24bf696057e055b4c37128dd04adda6c45d1 Mon Sep 17 00:00:00 2001 From: pwei1018 Date: Tue, 16 Jul 2024 10:39:04 -0700 Subject: [PATCH] Upgrade backend CD pipeline. --- .github/workflows/strr-api-cd.yaml | 2 +- strr-api/devops/gcp/clouddeploy-targets.yaml | 95 -------------------- strr-api/devops/gcp/clouddeploy.yaml | 75 ++++++++++++++++ 3 files changed, 76 insertions(+), 96 deletions(-) delete mode 100644 strr-api/devops/gcp/clouddeploy-targets.yaml create mode 100644 strr-api/devops/gcp/clouddeploy.yaml diff --git a/.github/workflows/strr-api-cd.yaml b/.github/workflows/strr-api-cd.yaml index aa4bb044..90fb393f 100644 --- a/.github/workflows/strr-api-cd.yaml +++ b/.github/workflows/strr-api-cd.yaml @@ -20,7 +20,7 @@ on: jobs: strr-api-cd: - uses: bcgov/bcregistry-sre/.github/workflows/cloud-run-service-cd.yaml@main + uses: bcgov/bcregistry-sre/.github/workflows/backend-cd.yaml@main with: target: ${{ inputs.target }} app_name: "strr-api" diff --git a/strr-api/devops/gcp/clouddeploy-targets.yaml b/strr-api/devops/gcp/clouddeploy-targets.yaml deleted file mode 100644 index 26b6929c..00000000 --- a/strr-api/devops/gcp/clouddeploy-targets.yaml +++ /dev/null @@ -1,95 +0,0 @@ -# Copyright 2022 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. - -apiVersion: deploy.cloud.google.com/v1 -kind: Target -metadata: - name: dev -description: Dev Environment -deployParameters: - deploy-env: "development" - deploy-project-id: "bcrbk9-dev" - service-name: "strr-api-dev" - container-name: "strr-api-dev" - cloudsql-instances: "bcrbk9-dev:northamerica-northeast1:strr-db-dev" - service-account: "sa-api@bcrbk9-dev.iam.gserviceaccount.com" -run: - location: projects/bcrbk9-dev/locations/northamerica-northeast1 -executionConfigs: -- usages: [DEPLOY, RENDER] - artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' ---- - -apiVersion: deploy.cloud.google.com/v1 -kind: Target -metadata: - name: test -description: Test Environment -deployParameters: - deploy-env: "test" - deploy-project-id: "bcrbk9-test" - service-name: "strr-api-test" - container-name: "strr-api-test" - app-env: "test" - cloudsql-instances: "bcrbk9-test:northamerica-northeast1:strr-db-test" - service-account: "sa-api@bcrbk9-test.iam.gserviceaccount.com" -run: - location: projects/bcrbk9-test/locations/northamerica-northeast1 -executionConfigs: -- usages: [DEPLOY, RENDER] - artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' ---- - -apiVersion: deploy.cloud.google.com/v1 -kind: Target -metadata: - name: sandbox -description: Sandbox Environment -requireApproval: false -deployParameters: - deploy-env: "sandbox" - deploy-project-id: "bcrbk9-tools" - service-name: "strr-api-sandbox" - container-name: "strr-api-sandbox" - app-env: "sandbox" - cloudsql-instances: "bcrbk9-tools:northamerica-northeast1:strr-db-sandbox" - service-account: "sa-api@bcrbk9-tools.iam.gserviceaccount.com" -run: - location: projects/bcrbk9-tools/locations/northamerica-northeast1 -executionConfigs: -- usages: [DEPLOY, RENDER] - artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' ---- - -apiVersion: deploy.cloud.google.com/v1 -kind: Target -metadata: - name: prod -description: Production Environment -requireApproval: false -deployParameters: - deploy-env: "production" - deploy-project-id: "bcrbk9-prod" - service-name: "strr-api-prod" - container-name: "strr-api-prod" - app-env: "production" - cloudsql-instances: "bcrbk9-prod:northamerica-northeast1:strr-db-prod" - service-account: "sa-api@bcrbk9-prod.iam.gserviceaccount.com" - max-scale: "10" - container-concurrency: "20" -run: - location: projects/bcrbk9-prod/locations/northamerica-northeast1 -executionConfigs: -- usages: [DEPLOY, RENDER] - artifactStorage: 'gs://c4hnrd-tools_clouddeploy/history' \ No newline at end of file diff --git a/strr-api/devops/gcp/clouddeploy.yaml b/strr-api/devops/gcp/clouddeploy.yaml new file mode 100644 index 00000000..df00304a --- /dev/null +++ b/strr-api/devops/gcp/clouddeploy.yaml @@ -0,0 +1,75 @@ +# Copyright 2022 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. + +apiVersion: deploy.cloud.google.com/v1 +kind: DeliveryPipeline +metadata: + name: strr-api-pipeline +description: Deployment pipeline +serialPipeline: + stages: + - targetId: bcrbk9-dev + profiles: [dev] + strategy: + standard: + verify: false + deployParameters: + - values: + deploy-env: "development" + deploy-project-id: "bcrbk9-dev" + service-name: "strr-api-dev" + container-name: "strr-api-dev" + cloudsql-instances: "bcrbk9-dev:northamerica-northeast1:strr-db-dev" + service-account: "sa-api@bcrbk9-dev.iam.gserviceaccount.com" + - targetId: bcrbk9-test + profiles: [test] + strategy: + standard: + verify: false + deployParameters: + - values: + deploy-env: "test" + deploy-project-id: "bcrbk9-test" + service-name: "strr-api-test" + container-name: "strr-api-test" + cloudsql-instances: "bcrbk9-test:northamerica-northeast1:strr-db-test" + service-account: "sa-api@bcrbk9-test.iam.gserviceaccount.com" + - targetId: bcrbk9-sandbox + profiles: [sandbox] + strategy: + standard: + verify: false + deployParameters: + - values: + deploy-env: "sandbox" + deploy-project-id: "bcrbk9-tools" + service-name: "strr-api-sandbox" + container-name: "strr-api-sandbox" + cloudsql-instances: "bcrbk9-tools:northamerica-northeast1:strr-db-sandbox" + service-account: "sa-api@bcrbk9-tools.iam.gserviceaccount.com" + - targetId: bcrbk9-prod + profiles: [prod] + strategy: + standard: + verify: false + deployParameters: + - values: + deploy-env: "production" + deploy-project-id: "bcrbk9-prod" + service-name: "strr-api-prod" + container-name: "strr-api-prod" + cloudsql-instances: "bcrbk9-prod:northamerica-northeast1:strr-db-prod" + service-account: "sa-api@bcrbk9-prod.iam.gserviceaccount.com" + max-scale: "10" + container-concurrency: "20"