Giter Club home page Giter Club logo

slack-orb's Introduction

Slack Orb CircleCI Build Status CircleCI Orb Version GitHub license CircleCI Community

Send Slack notifications from your CircleCI pipelines even easier with Slack Orb 4.0

What are Orbs?

Usage

Setup

In order to use the Slack Orb on CircleCI you will need to create a Slack App and provide an OAuth token. Find the guide in the wiki: How to setup Slack orb

Use In Config

For full usage guidelines, see the Orb Registry listing.

Templates

The Slack Orb comes with a number of included templates to get your started with minimal setup. Feel free to use an included template or create your own.

Template Preview Template Description
basic_success_1 basic_success_1 Should be used with the "pass" event.
basic_fail_1 basic_fail_1 Should be used with the "fail" event.
success_tagged_deploy_1 success_tagged_deploy_1 To be used in the event of a successful deployment job. see orb usage examples
basic_on_hold_1 basic_on_hold_1 To be used in the on-hold job. see orb usage examples

Custom Message Template

  1. Open the Slack Block Kit Builder: https://app.slack.com/block-kit-builder/
  2. Design your desired notification message.
  3. Replace any placeholder values with $ENV environment variable strings.
  4. Set the resulting code as the value for your custom parameter.
- slack/notify:
    event: always
    custom: |
      {
        "blocks": [
          {
            "type": "section",
            "fields": [
              {
                "type": "plain_text",
                "text": "*This is a text notification*",
                "emoji": true
              }
            ]
          }
        ]
      }

Branch or Tag Filtering

Limit Slack notifications to particular branches with the "branch_pattern" or "tag_pattern" parameter.

A comma separated list of regex matchable branch or tag names. Notifications will only be sent if sent from a job from these branches/tags. By default ".+" will be used to match all branches/tags. Pattern must match the full string, no partial matches. Keep in mind that "branch_pattern" and "tag_pattern" are mutually exclusive.

See usage examples.

Thread Messages

Post replies in threads with a special parameter thread_id. Including this parameter in the notify command reference stores the id of the message in a small portion of bytes in cache. Any subsequent invocation of the command with the same value for thread_id will post a reply to the initial message in a thread. Example:

- slack/notify:
      event: always
      channel: engineering
      thread_id: testing
      custom: |
        {
          "blocks": [
            {
              "type": "section",
              "fields": [
                {
                  "type": "plain_text",
                  "text": "*Tests started.*",
                  "emoji": true
                }
              ]
            }
          ]
        }
- slack/notify:
      event: always
      channel: engineering
      thread_id: testing
      custom: |
        {
          "blocks": [
            {
              "type": "section",
              "fields": [
                {
                  "type": "plain_text",
                  "text": "*Tests finished.*",
                  "emoji": true
                }
              ]
            }
          ]
        }

FAQ

View the FAQ in the wiki

Contributing

We welcome issues to and pull requests against this repository!

For further questions/comments about this or other orbs, visit CircleCI's orbs discussion forum.

slack-orb's People

Contributors

7wikd avatar atanass avatar brandon-leapyear avatar ericribeiro avatar felicianotech avatar fumikony avatar ganezasan avatar gsaslis avatar hennaabbas avatar iynere avatar kyletryon avatar lokst avatar nithinrg avatar orbin avatar ozomer avatar parikshit-hooda avatar pbaderia01 avatar peeja avatar rail44 avatar rmacklin avatar samsalisbury avatar scwheele avatar shivam175 avatar stig avatar sudiptog81 avatar sugarshin avatar the-pat avatar thomasmost avatar tommybo-entur avatar wyardley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slack-orb's Issues

Error `$BASH_ENV: ambiguous redirect` on setting success status

I'm trying to use the slack orb in a centos based image, where I am using https://www.softwarecollections.org/en/ and the scl enable command-line tool, which basically does unset BASH_ENV.

as such, https://github.com/CircleCI-Public/slack-orb/blob/master/src/%40orb.yml#L126 and https://github.com/CircleCI-Public/slack-orb/blob/master/src/%40orb.yml#L131 fail in my jobs, with the error:

