Skip to content

Commit 089934b

Browse files
authored
[ISV-6167] Slack notification contain PR url if present (#842)
1 parent 442c40f commit 089934b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

ansible/roles/config_ocp_cluster/files/tasks/chat-pipelinerun-summary.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ spec:
2222
description: The namespace of the PipelineRun.
2323
- name: pipelinerun
2424
description: The name of the PipelineRun to summarize.
25+
- name: git_pr_url
26+
description: The url of the related pull request.
2527
- name: jq_image
2628
description: Container image with jq installed
2729
default: "quay.io/redhat-isv/operator-pipelines-images:released"
@@ -46,8 +48,12 @@ spec:
4648
4749
ns="$(params.namespace)"
4850
pr="$(params.pipelinerun)"
51+
pr_url="$(params.git_pr_url)"
4952
echo "PipelineRun: $pr" >> pipelinerun.txt
5053
echo "Namespace: $ns" >> pipelinerun.txt
54+
if [ -n "$pr_url" ]; then
55+
echo "PR URL: $pr_url" >> pipelinerun.txt
56+
fi
5157
5258
echo "Getting PipelineRun info"
5359
status=$(oc get pipelinerun $pr -n $ns -o 'jsonpath={.status.conditions[-1].reason}')

ansible/roles/config_ocp_cluster/tasks/chat-trigger.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
value: $(body.pipelineRun.metadata.namespace)
4747
- name: pipelinerun
4848
value: $(body.pipelineRun.metadata.name)
49-
- name: thread_key
50-
value: "$(body.pipelineRun.metadata.namespace)-$(header['Ce-Type'])"
49+
- name: git_pr_url
50+
value: $(body.pipelineRun.spec.params[?(@.name=='git_pr_url')].value)
5151

5252
- name: Create Chat TriggerTemplate
5353
kubernetes.core.k8s:
@@ -64,7 +64,8 @@
6464
params:
6565
- name: namespace
6666
- name: pipelinerun
67-
- name: thread_key
67+
- name: git_pr_url
68+
default: ""
6869
resourcetemplates:
6970
- apiVersion: tekton.dev/v1
7071
kind: TaskRun
@@ -79,8 +80,8 @@
7980
value: $(tt.params.namespace)
8081
- name: pipelinerun
8182
value: $(tt.params.pipelinerun)
82-
- name: thread_key
83-
value: $(tt.params.thread_key)
83+
- name: git_pr_url
84+
value: $(tt.params.git_pr_url)
8485
taskRef:
8586
name: chat-pipelinerun-summary
8687

0 commit comments

Comments
 (0)