0

I have crated Cloud Build triggers to create CI/CD pipeline for a project and its working perfectly fine. Now, I want to configure SMTP notifications so the entire project team can have updates on the status of build.

Cloud Build publishes status of build to Cloud Pub/Sub topic cloud-builds. So to achieve this I have been following this documentation published by Google Cloud.

I have done exactly what the document says -

  1. Enabled required APIs.

  2. Created a secret to store my SMTP credentials.

  3. Gave permission to Compute Engine default service account to access created secret.

  4. Wrote a notifier configuration as documented.

apiVersion: cloud-build-notifiers/v1 kind: SMTPNotifier metadata: name: master-deloyed-to-staging. spec: notification: filter: build.status == Build.Status.SUCCESS delivery: server: smtp.gmail.com port: '587' sender: [email protected] from: [email protected] recipients: - [email protected] - [email protected] - [email protected] - [email protected] - [email protected] password: secretRef: dropoff-gmail secrets: - name: dropoff-gmail value: projects/project-id/secrets/secret-name/versions/latest 
  1. Created a bucket and uploaded the smtp-notifier.yaml to it.

  2. Now this is the stage where I prepared a command to deploy notifier to cloud run. I using the image used in the documentation to deploy to cloud build

 gcloud run deploy dropoff-deployment-notifier \ --image=us-east1-docker.pkg.dev/gcb-release/cloud-build-notifiers/smtp:latest \ --update-env-vars=CONFIG_PATH=gs://dropoff-assets/cloud_run/smtp-notifier.yaml 

Which returns me an error -

ERROR: (gcloud.run.deploy) Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable. Logs for this revision might contain more information. 

As, stated in error something is wrong with the PORT but don't know how to fix it.

1

1 Answer 1

0

Go to cloud run logs for this component and see the logs directly there, that is how i was able to identified the problem and eventualy fix this issue as i had the same problem.

In my case, the secret name wasn't well formatted.

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.