$BASH_ENV: ambiguous redirect

I've seen that there is an additional environment variable being added to the builds: CIRCLE_SHELL_ENV. I haven't found how it's added still, but I was wondering if it would make sense to use this instead?

It somehow does have the correct value inside my container (i.e. it has picked up the change that scl enable did).

Any hints or other workarounds welcome here!

[Request] Support for message-attachments "image_url"

We would like to add images to our CircleCI slack notifications using the orb. Right now when we include a giphy URL to the message, it does not render the gif in Slack.

Request to add support for Slack message-attachment image_url

https://api.slack.com/docs/message-attachments

version: 2.1
orbs:
  slack: circleci/[email protected]
jobs:
  fireworks:
    machine: true
    steps:
      - slack/notify:
          message: "https://giphy.com/gifs/fireworks-IjmMzurYulKEw"
          webhook: ${SLACK_WEBHOOK}

Documentation/examples in readme use old version of orb

Orb version

1.0.0

What happened

The documentation in this repo's readme do not work, because they use the 1.0.0 orb. For instance, success_message in the status call does not work with the 1.0.0 orb.

Expected behavior

The examples should use the latest orb, such that they provided examples in the readme actually work.

Unable to send from tag build

Orb version

v3.4.0

What happened

Error "Current branch is not included in only_for_branches filter; no status alert will be sent" is output. This occurs with config:

      - slack/status:
          channel: XXXXXXX
          failure_message: 'failed'
          fail_only: true
          only_for_branches: master

This happens because on a tag build, $CIRCLE_BRANCH is not set, so the ORB fails to correctly match the branch name.

Expected behavior

The slack message should be sent.

Let users set custom messages on the status command

Hello

This is a follow-up of PR #7.

I'd would like to post a message on Slack at the end of the CI workflow that tells us whether it has failed or succeeded. The status does exactly that except that the generic hard-coded message doesn't carry enough information for us to be useful. So I just would like to augment the message with some additional information.

In the PR #7 @iynere pointed out to the notify command, however this one doesn't natively handle the success or failure status. So I first thought implementing it this way :

            - slack/notify:
                message: ":red_circle: $MESSAGE_FAIL"
                color: "#ED5C5C"
                when: on_fail
            - slack/notify:
                message: ":tada: $MESSAGE_SUCCESS"
                color: "#1CBF43"
                when: on_success

Unfortunately this doesn't pan out because the when attribute can only be used with the run step.

So that means that an additional environment variable should be set depending on the status of the workflow by a run step and then be used in the notify message. But that's basically reimplementing what the status command already does, which defeats the purpose of orbs.

As a consequence, the only way to add that feature in the status command in a convenient way for users would be let them specify the message to display both in the success and in the failure case.

@iynere @eddiewebb let me know your thoughts about this.

Regards

Support for changed build statuses

Feature request

We do many builds a day, and use Slack for visibility on the status of those builds. A message every time the build succeeds is not particularly useful information, as this is the default, and the significant majority of our builds succeed. Generally, we want notifications for:

  • Build failures
  • A build success the first time after a failure

The former tells us we need to go and fix something, and continued notifications of failures make it less likely that it will be forgotten. The latter notifies those who may be interested in the project, but not involved in the fixing of the build, that everything is ok once again.

It would be great to have the notion of whether the build status has changed from the last run, to enable workflows like this.

Would be nice to show the branch, author, and have an opportunity to rerun

This is all functionality that came with the CircleCI 1.0 Slack webhook notifier -- Are there plans to add these back in?

A success or fail should include the:

  • commit hash
  • commit message
  • commit author
  • build time (?)

and in addition to the Visit Job button, there should be a Rebuild button for failures

Thank you!

mentions don't work with user groups

currently, mentions only work with individual users' UUIDs. User Group UUIDs do not resolve to a correctly formatted @mention after passing through the Slack API.

hypothesis:

  • all users' UUIDs start with U, whereas all User Group UUIDs start with S
  • in which case, we will have to build out some shell scripting to check if a mention is an individual or a User Group, and, if a user group, query the Slack API to get all its members and add them to the list of mentions

