Variables in Custom Notification Message


#1

Hello. I am setting up Slack notifications for each stage in my Spinnaker pipeline. There is an option to enter a customer notification message end the Edit Notification box. How do I set it up so that customer notification message shows the Jenkins Job Name, Git Branch Name, and a customer bash variable in the customer notification message?


#2

I don’t think that’s possible yet - could you file a feature request in the issue tracker?


#3

thank you. i’ve created a feature request for this https://github.com/spinnaker/spinnaker/issues/2256


#4

To make sure I understand your question, is this similar to what you’re looking to do?


#5

Yes, I have the same issue. Slack notifications work just fine but expresses do not get evaluated. They just how up at in the screen capture. I’ve tried putting the expression in the application, pipeline, and stage level and results are the same. Apparently it suppose to work on all 3 levels. I have just updated my Halyard version to 0.40 and Spinnaker to 1.5.4 but same thing.

My auto completion does not seem to function where as the other guy has it working. Not sure if that is related or provides some clues to why my expresses are not being evaluated.

01 AM


#6

And here are some of the expressions I have setup and tried to use. Maybe my syntax is incorrect?


#7

Ok. We’ve got it working. I think we had the wrong syntax. The following syntax worked for us.

${trigger.properties.BRANCH}


#8

Is it working now. I am facing the similar problem and I am not able to use expression in slack notification in Pipeline . I have tried a lot of different format which I found any suggestion,

  •     ${execution.stages[0].name}
    
  •     ${execution.stage[0].name} 
    
  •     ${ #stage('stage name')['name']}
    
  •     #stage('stage name')['name']
    

I am using Spinnaker version 1.5.4 and latest Halyard deployed on K8s