Comments (6)
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.
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.
@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.
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.
@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.
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)
- allow optional configuration of log levels HOT 1
- [SLACK NOTIFIER] Region not contained in the url HOT 3
- [HTTP Notifications] Empty Body HOT 1
- Not able to use GCP Cloud Build Trigger Name in Email Subject or Body HOT 3
- {{.Build.FailureInfo.Detail}} doesn't work. HOT 1
- [SLACK] color side bar is not working in notification messages HOT 1
- Surfacing author / username information to Slack notifier (GH) HOT 2
- New line in a substitution fails Slack notification HOT 6
- Template vars passed to slack.json (Block Kit template) should escape or replace double quotation marks (ie. {{.Build.FailureInfo.Detail}}) HOT 1
- The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable HOT 6
- [Request] Allow using secret value for HTTP Notifier webhook
- should extract build id in another way when build status is unknown HOT 1
- Go Template `replace` function not found HOT 1
- SlackNotifier message notification popup says "no preview available" in Slack desktop client for Windows HOT 2
- SlackNotifier Error "field template not found in type notifiers.Notification" HOT 2
- Slack notifier fails to deploy because it doesn't listen to port 8080 HOT 7
- [REQUEST] Support for Bitbucket Commit Statuses HOT 1
- Slack notification: {{.Params.buildStatus}} substitution not working HOT 5
- githubissues notifier - use single notifier for multiple repositories HOT 4
- what is the upgrade path for slack notifier versions < 0.15.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cloud-build-notifiers.