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

How do I access a task log via script after an Ant task executes

saywhat42 January 19, 2015

I have set up a Bamboo Job that has 4 tasks

Source Code checkout

Ant

Script (bash with grep)

Ant

The script file needs to parse the log created during 1st Ant task, then if a string is present (return 0) launch the next Ant task. I am unsure how to read the log - my script executes but exits with a status of 2 (error from grep)

I tried hard coding in the url for the log, but that did not work, so wondering if I can access the log at this stage of processing.

Any thoughts, pointers, suggestions ??

Thanks, Peter

 

4 answers

1 vote
Krystian Brazulewicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 20, 2015

Peter, what do you mean by 

I'm unsure how to read the log

Do you know the location of the log file produced by ant?

0 votes
saywhat42 January 20, 2015

No, I am unsure where the log is. I thought it was at the result url, but you have to drill down on that. I am running on a linux agent, is there a standard ant log location  I can access to parse??

Thanks very much for your help, I am new at this stuff ...

 

Cheers

Krystian Brazulewicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 21, 2015

I can't tell where your logs are. You're in control where those logs are created. Get the ANT manual, check the build.xml file and it will be clear.

saywhat42 January 21, 2015

Yes, found it - thank you very much - thought about what you said and then it made sense. Appreciate your assistance.

0 votes
saywhat42 January 20, 2015

Thanks, I have switched it to be like you suggested - can I access the log file (feed it to an inline bash script) using $BAMBOO_BUILD_RESULTS_URL , or is another parameter correct?

 

0 votes
rsperafico
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 20, 2015

Hello Peter,

Thank you for your question.

I would suggest you on splitting your tasks into two jobs, so when running the Script task you can guarantee the previous job has build successfully and you will be able to "grep" its generated log.

Default Stage
-- Default Job
---- Source Code Checkout (task)
---- Ant (task)
-- Extended Job
---- Script (task)
---- Ant (task)

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

Krystian Brazulewicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 20, 2015

This is incorrect solution. If you split your flow into 2 Jobs then these can be executed on different agents and no order is guaranteed.

saywhat42 January 20, 2015

Yes, I noticed this unwanted side effect, thank you Krystian.

Krystian Brazulewicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 21, 2015

This is not a side effect :) - this is how our product works.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events