Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

History command in Pipelines not working.

rhitik.bhatt@rivetlabs.io March 5, 2019

I want to track the metrics of the bitbucket pipline, and for that reason I want to use the history command, and pass forward it's output to a file. But the file containing the stdout and stderr of the history command contains nothing inside of it.

These are two of the steps in the script.

- export HISTTIMEFORMAT="%d/%m/%y %T "
- history 1>${BITBUCKET_BUILD_NUMBER}_history.log 2>${BITBUCKET_BUILD_NUMBER}_history.log

It works fine locally on the same docker machine. Is it because I am using secret keys?

 

1 answer

1 accepted

1 vote
Answer accepted
Graham Gatus
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 6, 2019

rhitik.bhatt@rivetlabs.io this is due to the fact that the script is not running in an interactive environment, you need to turn history on manually. You can do this via the following command:

set -o history

Doing this in your bitbucket-pipelines.yml file will reveal other commands executed by pipelines, so it might be cleaner for you to move the commands you are trying to profile into a single script, or by processing the output from history to strip out unwanted lines.

rhitik.bhatt@rivetlabs.io March 6, 2019

Got it, thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events