Skip to content

Notify

Send a build job’s failure, or the package version it created, to Microsoft Teams, with issue-tracker integration.

USAGE
$ sf simply cicd notify build [--json] [--flags-dir <value>] [--ci-commit-ref-name <value>] [--ci-job-name <value>]
[--ci-job-stage <value>] [--ci-job-status <value>] [--ci-pipeline-id <value>] [--ci-pipeline-url <value>]
[--ci-project-title <value>] [--subscriber-package-version-id <value>] [--enabled] [--alm-provider
gitlab-issues|jira] [--alm-host <value>] [--alm-project-path <value>] [--alm-project-key <value>] [--alm-base-url
<value>] [--teams-webhook-url <value>...] [--debug]
FLAGS
--alm-base-url=<value> [env: SIMPLY_CICD_ALM_BASE_URL] Deprecated: use --alm-host. Full URL that an
issue reference is appended to; overrides --alm-host when set.
--alm-host=<value> [env: SIMPLY_CICD_ALM_HOST] Hostname of the issue tracker, e.g.
jira.example.com. The ALM provider builds each issue's link from it.
--alm-project-key=<value> [env: SIMPLY_CICD_ALM_PROJECT_KEY] Project key used to search commit messages
for issue references. Overrides alm.projectKeys in .sfdevrc.json (or
SIMPLY_ALM_PROJECT_KEYS). Only used by prefix-keyed trackers such as Jira.
--alm-project-path=<value> [env: SIMPLY_CICD_ALM_PROJECT_PATH] Project (group/project) whose issues
GitLab Issues references link to. Defaults to the repository the commits came
from: CI_PROJECT_PATH, or each upgraded package's own project for happy-soup.
Ignored by Jira.
--alm-provider=<option> [env: SIMPLY_CICD_ALM_PROVIDER] The issue tracker whose reference format to
look for in commit messages, and whose link format to use. Defaults to
alm.provider in .sfdevrc.json (or SIMPLY_ALM_PROVIDER), then jira.
<options: gitlab-issues|jira>
--ci-commit-ref-name=<value> [env: SIMPLY_CICD_CI_COMMIT_REF_NAME] The git branch or tag ref for this
pipeline run.
--ci-job-name=<value> [env: SIMPLY_CICD_CI_JOB_NAME] The name of the current CI job.
--ci-job-stage=<value> [env: SIMPLY_CICD_CI_JOB_STAGE] The stage of the current CI job.
--ci-job-status=<value> [env: SIMPLY_CICD_CI_JOB_STATUS] The status of the current CI job: success,
failed, or canceled. GitHub Actions' failure and cancelled also work.
--ci-pipeline-id=<value> [env: SIMPLY_CICD_CI_PIPELINE_ID] The ID of the current CI pipeline.
--ci-pipeline-url=<value> [env: SIMPLY_CICD_CI_PIPELINE_URL] The URL of the current CI pipeline.
--ci-project-title=<value> [env: SIMPLY_CICD_CI_PROJECT_TITLE] The project title shown in the
notification card's heading.
--debug [env: SIMPLY_CICD_DEBUG] Enable verbose debug logging.
--enabled [env: SIMPLY_CICD_ENABLED] Whether the notification is actually sent.
Defaults to false so pipelines can gate this behind their own condition.
--subscriber-package-version-id=<value> [env: SIMPLY_CICD_SUBSCRIBER_PACKAGE_VERSION_ID] The subscriber package
version ID (04t...) created by this job. Defaults to the one in
subscriberPackageVersionId.env, written by build create-package-version.
--teams-webhook-url=<value>... One or more Teams webhook URLs to send the notification to.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Send a build job's failure, or the package version it created, to Microsoft Teams, with issue-tracker integration.
Run in every build job's `after_script`. Which card it posts depends on `--ci-job-status`:
- `failed`: a failure card with the job, stage, branch, and pipeline, whichever build job failed.
- `canceled`: a canceled card with the same details, whichever build job was canceled.
- `success`: a package version card, but only when the job created a package version. The card shows the new version
tag, its `04t` ID, and the issue references in the commits since the previous version tag. Every other successful job
sends nothing.
- Anything else (e.g. `running`), or no status: nothing.
The status is matched without regard to case, and GitHub Actions' `failure` and `cancelled` count as `failed` and
`canceled`.
The `04t` ID comes from `--subscriber-package-version-id`, or else from the `subscriberPackageVersionId.env` file that
`build create-package-version` writes to the working directory. The new version's tag is the tag at `HEAD` annotated
with that ID. The previous version's tag is the nearest earlier tag in the project's version tag format
(`plugins.simply.versionTagFormat` or `SIMPLY_CICD_VERSION_TAG_FORMAT`). The command fetches tags, and the full
history when the clone is shallow. If a tag or the history can't be found, the card shows `N/A` instead of failing the
job.
EXAMPLES
Post a card from a build job's after_script; it only sends one when the job failed or created a package version:
$ sf simply cicd notify build --ci-job-name push-scratch --ci-job-status "$CI_JOB_STATUS" --teams-webhook-url \
https://outlook.office.com/webhook/... --enabled
Announce a package version with linked Jira stories:
$ sf simply cicd notify build --ci-job-status success --alm-host jira.example.com --teams-webhook-url \
https://outlook.office.com/webhook/... --enabled
FLAG DESCRIPTIONS
--alm-host=<value>
Hostname of the issue tracker, e.g. jira.example.com. The ALM provider builds each issue's link from it.
Jira links to https://<host>/browse/<KEY>. GitLab Issues links to https://<host>/<project-path>/-/issues/<number>,
with the host defaulting to the repository's host (CI_SERVER_HOST) and then gitlab.com. Falls back to alm.host in
.sfdevrc.json (or SIMPLY_ALM_HOST). A value with an http:// or https:// scheme, or a context path such as
jira.example.com/jira, is used as given. References are shown without links if no host can be resolved.

