Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Access Change Set in deployment step #4279

grudzien44140 ·

We have a custom deployment step that sends a message to our teams server when the deployment succeeds, fails or is stopped. I want to add the changeset data to the message. How can I access the change set log of the build that is being deployed so that I can add the change set data to the message posted to our teams server?

Currently the step is a Build > Shell/Batch Command. Below is the current script running.

#!/bin/bash

echo "Successful deploy for environment: ${vars.getValue("TARGET_ENV")} ${vars.getValue("TRC_SCM_BRANCH_NAME")}"

curl --location --request POST "https://teams.server.com/webhook/9999/IncomingWebhook/9999" --header "Content-Type: application/json" --data '{"@type": "MessageCard","@context": "https://schema.org/extensions","summary": "Deploy Notification","themeColor": "0078D7","sections": [{"activityImage": "https://image.server.com/is/image/XXXXX/success","activityTitle": "Deploy Successful **${vars.getValue("TARGET_ENV")}**","activitySubtitle": "${vars.getValue("TRC_SCM_BRANCH_NAME")}","activityText": ""}]}'

Any help would be appreciated

  • solved #2
  • replies 1
  • views 58
  • stars 1
robinshen ADMIN ·

You may get changeset of current build via groovy script like below:

${groovy:
for (buildChangeset in build.changes) {
  logger.info(buildChangeset.repositoryName);
  def changeset = buildChangeset.changeset;
  logger.info("changed by: " + changeset.user);
  logger.info("change message: " + changeset.comment);
  for (modification in changeset.modifications) {
    logger.info("action: " + modification.action.name());
    logger.info("path: " + modification.path);
  \}
\}
}

And you may encoded these messages appropriately and use in your shell script.