Expected Behavior
Trigger hands off Slack urlencoded request to the custom slack interceptor, which then decodes the body into JSON and returns it to the Trigger for further processing
Actual Behavior
After upgrade to Triggers v0.30.1, it appears that the Trigger is decoding the Slack request and passes JSON to the Slack interceptor instead of the original urlencoded body
Additional Info
Client Version: v1.33.3
Kustomize Version: v5.6.0
Server Version: v1.31.9
v0.68.1
More Info
I'm in the process of upgrading my Tekton environment from and to the following versions, respectively:
Pipeline: v0.44.4 ---> v0.68.1
Triggers: v0.23.1 ---> v0.30.1
In preparation for the upgrade, I migrated the apiVersions of my manifests as follows:
Pipelines/Tasks/etc: tekton.dev/v1beta1 ---> apiVersion: tekton.dev/v1
Triggers/TriggerTemplates/EventListener: triggers.tekton.dev/v1alpha1 ---> triggers.tekton.dev/v1beta1
Before I upgraded any of the Tekton components, I confirmed everything was working as expected after the API migrations. Everything was going fine...
However, I have a Slack integration with my Tekton setup. Until now I've been using a custom Slack interceptor to convert the urlencoded body of a Slack slash command to JSON. The EL looks something like this:
---
apiVersion: triggers.tekton.dev/v1beta1
kind: EventListener
metadata:
name: event-listener-v1
annotations:
tekton.dev/payload-validation: "false"
spec:
triggers:
- name: slackcmd-interceptor
interceptors:
- webhook:
objectRef:
kind: Service
name: slack-payload-handler
apiVersion: v1
namespace: tekton-tasks
- ref:
name: cel
params:
- name: filter
value: >-
has(body.api_app_id) &&
body.token.compareSecret('slack','el-secrets') &&
has(body.command) &&
has(body.text) &&
body.command.indexOf('app-deploy') != -1
- name: overlays
value:
- key: env
expression: "body.text.split(' ')[0]"
- key: appName
expression: "body.text.split(' ')[1]"
- key: appTag
expression: "body.text.split(' ')[2]"
- key: slackUserId
expression: "body.user_id"
- key: slackChannelId
expression: "body.channel_id"
- key: b64body
expression: "base64.encode(bytes(body.marshalJSON()))"
bindings:
- ref: start-via-cmd-app-deploy-v1
- name: b64body
value: $(extensions.b64body)
template:
ref: start-v1
So the EL would pass Slack's urlencoded request to the slack-payload-handler, which would return JSON similar to this:
{
"api_app_id": "ABCDE",
"channel_id": "FGHIJ",
"channel_name": "my-channel",
"command": "/app-deploy",
"response_url": "https://hooks.slack.com/commands/T...",
"team_domain": "my-company",
"team_id": "KLMNO",
"text": "env appName appTag",
"token": "XXXXX",
"trigger_id": "12345...",
"user_id": "YYYYY",
"user_name": "my.user"
}
This stopped working after I upgraded Triggers to v0.30.1. Did some troubleshooting and found that the Slack request that the EL hands off to the slack-payload-handler is no longer in Slack's urlencoded format, but seems to be already decoded into JSON with the following format
{
"api_app_id": ["ABCDE"],
"channel_id": ["FGHIJ"],
"channel_name": ["my-channel"],
"command": ["/app-deploy"],
"response_url": ["https://hooks.slack.com/commands/T..."],
"team_domain": ["my-company"],
"team_id": ["KLMNO"],
"text": ["env appName appTag"],
"token": ["XXXXX"],
"trigger_id": ["12345..."],
"user_id": ["YYYYY"],
"user_name": ["my.user"]
}
So I guess my first question is - why is the Event Listener decoding the incoming Slack request before it even gets sent to the slack-payload-handler webhook? I know that Tekton has since added its own Slack interceptor, but I'm not using it in my spec.
Second question - why is it converting the string value for each key in the JSON object to a list. This messes up tasks in my pipeline that are unable to parse it properly.
Any help would be greatly appreciated. Again I know that Tekton now has an official Slack interceptor (which I did actually try to use and got the same unwanted result), but I'd like to still use the custom one.
Thank you!
Expected Behavior
Trigger hands off Slack urlencoded request to the custom slack interceptor, which then decodes the body into JSON and returns it to the Trigger for further processing
Actual Behavior
After upgrade to Triggers v0.30.1, it appears that the Trigger is decoding the Slack request and passes JSON to the Slack interceptor instead of the original urlencoded body
Additional Info
Kubernetes version: v1.31.9
Output of
kubectl version:Tekton Pipeline version:
Output of
tkn versionorkubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'v0.68.1
More Info
I'm in the process of upgrading my Tekton environment from and to the following versions, respectively:
Pipeline: v0.44.4 ---> v0.68.1
Triggers: v0.23.1 ---> v0.30.1
In preparation for the upgrade, I migrated the apiVersions of my manifests as follows:
Pipelines/Tasks/etc: tekton.dev/v1beta1 ---> apiVersion: tekton.dev/v1
Triggers/TriggerTemplates/EventListener: triggers.tekton.dev/v1alpha1 ---> triggers.tekton.dev/v1beta1
Before I upgraded any of the Tekton components, I confirmed everything was working as expected after the API migrations. Everything was going fine...
However, I have a Slack integration with my Tekton setup. Until now I've been using a custom Slack interceptor to convert the urlencoded body of a Slack slash command to JSON. The EL looks something like this:
So the EL would pass Slack's urlencoded request to the slack-payload-handler, which would return JSON similar to this:
This stopped working after I upgraded Triggers to v0.30.1. Did some troubleshooting and found that the Slack request that the EL hands off to the slack-payload-handler is no longer in Slack's urlencoded format, but seems to be already decoded into JSON with the following format
So I guess my first question is - why is the Event Listener decoding the incoming Slack request before it even gets sent to the slack-payload-handler webhook? I know that Tekton has since added its own Slack interceptor, but I'm not using it in my spec.
Second question - why is it converting the string value for each key in the JSON object to a list. This messes up tasks in my pipeline that are unable to parse it properly.
Any help would be greatly appreciated. Again I know that Tekton now has an official Slack interceptor (which I did actually try to use and got the same unwanted result), but I'd like to still use the custom one.
Thank you!