Closed alan-parry closed 5 years ago
I resolved this by adding variables to the BASH_ENV
Can you post the final code that you used to add the values to the $BASH_ENV
?
Also want to know how to do this if possible? @alan-parry
@iamtgray I ended up finding this solution: https://github.com/emmasax4/emmasax4.info/blob/ca5737d4c9de55f2a0947143a011e1b42a29968a/.circleci/generate-slack-message.sh#L17-L18 https://github.com/emmasax4/emmasax4.info/blob/ca5737d4c9de55f2a0947143a011e1b42a29968a/.circleci/config.yml#L45-L46
So this works nicely.
The URLs are not working anymore. I used something like this:
echo "export BUILD_OUTPUT_MESSAGE='My custom variable to use in Slack orbs'" >> $BASH_ENV
@victorboissiere I've updated the URLs in the comment above. Sorry about that. I try not to link to things directly on a branch, but rather on a SHA commit so the URLs persist, but I guess I got lazy on this one.
Still don't see how to include actual commit message, and not SHA of commit because it is useful to see actual commit message. No one knows commit SHA :smile:
@NenadJovicic Here's a cheat to get the commit message:
echo "export COMMIT_MESSAGE=\"$(git log --format=oneline -n 1 $CIRCLE_SHA1)\"" >> $BASH_ENV
source: https://discuss.circleci.com/t/git-commit-message-in-environment-variable/533/13
@KyleTryon yup, found it exactly there after asking question here :smile: thanks
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.