See code: lib/commands/simply/cicd/notify/build.js

Send a happy-soup deployment stage notification to Microsoft Teams, with ALM story integration for upgraded packages.

USAGE
$ sf simply cicd notify happy-soup [--json] [--flags-dir <value>] [--after-script] [--before-script] [--ci-commit-ref-name
<value>] [--ci-environment-name <value>] [--ci-job-name <value>] [--ci-job-stage <value>] [--ci-job-status <value>]
[--ci-job-token <value>] [--ci-pipeline-id <value>] [--ci-pipeline-url <value>] [--deploy-progress-file <value>]
[--enabled] [--alm-provider gitlab-issues|jira] [--alm-host <value>] [--alm-project-path <value>] [--alm-project-key
<value>] [--alm-base-url <value>] [--project-access-token <value>] [--teams-webhook-url <value>...]
[--notify-on-completion] [--is-final-job] [--debug]
FLAGS
--after-script Run the after-stage notification logic.
--alm-base-url=<value> [env: SIMPLY_CICD_ALM_BASE_URL] Deprecated: use --alm-host. Full URL that an issue
reference is appended to; overrides --alm-host when set.
--alm-host=<value> [env: SIMPLY_CICD_ALM_HOST] Hostname of the issue tracker, e.g. jira.example.com. The
ALM provider builds each issue's link from it.
--alm-project-key=<value> [env: SIMPLY_CICD_ALM_PROJECT_KEY] Project key used to search commit messages for
issue references. Overrides alm.projectKeys in .sfdevrc.json (or
SIMPLY_ALM_PROJECT_KEYS). Only used by prefix-keyed trackers such as Jira.
--alm-project-path=<value> [env: SIMPLY_CICD_ALM_PROJECT_PATH] Project (group/project) whose issues GitLab Issues
references link to. Defaults to the repository the commits came from: CI_PROJECT_PATH,
or each upgraded package's own project for happy-soup. Ignored by Jira.
--alm-provider=<option> [env: SIMPLY_CICD_ALM_PROVIDER] The issue tracker whose reference format to look for
in commit messages, and whose link format to use. Defaults to alm.provider in
.sfdevrc.json (or SIMPLY_ALM_PROVIDER), then jira.
<options: gitlab-issues|jira>
--before-script Run the before-stage (starting) notification logic.
--ci-commit-ref-name=<value> [env: SIMPLY_CICD_CI_COMMIT_REF_NAME] The git branch or tag ref for this pipeline run.
--ci-environment-name=<value> [env: SIMPLY_CICD_CI_ENVIRONMENT_NAME] The name of the target CI environment.
--ci-job-name=<value> [env: SIMPLY_CICD_CI_JOB_NAME] The name of the current CI job.
--ci-job-stage=<value> [env: SIMPLY_CICD_CI_JOB_STAGE] The stage of the current CI job.
--ci-job-status=<value> [env: SIMPLY_CICD_CI_JOB_STATUS] The status of the current CI job: success, failed, or
canceled. GitHub Actions' failure and cancelled also work.
--ci-job-token=<value> [env: SIMPLY_CICD_CI_JOB_TOKEN] The CI job token to try first when looking up an
upgraded package's origin commit history. Falls back to --project-access-token if the
job token can't read that repository.
--ci-pipeline-id=<value> [env: SIMPLY_CICD_CI_PIPELINE_ID] The ID of the current CI pipeline.
--ci-pipeline-url=<value> [env: SIMPLY_CICD_CI_PIPELINE_URL] The URL of the current CI pipeline.
--debug [env: SIMPLY_CICD_DEBUG] Enable verbose debug logging.
--deploy-progress-file=<value> [default: DEPLOY_PROGRESS.json, env: SIMPLY_CICD_DEPLOY_PROGRESS_FILE] Path to the
deployment progress file to read upgraded package information from.
--enabled [env: SIMPLY_CICD_ENABLED] Whether the notification is actually sent. Defaults to
false so pipelines can gate this behind their own condition.
--is-final-job Marks this job as the final job in the pipeline. Combined with --after-script and
--notify-on-completion, this is what actually triggers the final notification.
--notify-on-completion Only send a notification on the final job of the pipeline, suppressing per-stage
notifications.
--project-access-token=<value> [env: SIMPLY_CICD_PROJECT_ACCESS_TOKEN] A personal or project access token, used to
look up an upgraded package's origin commit history when --ci-job-token isn't provided
or can't read that repository.
--teams-webhook-url=<value>... One or more Teams webhook URLs to send the notification to.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Send a happy-soup deployment stage notification to Microsoft Teams, with ALM story integration for upgraded packages.
Run with `--before-script` at the start of a stage to post a "starting" card, and with `--after-script` at the end to
post a card for the job's `--ci-job-status`: a success, failure, or canceled card. A status that is set but not
recognized (e.g. `running`) sends nothing. Without `--ci-job-status`, the job counts as successful, since GitLab only
sets `CI_JOB_STATUS` in `after_script`. The status is matched without regard to case, and GitHub Actions' `failure`
and `cancelled` count as `failed` and `canceled`. With `--notify-on-completion`, intermediate stage notifications are
suppressed and only the final job (`--is-final-job` combined with `--after-script`) posts a card.
On a successful `--after-script`, reads the packages upgraded by `deploy happy-soup install-packaged` from the deploy
progress file, looks up the commit history between each package's previous and target version in its own origin
repository, and includes any matched issue references per package in the notification.
EXAMPLES
$ sf simply cicd notify happy-soup --before-script --ci-job-stage pre-destructive --teams-webhook-url https://outlook.office.com/webhook/... --enabled
$ sf simply cicd notify happy-soup --after-script --is-final-job --notify-on-completion --ci-job-status success --teams-webhook-url https://outlook.office.com/webhook/... --enabled
FLAG DESCRIPTIONS
--alm-host=<value>
Hostname of the issue tracker, e.g. jira.example.com. The ALM provider builds each issue's link from it.
Jira links to https://<host>/browse/<KEY>. GitLab Issues links to https://<host>/<project-path>/-/issues/<number>,
with the host defaulting to the repository's host (CI_SERVER_HOST) and then gitlab.com. Falls back to alm.host in
.sfdevrc.json (or SIMPLY_ALM_HOST). A value with an http:// or https:// scheme, or a context path such as
jira.example.com/jira, is used as given. References are shown without links if no host can be resolved.