only_for_branches filter not working in notify-on-failure

Orb version

3.4.2

What happened

I am trying to limit failure notifications to test and master branches only. I'm using the following job syntax
- slack/notify-on-failure: only_for_branches: "test,master"
edit - can't get my code to format properly here but the only_for_branches is on the next line and indented correctly

When I force a failure on a feature branch I still get a slack alert informing me of the error.

Expected behavior

I would expect this to limit the failure alerts just to test and master. I have tried a number of different ways to input the string (single quote, double quote, no quotes, spaces, no spaces) but I get the same behaviour each time.

[Question] Is it possible to send markdown messages

Slack supports both "standard" text as well as markdown message type for richer messages.
Using markdown to format the messages can be quite powerful, particularly using things like codeblocks, but especially handling the "```" characters for text that is parsed and passed around is quite complex.

  1. Is it possible to use markdown by default in the slack orb
  2. Are there any examples available to save loads of folks experimentation time?

Thanks

Include custom variables in slack message

Orb version

3.3.0

What happened

I'm trying to include custom variables which are established earlier in my build in the slack message. To pass these between previous steps I do

echo "export GIT_COMMIT_MESSAGE=$GIT_COMMIT_MESSAGE" >> variables/var.sh

then for steps where I require these I first do:

source ~/work/variables/var.sh

This works fine but I don't see a way to bring these in to my slack orb steps. Is there a fix or a workaround you can suggest? Thanks!

Expected behavior

My message should include the variable values, instead they are blank.

slack/notify on fail?

How to run slack/notify on fail builds only?
I can run it in slack/status but it is not possible to set a custom message there.

Proposal: To allow a custom action (button) on messages

Proposing

To have the possibility of adding custom actions - buttons - to notifications by adding 2 new parameters:

  • custom_action_text: string defaults to ""
  • custom_action_url: string defaults to ""

If both parameters are set, the API call to Slack would include an extra action

Use cases

  • To provide an easy and UI appealing way of visiting a recently deployed application
  • To provide an easy an UI appealing way of visiting the SonarCloud report of a finished build

Happy to provide with a PR if you are happy to see this implemented

Thanks for your work!

Documentation for approval command

Orb version

2.5.0

This is not a bug report as much as a feature request. I found the approval command in the source, but not the documentation.

Add a [suppress_automatic_mentions] flag

Hello,

I'm using this orb so that I can be notified only when projects I build succeed or fail in Slack. This works fine. But I am mentioned in the message regardless of the success or failure of the build.

This seems minor, but philosophically I want to set things up so that I receive a visible alert in Slack whenever I break a build. If the build succeeds, I still want to know about it - but I don't necessarily need Slack to notify me. Visually, I should be able to look at my build channel and tell if there are broken builds in there just but checking to see if I'm mentioned; if there are no mentions (remember this is my personal build channel) but the channel is highlighted, I know that there are new messages but those messages are all green builds. +1 for productivity.

To achieve this, I'd like to add the ${SLACK_MENTIONS} on the failure_message, but NOT the success_message. But the orb currently appends mentions to all messages regardless of whether they are successful or failure.

Will you accept a pull request for this?

[Suggestion]: add a limit to amount of messages per job

Hi all,
As of now, there is no parameter to limit the amount of messages sent by the Slack Orb. This is a bit of an inconvenience for large runs with several jobs and nodes, as there are several slack notifications for the same problem. Would it be possible to add a parameter to limit the amount of messages sent per run?

Setting the webhook in config.yml doesn't seem to work

I did not set an environment variable but I had the webhook URL configured as below.

I still got the NO SLACK WEBHOOK SET error:
Please input your SLACK_WEBHOOK value either in the settings for this project, or as a parameter for this orb.

Adding the webhook URL as an environment variable fixed it.

My config.yml:



orbs:
  slack: circleci/[email protected]

