Reputation: 1793
Is there a way to check if a script is running inside a bitbucket pipeline. I want to do something along these lines.
if $running_in_pipelines
do_something
fi
I have looked along checking whether the script is running in a docker container but I don't want to use that since the script can be run inside a docker container running other than a pipeline as well.
Upvotes: 3
Views: 1654
Reputation: 1793
Based on @user7369820's comment, this simple check works
if [ -z "$CI" ]; then
echo "Not running in pipelines"
fi
The assumption here is that nobody defines CI
to be an environment variable in your host system.
Upvotes: 2