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.
@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: ¬ify-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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That appears to work. I expected it to show a set of double-quotes in the resultant slack message, but it doesn't.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Shaun Dishman yes, because this is the way how pipeline parses the variables. We will update documentation
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.