GoogleCloudPlatform / GoogleCloudPlatform/cloud-build-notifiers

SlackNotifier Error "field template not found in type notifiers.Notification"

Open
#181 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
157
Forks
144
Avg merge
1h 34m
Merged PRs (30d)
1

Description

Hi guys,

I'm getting this error on deployment :

```
Container called exit(255).
/go-src/slack/main.go:33 +0x7b
...
line 10: field template not found in type notifiers.Notification
...
main.go: fatal error: failed to get config from GCS: failed to parse configuration from YAML at "xxx/slack/cloud-build/conf.yaml": yaml: unmarshal errors:

```

My config file seems reachable. When I specify a not existing config path, it throws a different error.

Any idea?

conf.yaml
```
apiVersion: cloud-build-notifiers/v1
kind: SlackNotifier
metadata:
name: cloud-build-slack-notifier
spec:
notification:
delivery:
webhookUrl:
secretRef: webhook-url
template:
type: golang
uri: gs://xxx/slack/cloud-build/message.json

secrets:
- name: webhook-url
value: projects/xxx/secrets/xxx/versions/latest

```

message.json
```
[
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Cloud Build {{.Build.ProjectId}} {{.Build.Id}} {{.Params.buildStatus}}"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "View Build Logs"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "Logs"
},
"value": "click_me_123",
"url": "{{.Build.LogUrl}}",
"action_id": "button-action"
}
}
]
```

```
gcloud run deploy slack-notify-cloud-build \
--image=us-east1-docker.pkg.dev/gcb-release/cloud-build-notifiers/slack:slack-1.14.0 \
--no-allow-unauthenticated \
--update-env-vars=CONFIG_PATH=gs://xxx/slack/cloud-build/conf.yaml,PROJECT_ID=xxx
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.