You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hello folks, i have to retrieve the git tag of the branch and save it to a variable, so i can name an artifact with thata value.
here is my pipeline step:
Hello @Mattia Montani ,
Welcome to Atlassian Community!
Checking your yml file I think the syntax you have used is slightly wrong. Please refer to the example below on how to save the output of a command into an environment variable :
export GIT_TAG="$(git describe --tags --always --abbrev=0)"
You can replace your current command with the one above and the GIT_TAG env variable should have its value updated with the string returned by the git command.
Hope that helps! Let me know in case you run into any issues.
Thank you, @Mattia Montani .
Hi Patrick, tnx replying. It works but i still have an issue related to naming the zip file as the output of the git command.
It give me this error:
the file ".zip" doesnt exist.
but when I try to echo the env variable it has the correct value.
Can you please tell me if the syntax is correct?
Thank you and Kind regards
The syntax for creating the naming of the zip file is correct, however I'm afraid environment variables are currently not yet supported to be referenced in the artifacts section, as you did in :
We have a feature request to implement this functionality though, which you can find in the following link :
I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.
While this feature is not implemented, you can reference the file using glob patterns, like the below example :
This would get any file with the extension .zip in the current directory and make it an artifact. If you have more than one zip file in that path, they would all be included in the artifact.
If you want just one specific zip file as your artifact, you can create a new folder and put the zip file in there, and reference this folder in the artifacts section :
Let me know in case you have any questions.