Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

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
Community showcase
Published in Bamboo

Bamboo 101 Video

G’day Community! As we gear up to introduce Bamboo Data Center to the world, we wanted to make sure that we shared a bit more about Bamboo, the product. Our team has put together an overview video ...

250 views 4 6
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