Git Product home page Git Product logo

Comments (6)

connelld-willa avatar connelld-willa commented on September 15, 2024 4

UPDATE:
I redeployed with the previous version us-east1-docker.pkg.dev/gcb-release/cloud-build-notifiers/slack@sha256:357053acf6426028241d140c54f97581d9aa9cf70ffd6a92b0a71d2e7013f4b9

And it works fine. So my guess still, is there is something up with the latest version.

from cloud-build-notifiers.

dpkirchner avatar dpkirchner commented on September 15, 2024

Seems like this is the commit: b0668da

In which case, I'm wondering if one of the variables being passed to the template is has embedded quotes that need to be escaped. I'm looking at my cloud build pub/sub messages and I don't see an obvious problem, however. My best, crazy guess is that it has something to do with some unicode encoded equal sign in the "logUrl" variable.

The template looks for "projectId", "id", "status", and "logUrl". The first three are just plain ol' ASCII, no special characters, no quotes, etc. The fourth, logUrl, is https://console.cloud.google.com/cloud-build/builds/19f99583-3263-48f5-968f-a7e101823d42?project\u003d12345678. I'm thinking maybe it's that \u003d.

from cloud-build-notifiers.

d47id avatar d47id commented on September 15, 2024

@dpkirchner I agree that it's the commit you reference, but I don't think it's an issue with the template values. That commit wires the slack notifier up to use a golang template which gets populated over in notifiers.go.

I copied the new file slack.json into the cloud storage bucket where I have my slack notifier yaml configs, and added a template config to them:

apiVersion: cloud-build-notifiers/v1
kind: SlackNotifier
metadata:
  name: notifier-name
spec:
  notification:
    filter: build.status == Build.Status.SUCCESS
    delivery:
      webhookUrl:
        secretRef: webhook-url
    template:
      type: golang
      uri: gs://bucket-name/slack.json

That cleared the errors in the logs, although the notification is not the prettiest. I guess now I can customize it though.

Seems like the documentation needs to be updated to reflect that a template for slack attachment blocks needs to be configured.

from cloud-build-notifiers.

dandebiase avatar dandebiase commented on September 15, 2024

Another workaround for folks using the slack notifier with the setup.sh shell script. I'm sure this will break the other notifiers though so don't utilize this if you mix them.

@@ -123,7 +123,7 @@ main() {
   DESTINATION_CONFIG_PATH="${DESTINATION_BUCKET_URI}/${SOURCE_CONFIG_BASENAME}"
   SOURCE_TEMPLATE_BASENAME=$(basename "${SOURCE_TEMPLATE_PATH}")
   DESTINATION_TEMPLATE_PATH="${DESTINATION_BUCKET_URI}/${SOURCE_TEMPLATE_BASENAME}"
-  IMAGE_PATH="us-east1-docker.pkg.dev/gcb-release/cloud-build-notifiers/${NOTIFIER_TYPE}:latest"
+  IMAGE_PATH="us-east1-docker.pkg.dev/gcb-release/cloud-build-notifiers/${NOTIFIER_TYPE}:slack-1.14.0"
   SERVICE_NAME="${NOTIFIER_TYPE}-notifier"
   SUBSCRIPTION_NAME="${NOTIFIER_TYPE}-subscription"
   INVOKER_SA="cloud-run-pubsub-invoker@${PROJECT_ID}.iam.gserviceaccount.com"

from cloud-build-notifiers.

ezeYaniv avatar ezeYaniv commented on September 15, 2024

@dandebiase FYI, using this workaround throws the error below when I run the setup.sh script.

Deployment failed                                                                                                                                                                              
ERROR: (gcloud.run.deploy) The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable. Logs for this revision might contain more information.

from cloud-build-notifiers.

dang-hoang-hieu avatar dang-hoang-hieu commented on September 15, 2024

For those who face this error unmarsal JSON
my case was I accidentally had comments in yaml config & json file
like

          secretRef: webhook-url
      template:
        type: golang
        uri: gs://xxxx/slack-msg2.json # some comment here

from cloud-build-notifiers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.