Closed cf-sewe closed 7 months ago
It should be quite straightforward, just add a new step for it.
I am not sure how you mean this. I get an error that slackResponse is not defined in my post step:
post {
always {
script {
slackResponse.removeReaction("hourglass_flowing_sand")
def statusEmoji = currentBuild.result == 'SUCCESS' ? "white_check_mark" : "x"
def statusColor = currentBuild.result == 'SUCCESS' ? green : red
def message = "Execution of pipeline completed with status ${currentBuild.result}, duration ${currentBuild.durationString}."
slackResponse.addReaction(statusEmoji)
slackSend(
channel: slackResponse.threadId,
color: statusColor,
message: message
)
}
}
}
slackResponse has been defined in a previous step.
i mean adding a new step for it
I did not understand what timja meant. However I used a workaround which resolves the issue for me.
Now I declare the required variable on top level of the declarative pipeline. Then I can use the declared variable in each step, to update the Slack notification reactions.
What feature do you want to see added?
I would like to add/remove reactions in a post step. Currently this is seemingly only possible via the response object. Therefore I would like to add the reaction emoji using stored ThreadId and Timestamp.
Alternatively, is there a way to store and share the slackResponse between different stages? I tried this approach, unsuccessful.
Upstream changes
No response
Are you interested in contributing this feature?
No response