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

What is the scripting language used in pipeline script?

Pierre Thibault May 7, 2020

I was not able to find this in the documentation: What is the scripting language used in pipeline script? Is it a list of Bash commands? Can we use another language?

2 answers

1 accepted

0 votes
Answer accepted
Pierre Thibault May 14, 2020

I did a test with the default image. I had a single command for my script:

echo $0

and the result was:

/opt/atlassian/pipelines/agent/tmp/bashScript1621852925964126991.sh

So we can assume it is a GNU Bash script.

Mark May 15, 2020

Amending to our accepted answer, because it is misleading. The yaml is not a bash script, the yaml is currently interpreted and eventually executed as a bash script. 

Pierre Thibault May 15, 2020

I wanted to know what is the language used to interpret the lines of the script section. It seems to be BASH. For YAML, it just a list of strings. That does not tell how these lines are interpreted by saying it is YAML.

 

This is odd that the documentation does not specify this important technicality.

0 votes
Mark May 14, 2020

It's called yaml, it's a configuration language more-or-less.

You can read about how they use it here:

https://confluence.atlassian.com/bitbucket/configure-bitbucket-pipelines-yml-792298910.html

 

You can always use "Make" or "Ant" or bash scripts, you'd just make that your step like:

pipelines:
    default:
        -
step: name: "Build and Run Tests"
            script:
                -
make clean all

                - scripts/someShellScript.sh

Quick note: You might have issues with execute permissions, I've had to grant my scripts execute with a "- chmod +x somedir/somescript.sh

Hope that helps.

Pierre Thibault May 14, 2020

What I would like to know is when you write (like in your example):

make clean all

, in what language are we? Is it Bash? Is it something else? Can we change the default?

Mark May 14, 2020

Everything in the bitbucket-pipelines.yml file is in yaml. I don't believe bitbucket supports anything but yaml for configuring their pipelines. The yaml file is used as the bridge between "What bitbucket knows about" and "how you want to build your source". 

The script section in the step section you can think of as commands that it will pass into the build runner image in the working directory - essentially at the root of your source for that repo/pipeline.

So in the case of "make clean all" the pipeline will attempt to run "make" with the arguments of "clean all" within the virtual machine/container that is attempting to build my code. If "make" is not found you'd get an error that'd youd see in the logs, just like you would in windows, ubuntu, alpine, whatever.

In my case, I have a custom image for my pipelines. It's an ubuntu image, with build-essentials installed, so I have make. In my root of my source I have a Makefile that has targets for "clean" and "all"

Pierre Thibault May 14, 2020

I found a solution but I cannot reply.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events