I am setting up a CICD pipeline on Gitlab and following the documentation of Cloud Deploy i am trying to deploy a custom docker image on a Cloud Run. But there is the trick, I already have Terraform settings up my Cloud Runs, and I want to make a skaffold configuration to deploy my image on those cloud run, but I can't figure it with the actual documentation.
In a second time, my goal will be to be able to have 2 sets of deployments (1 dev environment and 1 preprod environment), and to deploy whatever the environment I need.
Do you have any idea how to do the first think first ?
Thank you
I am setting up a CICD pipeline on Gitlab and following the documentation of Cloud Deploy i am trying to deploy a custom docker image on a Cloud Run. But there is the trick, I already have Terraform settings up my Cloud Runs, and I want to make a skaffold configuration to deploy my image on those cloud run, but I can't figure it with the actual documentation.
In a second time, my goal will be to be able to have 2 sets of deployments (1 dev environment and 1 preprod environment), and to deploy whatever the environment I need.
Do you have any idea how to do the first think first ?
Thank you
Share Improve this question asked Feb 17 at 16:03 Robyn.DRobyn.D 4344 silver badges21 bronze badges1 Answer
Reset to default 1So it turns out the documentation of GCP missing a parameter for the releases command : --skaffold-file=skaffold.yaml
With that, I am now able to publish a release on a dev environment, and promote it to a qlf environment with this commands :
gcloud deploy apply --file=clouddeploy.yaml --region=europe-west1 --project=PROJECTID
gcloud deploy releases create test-release-001 --project=PROJECTID --region=europe-west1 --delivery-pipeline=my-run-demo-app-1 --images=name-not-needed=DOCKERIMAGE:latest --skaffold-file=skaffold.yaml
and this files :
clouddeploy.yaml
apiVersion: deploy.cloud.google/v1
kind: DeliveryPipeline
metadata:
name: my-run-demo-app-1
description: main application pipeline
serialPipeline:
stages:
- targetId: cr-deploy-dev
profiles: [dev]
- targetId: cr-deploy-qlf
profiles: [qlf]
---
apiVersion: deploy.cloud.google/v1
kind: Target
metadata:
name: cr-deploy-dev
description: Cloud Run development service
run:
location: projects/PROJECTID/locations/europe-west1
---
apiVersion: deploy.cloud.google/v1
kind: Target
metadata:
name: cr-deploy-qlf
description: Cloud Run development service
run:
location: projects/PROJECTID/locations/europe-west1
skaffold.yaml
apiVersion: skaffold/v4beta7
kind: Config
metadata:
name: deploy-run-quickstart
profiles:
- name: dev
manifests:
rawYaml:
- service-dev.yaml
- name: qlf
manifests:
rawYaml:
- service-qlf.yaml
deploy:
cloudrun: {}
service-dev.yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: cr-deploy-dev
spec:
template:
spec:
containers:
- image: DOCKERIMAGE:latest
service-qlf.yaml
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
name: cr-deploy-qlf
spec:
template:
spec:
containers:
- image: DOCKERIMAGE:latest
There may be another way to do it, but in my case with a gitlab CICD pipeline and gcloud CLI, it is enough for me.