See code: lib/commands/simply/cicd/notify/happy-soup.js

Send a project deployment notification to Microsoft Teams, with issue-tracker integration.

USAGE
$ sf simply cicd notify project [--json] [--flags-dir <value>] [--after-script] [--alias <value>] [--before-script]
[--ci-commit-ref-name <value>] [--ci-environment-name <value>] [--ci-job-name <value>] [--ci-job-stage <value>]
[--ci-job-status <value>] [--ci-pipeline-id <value>] [--ci-pipeline-url <value>] [--ci-project-title <value>]
[--packaging-devhub <value>] [--enabled] [--alm-provider gitlab-issues|jira] [--alm-host <value>]
[--alm-project-path <value>] [--alm-project-key <value>] [--alm-base-url <value>] [--prev-installed-package-version
<value>] [--subscriber-package-version-id <value>] [--target-package-version <value>] [--teams-webhook-url
<value>...] [--debug]
FLAGS
--after-script Run the after-deployment notification logic.
--alias=<value> [env: SIMPLY_CICD_ALIAS] Alias of the target Salesforce org to query for the
previously installed package version. Must already be authenticated.
--alm-base-url=<value> [env: SIMPLY_CICD_ALM_BASE_URL] Deprecated: use --alm-host. Full URL that an
issue reference is appended to; overrides --alm-host when set.
--alm-host=<value> [env: SIMPLY_CICD_ALM_HOST] Hostname of the issue tracker, e.g.
jira.example.com. The ALM provider builds each issue's link from it.
--alm-project-key=<value> [env: SIMPLY_CICD_ALM_PROJECT_KEY] Project key used to search commit
messages for issue references. Overrides alm.projectKeys in .sfdevrc.json
(or SIMPLY_ALM_PROJECT_KEYS). Only used by prefix-keyed trackers such as
Jira.
--alm-project-path=<value> [env: SIMPLY_CICD_ALM_PROJECT_PATH] Project (group/project) whose issues
GitLab Issues references link to. Defaults to the repository the commits
came from: CI_PROJECT_PATH, or each upgraded package's own project for
happy-soup. Ignored by Jira.
--alm-provider=<option> [env: SIMPLY_CICD_ALM_PROVIDER] The issue tracker whose reference format to
look for in commit messages, and whose link format to use. Defaults to
alm.provider in .sfdevrc.json (or SIMPLY_ALM_PROVIDER), then jira.
<options: gitlab-issues|jira>
--before-script Run the before-deployment setup logic (resolves and records package
versions).
--ci-commit-ref-name=<value> [env: SIMPLY_CICD_CI_COMMIT_REF_NAME] The git branch or tag ref for this
pipeline run.
--ci-environment-name=<value> [env: SIMPLY_CICD_CI_ENVIRONMENT_NAME] The name of the target CI
environment.
--ci-job-name=<value> [env: SIMPLY_CICD_CI_JOB_NAME] The name of the current CI job.
--ci-job-stage=<value> [env: SIMPLY_CICD_CI_JOB_STAGE] The stage of the current CI job (e.g.
pre-destructive, post-destructive).
--ci-job-status=<value> [env: SIMPLY_CICD_CI_JOB_STATUS] The status of the current CI job: success,
failed, or canceled. GitHub Actions' failure and cancelled also work.
--ci-pipeline-id=<value> [env: SIMPLY_CICD_CI_PIPELINE_ID] The ID of the current CI pipeline.
--ci-pipeline-url=<value> [env: SIMPLY_CICD_CI_PIPELINE_URL] The URL of the current CI pipeline.
--ci-project-title=<value> [env: SIMPLY_CICD_CI_PROJECT_TITLE] The project title shown in the
notification card's heading.
--debug [env: SIMPLY_CICD_DEBUG] Enable verbose debug logging.
--enabled [env: SIMPLY_CICD_ENABLED] Whether the notification is actually sent.
Defaults to false so pipelines can gate this behind their own condition.
--packaging-devhub=<value> [env: SIMPLY_CICD_PACKAGING_DEVHUB] Alias of the Dev Hub used to look up
target package version information. Must already be authenticated.
--prev-installed-package-version=<value> The previously installed package version. Only needed if re-running
--after-script without having run --before-script first in the same job.
--subscriber-package-version-id=<value> The subscriber package version ID (04t...) being deployed, used to resolve
the target package version from the packaging DevHub.
--target-package-version=<value> The target package version. Only needed if re-running --after-script without
having run --before-script first in the same job.
--teams-webhook-url=<value>... One or more Teams webhook URLs to send the notification to.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Send a project deployment notification to Microsoft Teams, with issue-tracker integration.
Run once with `--before-script` at the start of a deployment pipeline (to record the previously installed and target
package versions), and once with `--after-script` at the end (to post a card to Teams for the job's
`--ci-job-status`).
The after-script posts a success card, with the tracked issues that shipped between those two versions, when the
`post-destructive` job succeeded; a failure card when the job failed; and a canceled card when it was canceled, at any
stage. Anything else, including no status, sends nothing. The before-script does nothing for a canceled job. The
status is matched without regard to case, and GitHub Actions' `failure` and `cancelled` count as `failed` and
`canceled`.
EXAMPLES
$ sf simply cicd notify project --before-script --ci-job-stage pre-destructive --alias my-org --enabled
$ sf simply cicd notify project --after-script --ci-job-stage post-destructive --ci-job-status success --teams-webhook-url https://outlook.office.com/webhook/... --enabled
FLAG DESCRIPTIONS
--alm-host=<value>
Hostname of the issue tracker, e.g. jira.example.com. The ALM provider builds each issue's link from it.
Jira links to https://<host>/browse/<KEY>. GitLab Issues links to https://<host>/<project-path>/-/issues/<number>,
with the host defaulting to the repository's host (CI_SERVER_HOST) and then gitlab.com. Falls back to alm.host in
.sfdevrc.json (or SIMPLY_ALM_HOST). A value with an http:// or https:// scheme, or a context path such as
jira.example.com/jira, is used as given. References are shown without links if no host can be resolved.

