Slack is a business messaging application that connects people to the information they need. By bringing people together to work as one unified team, Slack transforms the way organizations communicate.
The EC-Slack plugin implements the integration with Slack using the incoming webhook interface that allows CloudBees CD/RO to send messages to a Slack channel. Refer to Slack incoming webhooks for more information.
Plugin version 2.0.1
Revised on December 01, 2022
Prerequisites
After you upgrade to v2.0, you must reconfigure your procedure steps and pipeline tasks. For more information, refer to Upgrading your tasks and steps from EC-Slack 1.x to EC-Slack 2.x.
Plugin configurations
Plugin configurations are sets of parameters that can be applied across some, or all, of the plugin procedures. They can reduce the repetition of common values, create predefined parameter sets, and securely store credentials. Each configuration is given a unique name that is entered in the designated parameter for the plugin procedures that use them.
Creating plugin configurations
To create plugin configurations in CloudBees CD/RO, complete the following steps:
-
Navigate to
. -
Select Add plugin configuration to create a new configuration.
-
In the New Configuration window, specify a Name for the configuration.
-
Select the Project that the configuration belongs to.
-
Optionally, add a Description for the configuration.
-
Select the appropriate Plugin for the configuration.
-
Configure the parameters per the descriptions below.
Configuration procedure parameters
Parameter | Description |
---|---|
Configuration Name |
Required. The name for the created configuration. |
Description |
Description for the configuration. |
Integration Webhook URL |
Required. For example, https://abc.slack.com/services/yyzzxx |
Debug level |
This option sets the debug level for logs. If Info is selected, only a summary is displayed. If Debug is selected, debug information is displayed. If Trace is selected, all requests and responses are displayed. |
Plugin procedures
Upgrading your tasks and steps from EC-Slack 1.x to EC-Slack 2.x
When upgrading your version from EC-Slack 1.x to EC-Slack 2.x, you must update your pipeline procedures and tasks to use the new version. This can be a lengthy process. To help reduce the overhead involved, you can also run the following code to perform these tasks.
If you need help running the code, refer to Getting started with DSL. |
Select to show code
procedure 'Upgrade tasks & steps EC-Slack 1.x to EC-Slack 2.x ', {
projectName = 'Default'
timeLimit = '0'
step 'Upgrade tasks & steps', {
command = '''import com.electriccloud.client.groovy.ElectricFlow
import com.electriccloud.client.groovy.models.ActualParameter
ElectricFlow ef = new ElectricFlow()
def projects = ef.getProjects()
projects.project.each { projectEntity ->
if (projectEntity.pluginKey == null || projectEntity.pluginName == null) {
println "Working on project: " + projectEntity.projectName
def pipelinesResult = ef.getPipelines(projectName: projectEntity.projectName)
pipelinesResult.pipeline.each { pipeline ->
println "... Working on pipeline: " + pipeline.pipelineName
def stages = ef.getStages(projectName: projectEntity.projectName,
pipelineName: pipeline.pipelineName)
stages.stage.each { stage ->
println "...... Working on stage: " + stage.stageName
def tasks = ef.getTasks(projectName: projectEntity.projectName,
pipelineName: pipeline.pipelineName,
stageName: stage.stageName)
tasks.task.each { task ->
println "......... Working on task: " + task.taskName
if (task.subpluginKey == "EC-Slack") {
println "............ Task matched "
def parameterDetails = task.actualParameters.parameterDetail
def List<ActualParameter> actualParameterArray = new ArrayList<ActualParameter>()
parameterDetails.each {
parameter ->
if (parameter.parameterName == "config" || parameter.parameterName == "payload") {
def actualParameter = new ActualParameter()
actualParameter.setActualParameterName(parameter.parameterName)
actualParameter.setValue(parameter.parameterValue)
actualParameterArray.add(actualParameter)
}
if (parameter.parameterName == "payload-msg") {
def actualParameter = new ActualParameter()
actualParameter.setActualParameterName("payload")
actualParameter.setValue(parameter.parameterValue)
actualParameterArray.add(actualParameter)
}
}
def result = ef.modifyTask(projectName: projectEntity.projectName,
pipelineName: pipeline.pipelineName,
stageName: stage.stageName,
taskName: task.taskName,
actualParameters: actualParameterArray,
clearActualParameters: true)
println "............ Task updated "
println "............ New parameters:" + actualParameterArray
}
}
}
}
def procedures = ef.getProcedures(projectName: projectEntity.projectName)
if (procedures.size() != 0) {
procedures.procedure.each { procedure ->
println "... Working on procedure: : " + procedure.procedureName
def steps = ef.getSteps(
projectName: projectEntity.projectName,
procedureName: procedure.procedureName
)
steps.step.each { step ->
def parameters = ef.getActualParameters(
projectName: projectEntity.projectName,
procedureName: procedure.procedureName,
stepName: step.stepName)
println "...... Working on step: : " + step.stepName
if (step.subproject == \'/plugins/EC-Slack/project\') {
println "............ Step matched "
def List<ActualParameter> actualParameterArray = new ArrayList<ActualParameter>()
def details = parameters.actualParameter
parameters.actualParameter.each {
parameter ->
if (parameter.actualParameterName == "config" || parameter.actualParameterName == "payload") {
def actualParameter = new ActualParameter()
actualParameter.setActualParameterName(parameter.actualParameterName)
actualParameter.setValue(parameter.value)
actualParameterArray.add(actualParameter)
}
if (parameter.actualParameterName == "payload-msg") {
def actualParameter = new ActualParameter()
actualParameter.setActualParameterName("payload")
actualParameter.setValue(parameter.value)
actualParameterArray.add(actualParameter)
}
}
def result = ef.modifyStep(
projectName: projectEntity.projectName,
procedureName: procedure.procedureName,
stepName: step.stepName,
actualParameters: actualParameterArray,
clearActualParameters: true
)
println "............ Step updated "
println "............ New parameters:" + actualParameterArray
}
}
}
}
println "==============================================="
}
}'''
shell = 'ec-groovy'
timeLimit = '0'
timeLimitUnits = 'seconds'
}
}