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?
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.