Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

slack-notify v1.0.0 now fails on message that previously succeeded

We have been using slack-notify to post messages about deployment status.  I recently attempted to upgrade from 0.3.6 to 1.0.0, and now an error occurs.

Here is an example message that was working pre-upgrade:

[fake/stage]: Deployed stage-v1.1.0-SC21.03.2-clarus-21.03.2 (Shaun Dishman)

Do I need to escape the square brackets or something?  Or perhaps the forward-slash?

 

I am attaching a screenshot of the pipeline error.

For now I'm going to downgrade the pipe version, but it's a bit disappointing/frustrating to fail in an unexpected way.

Thanks in advance for assistance.

 

bitbucket-pipelines-slack-error.png

1 answer

0 votes

@Shaun Dishmanthanks for raising this question!

Could you please, share the pipeline of how you're using the pipe?

It is important for us to see how you pass variables to the pipe. I see root cause can be there.

Regards, Galyna

I figured you might ask for that.  We use it in an `after-script` block.  I'll just include that block for brevity.  If you need the whole pipeline I can provide it, although I think it would just add a lot more noise:

 

after-script: &notify-slack
- apk add -q --no-progress curl jq
- export BITBUCKET_TRIGGERER_USERNAME=$(curl -X GET -g "https://api.bitbucket.org/2.0/users/${BITBUCKET_STEP_TRIGGERER_UUID}" | jq --raw-output '.display_name')
- export BUILD_TAG=$(/root/deploy/deploy_tools/simple/build_tag "$BITBUCKET_CLONE_DIR" "$BITBUCKET_DEPLOYMENT_ENVIRONMENT")
- if [[ $BITBUCKET_EXIT_CODE -eq 0 ]]; then export MESSAGE="Deployed ${BUILD_TAG}"; else export MESSAGE="Failed deployment of ${BUILD_TAG}"; fi

- pipe: atlassian/slack-notify:0.3.6
variables:
WEBHOOK_URL: $SLACK_WEBHOOK_URL
MESSAGE: '[${CLIENT_NAME}/${BITBUCKET_DEPLOYMENT_ENVIRONMENT}]: ${MESSAGE} (${BITBUCKET_TRIGGERER_USERNAME})'
# DEBUG: "true"

@Shaun Dishmanyes, that is enough, thanks! I guess I can see the root cause - you're using `[` `]` characters, that are considered as structure.

Looks like this is a bug, starting from 1.0.0 version.

Temporary workaround for you,  if you need the pipeline to succeed just right now : you can downgrade to previous versions. Unfortunately, I don't see other options for this case.

I'll notify once we release bugfix for your case.

Regards, Galyna

Thanks for the investigation.  As I mentioned in my initial summary, I've already downgraded back to 0.3.6 and it works fine.  But it would be nice to stay abreast of the latest updates, so I'll be interested to hear when a fix comes out.

Like Galyna Zholtkevych likes this

@Shaun Dishman could you try use the same version but adding extra quotes? So your variable could look like this:

MESSAGE: '"[${CLIENT_NAME}/${BITBUCKET_DEPLOYMENT_ENVIRONMENT}]: ${MESSAGE} (${BITBUCKET_TRIGGERER_USERNAME})"'

Thanks! Sorry for late response .

It is the question how pipeline infra is parsing things. In bash scripts they are understood differently, than in python.

That appears to work.  I expected it to show a set of double-quotes in the resultant slack message, but it doesn't.

 @Shaun Dishman yes, because this is the way how pipeline parses the variables. We will update documentation

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

528 views 15 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you