diff --git a/cmd/upgrade/upgrade.go b/cmd/upgrade/upgrade.go index 325fdad9..adf9a584 100644 --- a/cmd/upgrade/upgrade.go +++ b/cmd/upgrade/upgrade.go @@ -40,6 +40,11 @@ func NewCommand(clients *shared.ClientFactory) *cobra.Command { "", "If there are any, then you will be prompted to upgrade", "", + "In non-interactive environments (CI/CD, scripts, piped output),", + "update checks still run but the auto-update prompt is skipped.", + "To suppress update checks entirely on other commands, use", + "--skip-update or set SLACK_SKIP_UPDATE.", + "", fmt.Sprintf(`The changelog can be found at {{LinkText "%s"}}`, changelogURL), }, "\n"), Example: style.ExampleCommandsf([]style.ExampleCommand{ diff --git a/docs/guides/authorizing-the-slack-cli.md b/docs/guides/authorizing-the-slack-cli.md index a49a9aeb..0490b62b 100644 --- a/docs/guides/authorizing-the-slack-cli.md +++ b/docs/guides/authorizing-the-slack-cli.md @@ -63,6 +63,11 @@ Once a day, the Slack CLI checks for updates after running any command. When an Update notifications can be disabled using a command-line flag or an environment variable. When running any command, you can append the `--skip-update` or `-s` flag. Alternatively, you can set the `SLACK_SKIP_UPDATE` environment variable and assign it any value. +When the CLI runs in a non-interactive environment, such as inside a CI/CD pipeline or when the output is piped, the update check runs without the auto-update confirmation prompt. The notification text may still appear in command output, however. You can suppress the check entirely with the `--skip-update` flag or `SLACK_SKIP_UPDATE` environment variable to keep the automation output clean. + +:::info[The `--skip-update` flag and the `SLACK_SKIP_UPDATE` environment variable are intentionally ignored when running the `slack upgrade` command directly, since that command's purpose is to check for updates. +::: + ## CI/CD authorization {#ci-cd} Setting up a CI/CD pipeline requires authorization using a service token. Service tokens are **long-lived, non-rotatable user tokens** — they won't expire, so they can be used to perform any Slack CLI action without the need to refresh tokens. diff --git a/docs/guides/setting-up-ci-cd-with-the-slack-cli.md b/docs/guides/setting-up-ci-cd-with-the-slack-cli.md index c5c194d9..664bd704 100644 --- a/docs/guides/setting-up-ci-cd-with-the-slack-cli.md +++ b/docs/guides/setting-up-ci-cd-with-the-slack-cli.md @@ -58,6 +58,10 @@ You'll also need to accommodate requests from your network to a variety of hosts In addition, you'll need to obtain a service token to authorize your CI/CD setup. Refer to [CI/CD authorization](/tools/slack-cli/guides/authorizing-the-slack-cli#ci-cd) for more details about obtaining, using, and revoking service tokens. +### Disabling update checks {#disable-updates} + +In CI/CD pipelines, set a `SLACK_SKIP_UPDATE` environment variable to `1` (or pass `--skip-update` on each command) to prevent the CLI from checking for new versions on every run. See [Version update notifications](/tools/slack-cli/guides/authorizing-the-slack-cli#version-updates) for details. + Once you've done those things, you're ready to get started! Let's walk through an example. Let's take a look at the [Virtual Running Buddies sample app](https://github.com/slack-samples/deno-virtual-running-buddies). diff --git a/docs/reference/commands/slack_upgrade.md b/docs/reference/commands/slack_upgrade.md index 19b0bec7..7f1d8753 100644 --- a/docs/reference/commands/slack_upgrade.md +++ b/docs/reference/commands/slack_upgrade.md @@ -8,6 +8,11 @@ Checks for available updates to the CLI or the SDKs of a project If there are any, then you will be prompted to upgrade +In non-interactive environments (CI/CD, scripts, piped output), +update checks still run but the auto-update prompt is skipped. +To suppress update checks entirely on other commands, use +--skip-update or set SLACK_SKIP_UPDATE. + The changelog can be found at [https://docs.slack.dev/changelog](https://docs.slack.dev/changelog) ```