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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,701
Community Members
 
Community Events
176
Community Groups

pass artifact name to argument for shell script

I have a plan that generates a single artifact. It has some <random name>.bit

In another plan I import this artifact. I need to pass the name and full path of that artifact to a script. I see that you can include arguments when calling a script but I don't know the variable name for the artifacts. I read up on the bamboo variables and did not see any mention of artifacts. 

I could use shell tricks to identify the artifact name and full path but I believe bamboo should have the exact details. 

1 answer

1 accepted

0 votes
Answer accepted

Hi @Jeremiah Alfrey

You are correct, there is no variable for that specifically. Even though that is the case,  we can easily build paths with the following steps:

  1. Set a Destination path in your artifact download task (e.g. downloaded_artifacts). 
  2. All file paths could be built with:
    ${bamboo.build.working.directory}/downloaded_artifacts/*

Does that solution work for your case?

 

Assuming you consider this should be a feature in Bamboo, please feel free to raise it to our development team through https://jira.atlassian.com/issues

  1. Log in with your Atlassian user
  2. Click the Create button in the top of the page
  3. Select Bamboo (BAM) on Project field
  4. Select Suggestion on Issue Type field

 

I hope that helps.

When I download an artifact from other steps. It seems to come with the complete path where it was created in the previous project. In addition I am using wild card match to retrieve the artifact. This causes me to not know the complete file name. 

some dir/some sub dir/output dir/some weird filename.bit

all I know is I got *.bit

Got it! In this case, if the artifact path or filename does NOT have spaces I would use something like:

$(find ${bamboo.build.working.directory}/downloaded_artifacts/ -name *\.bit)

(i) This line could be used as an argument of your script.

 

If the artifact path or filename has spaces, I would use this to get them quoted:

find ${bamboo.build.working.directory}/downloaded_artifacts/ -name *\.bit > file
$(while read i; do echo \'$i\'; done < file)

(i) In this second example, the second line could be the argument of your script.

 

Let me know if that makes sense.

That is essentially what I had to do. My paths do not have spaces. I only used it as an example for easy reading. 

Like Daniel Santos likes this

I'm glad you have this solved. 
In case you want to open the feature request, please let me know if you need any help.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events