See code: lib/commands/simply/cicd/notify/project.js

Send a serialized JSON payload to a Microsoft Teams webhook.

USAGE
$ sf simply cicd notify teams --payload <value> --webhook-url <value> [--json] [--flags-dir <value>] [--enabled]
[--debug]
FLAGS
--debug [env: SIMPLY_CICD_DEBUG] Enable verbose debug logging.
--enabled [env: SIMPLY_CICD_ENABLED] Whether the notification is actually sent. Defaults to false so
pipelines can gate this behind their own condition.
--payload=<value> (required) The JSON payload to send to Teams, as a serialized string.
--webhook-url=<value> (required) [env: SIMPLY_CICD_WEBHOOK_URL] The Teams webhook URL to send the payload to.
GLOBAL FLAGS
--flags-dir=<value> Import flag values from a directory.
--json Format output as json.
DESCRIPTION
Send a serialized JSON payload to a Microsoft Teams webhook.
Posts a payload as-is to one or more Microsoft Teams incoming webhook URLs. Use this for custom notifications that
don't fit the built-in `notify project`, `notify happy-soup`, or `notify build` card templates.
EXAMPLES
$ sf simply cicd notify teams --payload '{"text":"Deployment complete"}' --webhook-url https://outlook.office.com/webhook/... --enabled

See code: lib/commands/simply/cicd/notify/teams.js