...
Expand |
---|
|
Code Block |
---|
| //Carry out any custom action you wish for this event. Check out the documentation for reference or ideas.
//Optionally filter out events you dont want to execute by returning false on the filter script tab.
def listenerName = "myListener";
LOG.info("Running listener: ${listenerName}");
def projectId = EVENT.payload.project.projectId;
def projectName = EVENT.payload.project.projectName;
def workflowType = EVENT.payload.workflow.workflowType;
def executionStatus = EVENT.payload.executionStatus;
if (projectId == 516098 && workflowType == "BUILD" && executionStatus == "SUCCESS") {
LOG.info("Executing Utility Project : ${listenerName}");
def sonarScanProjectId = FLEXDEPLOY.findProjectId("RunSonar");
def environmentCode = "DEV";
def workflowRequestId = FLEXDEPLOY.executeUtility(sonarScanProjectId, environmentCode);
if (workflowRequestId) {
LOG.info("Run Sonar Utility was successfully executed");
}
else {
LOG.severe("Run Sonar Utility failed");
} |
|
Update Package to Completed After Production Deployment
You may want to change a package’s status to completed to indicate it successfully deployed to its final environment. This webhook handles changing the status for you using the Workflow Completed Event. You could also update the filter to only update the status for certain projects, releases, instances, etc.
Expand |
---|
|
Code Block |
---|
| def projectId = EVENT.payload.project.projectId
def packageName = EVENT.payload.packageName
FLEXDEPLOY.updatePackageStatus(projectId, packageName, "COMPLETED") |
|
Expand |
---|
|
Code Block |
---|
| return "SUCCESS".equals(EVENT.payload.executionStatus) && "PRODUCTION".equals(EVENT.payload.environment.environmentCode) && EVENT.payload.packageName != null |
|