jobs:
  build:
    docker:
        - image: circleci/node:8.9.4
    resource_class: medium+
    steps:
       - checkout
       - run:
          name: test
          command: npm test
       - slack/status:
          webhook: "https://hooks.slack.com/services/P024FC9RY/B0H99CHGU/dOrZ0mA2ZekCw0bvmWtbC8Hk"```

better clarify dependencies

there are inherent dependencies in the orb, such as using bash shell and needing curl. we should either better publicize this fact, or else add an executor so the dependencies get pre-bundled.

can we add support to slack file upload?

Orb version

2.1

What happened

There is no way to upload a file to slack

Expected behavior

slack/upload command should be available

How I do today

Install slack cli

brew install jq && curl -O https://raw.githubusercontent.com/entria/slack-cli/master/src/slack && chmod +x slack

upload file

slack file upload \
              --file packages/app/android/app/build/outputs/apk/alpha/app-alpha.apk \
              --filetype apk \
              --title "production - ${CIRCLE_TAG}" \
              --comment "New production apk available! - ${CIRCLE_TAG}" \
              --channels '#channel'

[Request] enable sending slack/status using container without bash installed

Orb version

slack: circleci/[email protected]

What happened

I am using circleCI to run a smoke test within a prebuilt container (a rails app). The container
is based on Alpine but is also run as a non-root user (by design). Bash is not available and
the image, deliberately prevents further installation (i.e.apk update && apk add bash not permitted).

Relates to

#66

Expected behaviour

It would be great if it worked with whatever shell, but particularly the standard Alpine POSIX shell

Using `failure_message` in `status` seems to set only the `text` field of attachment, not the `fallback` one

Using failure_message in status seems to set only the text field of attachment, not the fallback one.

It is a problem when using it with bots such as hubot-slack.

Orb version

2.2.0

What happened

I'm using the slack/status command with failure_message.
It seems that the current implementation sets only the text field of attachment, not the fallback one.

\"fallback\": \"A job has failed - $CIRCLE_BUILD_URL\", \

It is a problem when using it with bots such as hubot-slack.

The hubot-slack does not respond message sent by the status command because it parses the fallback field if a message has an attachment.

https://github.com/slackapi/hubot-slack/blob/e3acc28f224cb8fb60b2288b1395c25c063b27b2/src/message.coffee#L104-L109

It's a very confusing behavior.
I wasted time thinking that the regular expression parsing the message was wrong.

Expected behavior

The text and fallback field should set to the same value or contain the failure_message parameter.

It may be a hubot-slack problem, but the notify command can set the message in the fallback field, but it does not seem to equal the text one.

\"fallback\": \"<< parameters.message >> - $CIRCLE_BUILD_URL\", \
\"text\": \"<< parameters.message >> $SLACK_MENTIONS\", \

How to fix it?
I will be happy to fix it if we can agree on the policy.

Thanks!

enable setting channel option

Orb version

2.5.0

What happened

I can't specify the channel

Expected behavior

It should be able to specify the channel

How I do today:

slack chat send "ok"  --channel '#mychannel'

Correct flow to check BASH first

Orb version

2.1

What happened

The flow for status command does not look accurate. In the current flow we are first exporting env vars and then checking if bash exists. But if bash doesn't exist the env var export steps don't make much sense.

Expected behavior

The flow, in my opinion, should be Check Bash Exists -> Check curl exists -> Export Env Vars -> Send notification script

Add support to mention custom user groups

Orb version

3.4.0

What happened

Custom user groups do not actually get mentioned with the @group_name. Additional handling is required for that.

Expected behavior

Custom user groups get mentioned.

https://api.slack.com/docs/message-formatting#variables
For paid accounts, there is an additional command for User Groups that follows the format !subteam^ID|@handle. (subteam is literal text. ID and handle are replaced with the details of the group.) These indicate a User Group message, and should cause a notification to be displayed by the client. User Group IDs can be determined from the usergroups.list API endpoint. For example, if you have a User Group named happy-peeps with ID of S012345, then you would use the command !subteam^S012345|@happy-peeps to mention that user group in a message.

[Request] notify-on-recovery

It would be helpful to be notified when a job has a recovered from a failed state.

Currently, if you are setup to only notify-on-failure you have to manually hunt through jobs to verify that subsequent builds have succeed. This is particularly painful for orgs with many jobs.

I would love to take a crack at this, but I'm not sure its possible to get the previous job's status. Is this possible?

When you will release the PR #67?

Hey guys!
I am working with the Slack Orb and it is amazing.

I would like to use the parameter channel but the last version of Slack Orb in Circle CI does not allow me to use it :c
Just wondering when the feature will be available?

Thank you !

slack/status does not include mentions for custom messages

Orb version

3.2.0

What happened

Though the slack/status command accepts mentions parameters, its notification does not include the mentions at all.

Sample config:

steps:
  - checkout
  - slack/status:
      success_message: OK
      mentions: ryym

Received message:

tmporary___ryyms-slack_Slack

Expected behavior

It sends a message with the specified mentions, like the slack/notify command does.

New Release?

Hey

When will the next release go out? I need access to the success_only flag

Add Then Replace Executor

This orb includes a single executor called alpine. It uses the Docker imagecibuilds/base, which is one of my Alpine-based images from my cibuilds project. We now have a suitable replacement, cimg/base.

According to our Orbs Best Practices, we should have a default executor names executor, which this orb currently does not.

The route I see forward here is:

  • PR #129 - add a default executor that contains the cimg/base image
  • PR #130 - remove the alpine executor in the future

Have a newly Fixed status

Orb version

3.2

What happened

I am using circleci/[email protected]. I want to be notified by slack for failures & fixed builds only. However it seems like there is only a parameter/command for failed_only builds.

Expected behavior

This seems to be an option through the CircleCI chat notification settings but not through the Orb. How can i get slack notification through the orb for Failed and Fixed but no regular success?

slack orb doesn't work with circleci local execute

Orb version

@3.4.2

What happened

When running:

circleci config process .circleci/config.yml > process.yml

I get the error:

Error: 
Configuration errors: 1 error occurred:

* In step 2 definition: step type "slack/status" is not a valid type

Do orbs in general work locally? If not, how would I get it to work? Thanks!

Sample code

version: 2.2

orbs:
  slack: circleci/[email protected]

jobs:
  name_of_my_job:
    docker:
      - image: circleci/any # doesn't matter which
    steps:
      - run:  exit 0
      - slack/status:
          fail_only: true
          command: |
            echo works

shell verification shouldn't be based on $SHELL

Depending on the Docker image we use, this orb can fail even if bash is installed.
For example with a Docker image like this:

FROM alpine:3.7

RUN apk --no-cache add bash\
                       ca-certificates\
                       make

WORKDIR /app

ENTRYPOINT ["make"]
docker run --rm -it --entrypoint /bin/sh captainpatate/make-dnscontrol:v0.2.7 
/app # echo $SHELL

/app # echo $BASH
docker run --rm -it --entrypoint /bin/bash captainpatate/make-dnscontrol:v0.2.7 
bash-4.4# echo $SHELL
/bin/ash
bash-4.4# echo $BASH
/bin/bash

Even if we use bash, I guess some Docker entrypoint trick makes $SHELL report the login shell instead of the real shell. It would be better to use the presence of the variable $BASH to verify that we are indeed inside a Bash shell.

Custom mention

Hi thanks for implementing this 😄

Was wondering if we can change the mentions parameter based on the author.

I want to notify the user who has triggered the job 👀

Thanks,

Clarify use of custom messages

Raised from comments in #7, we should clarify how folks might override the default messages.

This ticket is to track convo for improving docs or orb.

[request] add a `success_only` parameter to `status` command

Hi guys,

Our use case is that we are doing multiple flavored deploys from a single repo. If there is a build or deploy failure, we want to message a Slack channel for the devs to fix it. fail_only works for that. Devs don't need to be bothered if there is no error. Great.

But if there is a successful deploy, we want to notify the testing and reliability people, in a different channel. BUT the testers don't care about failures. They only want to know when something new has successfully been deployed. And there is a lot of volume so controlling noise is important.

I have glanced at the source and honestly I could probably edit it in myself in about 5 minutes. Just an if statement with an early return, following the current pattern. But I am loathe to fork this and get into the orb business, and I suspect that there will be others out there who will need this feature just as much as I do. So I want to approach you first about getting a success_only parameter baked into your standard orb.

Or if there is an easy workaround I would love to know!

Thanks in advance for any help.

channel parameter is not described correctly.

Orb version

2.1

What happened

Description of channel parameter is very vague as it may confuse user between Channel Name & Channel Id. 'channel settings' in description indicates that channel is some sort of an object which i think is not sufficient to let the user know about correct convention of channel parameter.

Expected behavior

There must be concise distinction about channel parameter whether it is Channel ID or Channel Name. i think it is Channel ID as explained in src/examples/notify.yml. So there must be proper description for channel parameter in each file of repo.

Send slack notification only on failed builds on master branch

Hi there,

our team's workflow is such that we don't want slack notifications for all the builds on pull requests.

We do want to get notified on slack if a build fails on master branch only (or maybe even set of branches).

As far as I have seen, this use case is not currently covered by this orb. So:

  • Am I wrong?
  • If not, would you agree this is a valid use case ?

Getting "Cannot find a definition for command named status" error

Orb version

3.4.2

What happened

#!/bin/sh -eo pipefail
# Error calling workflow: 'build-deploy'
# Error calling job: 'build-deploy-stg'
# Error calling command: 'notify'
# Cannot find a definition for command named status
# 
# -------
# Warning: This configuration was auto-generated to show you the message above.
# Don't rerun this job. Rerunning will have no effect.
false

Exited with code exit status 1
CircleCI received exit code 1

I get the above error when trying to run CI with the below config.
I have checked locally that the config is valid using circleci config validate

version: 2.1
orbs:
  slack: circleci/[email protected]
executors:
  build_container:
    docker:
      - image: circleci/python:3.7.1-node
commands:
  build:
    parameters:
      target:
        type: string
    steps:
      - run: mkdir -p /tmp/workspace
      - checkout
      - run:
          name: install dependencies
          command: yarn
      - run:
          name: test
          command: yarn test
      - run:
          name: setup contentful
          command: |
            echo "export CONTENTFUL_SPACE_ID=$<< parameters.target >>_CONTENTFUL_SPACE_ID" >> $BASH_ENV
            echo "export CONTENTFUL_ACCESS_TOKEN=$<< parameters.target >>_CONTENTFUL_ACCESS_TOKEN" >> $BASH_ENV
      - run:
          name: build
          command: yarn build $CONTENTFUL_SLUG
      - run: cp -r packages /tmp/workspace
      - persist_to_workspace:
          root: /tmp/workspace
          paths:
            - packages
  deploy:
    parameters:
      target:
        type: string
      bucket:
        type: string
    steps:
      - attach_workspace:
          at: /tmp/workspace
      - run:
          name: setup awscli
          command: |
            sudo pip install awscli
            echo "export AWS_ACCESS_KEY_ID=$<< parameters.target >>_AWS_ACCESS_KEY_ID" >> $BASH_ENV
            echo "export AWS_SECRET_ACCESS_KEY=$<< parameters.target >>_AWS_SECRET_ACCESS_KEY" >> $BASH_ENV
      - run:
          name: put resources to s3
          command: |
            cd /tmp/workspace
            aws s3 sync packages/lp/$CONTENTFUL_SLUG/public s3://<< parameters.bucket >>/lp/$CONTENTFUL_SLUG --delete --cache-control "public, max-age=0, must-revalidate"
            aws s3 sync packages/lp/$CONTENTFUL_SLUG/public/cms_assets s3://<< parameters.bucket >>/cms_assets --exclude "*page-data/*" --cache-control "public, max-age=31536000, immutable"
            aws s3 sync packages/lp/$CONTENTFUL_SLUG/public/cms_assets/lp/$CONTENTFUL_SLUG/page-data s3://<< parameters.bucket >>/cms_assets/lp/$CONTENTFUL_SLUG/page-data --cache-control "public, max-age=0, must-revalidate"
            aws s3 rm s3://<< parameters.bucket >>/lp/$CONTENTFUL_SLUG/cms_assets --recursive
  build-stg:
    steps:
      - build:
          target: STAGING
  deploy-stg:
    steps:
      - deploy:
          target: STAGING
          bucket: myBucket.org
  notify:
    parameters:
      webhook:
        type: string
    steps:
      - slack/status:
          failure_message: ':cms: A $CIRCLE_JOB job has failed! :cms:'
          only_for_branches: master
          webhook: << parameters.webhook >>
jobs:
  build-deploy-stg:
    executor: build_container
    steps:
      - build-stg
      - deploy-stg
      - notify:
          webhook: http/mywebhook
  delete-prod:
    executor: build_container
    steps:
      - delete-prod
  delete-stg:
    executor: build_container
    steps:
      - delete-stg
workflows:
  version: 2
  build-deploy:
    jobs:
      - build-deploy-stg
    triggers:
      - schedule:
          cron: '0 0 * * 3'
          filters:
            branches:
              only:
                - master
                - circleci-test

Expected behavior

No error is raised.

using with windows executor

Orb version

3.4.0

What happened

On all my builds, I have

      - slack/notify-on-failure:
          only_for_branches: master

I'd like to also add this for my Windows executor.


  build-windows:
    executor:
      name: win/default
      size: "medium"
    steps:
      - checkout
      - run: go test ./...
      - slack/notify-on-failure:
          only_for_branches: master

This fails with the following error:

Provide error if non-bash shell
#!powershell.exe -ExecutionPolicy Bypass
if [ ! -x /bin/bash ]; then
  echo Bash not installed.
  exit 1
fi

I understand why the error is happening. But I'm not sure if there's an alternative way to accomplish this. Any ideas?

slack/notify in a Workflow: fail_only: "true" reports to Slack also for green jobs

I installed the Orb today, and tried it in a PR. The installation instructions are good.

I use workflows, like this (fragment):

orbs:
  slack: circleci/[email protected]

version: 2.1
jobs:
  # more jobs here...
  alert_me:
    docker:
      - image: circleci/node
    # https://github.com/CircleCI-Public/slack-orb
    steps:
      - slack/status:
        fail_only: "true"

workflows:
  version: 2
  test:
    jobs:
      - checkout_code
      - frontend:
          context: org-global
          requires:
            - checkout_code
      - backend:
          context: org-global
          requires:
            - checkout_code
      - alert_me:
          context: org-global
          requires:
            - backend
            - frontend

Expected: What I expected was that the Slack notification would not fire, as the Status was green.

Actual: But, the Slack channel received notifications such as "A job has succeeded!".

Does this note

Must be last step in job

mean I'm trying to use it wrong?

[Question] Is it easy to check source code changes and CircleCI Orb Registry releases?

Orb version

  • 3.2.0 or higher

What happened

It is a question.
Although I usually use slack-orb in production code,
it is difficult to confirm the changes because there is a fatal difference between the version described in orbs and the version control of the source code.

Do you think about measures?

Expected behavior

I hope to be able to easily see the source code and changes in the CircleCI orb registry.
For example, unify the release version of GitHub Repository and the version of CircleCI Orb Registry.

False Failure -> Passing steps & yet Orb Reports failure

Orb version

slack: circleci/[email protected]

What happened

All 3 parts of the workflow are passing, yet orb is reporting a failure?
ORB-failure-msg

circle-ci-passing-2

https://app.circleci.com/pipelines/github/cappetta/CyberRange/353/workflows/b5e7d86b-fa38-4af2-9f8c-51353d335194

CircleCI config file: https://github.com/cappetta/CyberRange/blob/master/.circleci/config.yml

Expected behavior

This should be posting as success

Other notes:

I've simplified my circleci config file to be a basic test with commit, still failing...

slackorb-status

Yet CircleCi is all green. Not sure why this varies across multiple products. I also notice the compare url environmental variable is filled out yet posting in slack as empty. that's a different 3rd party orb bug. Do tell if this orb contains that feature.

circleci-job-all-green

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.