Is there a way to add a Bitbucket pipelines template
Asked by Kapil Gupta:

I wanted to know if there is a way we can contribute a MATLAB based template for Bitbucket pipeline users so that they simply choose our template on the below shown screen and use MATLAB commands in their workflow. I couldn't find any documentation mentioning how you can do so. Are all the following templates prepared and provided by Bitbucket/Atlassian themselves? If not, can you guide me to the process of adding one?

![Screenshot 2023-06-28 145409.png](https://community.atlassian.com/t5/image/serverpage/image-id/265451i5E89348990CBECD1/image-size/large?v=v2&px=999 "Screenshot 2023-06-28 145409.png")

![Screenshot 2023-06-28 150109.png](https://community.atlassian.com/t5/image/serverpage/image-id/265449i53ED006DD3A55780/image-dimensions/290x274?v=v2 "Screenshot 2023-06-28 150109.png")

Thanks,

Kapil


Answers:
author: Patrik S
body: Hello [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) and welcome to the Community!

The available templates provided to the user during the pipeline onboarding are created by the Bitbucket engineering team. While we currently don't have a process for vendors and the community to contribute with the templates, we do have a process in place if you are willing to develop a [custom pipe](https://bitbucket.org/product/features/pipelines/integrations) for your product.

The following resource provides instructions on how third parties can contribute with a pipe:

* <https://bitbucket.org/bitbucketpipelines/official-pipes/src/master/README.md>

Thank you, [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) !

Patrik S

comments: author: Kapil Gupta
body: Hey [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) , thanks for your response!

We originally were discovering if it would be feasible for us to develop an official pipe for the users but realized the pipes functionality is not supported on self-hosted runners. This made us move towards a template based approach for informing users on how to use MATLAB with Bitbucket pipelines.

* Are there any plans to extend the pipes functionality for self-hosted runners?
* Is there a way we can collaborate with the Bitbucket engineering team to contribute a template related to MATLAB? We can help you with all the required information and files.

Regards,

Kapil


author: Patrik S
body: Hello [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) ,

The usage of pipes is **supported for [Linux Docker self-hosted runners](https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-runners-for-linux/)**, and you can configure the pipe on the YML file the same way you would when using the cloud runners.

Pipes are only not supported when using Linux Shell, Windows, or macOS runners, because those runners are executed directly in a shell session, and pipes are essentially a docker image, so they need to be executed on a container environment.

Thank you, [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) !

Patrik S


author: Kapil Gupta
body: Hey [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) ,

I see pipes are usable with Linux Docker self-hosted runners. Since docker is also available on Windows and macOS, are there any plans to add Windows docker and macOS docker support with Bitbucket pipelines, similar to what we have for Linux docker.

Regards,

Kapil


author: Patrik S
body: Hello [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) ,

Docker Desktop for Windows and macOS actually runs in a Linux virtual machine under the hood, so in theory, you should be able to run the Linux docker containers in a Windows and/or macOS environment with Docker Desktop. The pipes should work just fine as well as they are treated like normal containers.

However, given the extra layer of complexity added by virtualization, you might have an impact on performance or unexpected errors when running in a non-Linux host.

Thank you, [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) !  
Patrik S


author: Kapil Gupta
body: Hey [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) ,

Thanks a lot for your responses, it really helped in clarifying things a lot more.

Since we are on this topic, are all bitbucket pipeline hosted agents linux based? It would be helpful if you could shed some light on what type of agents are provided when a user decides to run on Bitbucket's infrastructure.

Regards,

Kapil


author: Patrik S
body: Hello [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282)

You're correct, all the cloud runners (the agents that run on Bitbucket infrastructure) are based on Linux.

So if you configure your step to run on atlassian infrastructure, it will run on an instance based on Linux.

Thank you, [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) !

Patrik S


author: Kapil Gupta
body: Hey [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) ,

Thanks for all the info!

You mentioned we can use pipes on a self hosted linux docker runner and to add a linux docker we can use this [doc](https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-runners-for-linux/). When I try to add a repository runner on my Debian 11 machine, it errors out saying that the value provided is not a valid uuid even though I am using the exact command as provided. I have attached images for the error, can you please have a look and let me know what might be the issue?

![1.png](https://community.atlassian.com/t5/image/serverpage/image-id/268965iB9D9BCDD3632237D/image-dimensions/434x229?v=v2 "1.png")

![2.png](https://community.atlassian.com/t5/image/serverpage/image-id/268970i086DB1076F4D2ECB/image-dimensions/434x244?v=v2 "2.png")

![3.png](https://community.atlassian.com/t5/image/serverpage/image-id/268971iB28020E4479D7353/image-dimensions/434x244?v=v2 "3.png")

![4.png](https://community.atlassian.com/t5/image/serverpage/image-id/268962i65CCEB557355E97D/image-dimensions/435x245?v=v2 "4.png")

![5.png](https://community.atlassian.com/t5/image/serverpage/image-id/268961i4C7B5B08D2004FEF/image-dimensions/434x244?v=v2 "5.png")

**Small addition to previous question:**

* Do all the bitbucket hosted machines have same distributions?
* If not, what all can be the distribution? And if there is a way to use a specific distribution, can you make me aware with that?

Thanks and regards,

Kapil


author: Patrik S
body: Hello [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) ,

The error on the screenshot is returned when the UUID in the pre-defined runner command is not valid. This may be happening due to a copy/paste operation inserting invalid characters or line breaks in the command. I would suggest first copying to a text editor and then from the text editor copy to the terminal.

I also saw this error happening when using the bash terminal, so you can try executing the runner command in the **sh**terminal instead. To do that you can open the terminal on the host machine and execute the following sequence of commands:

```
$ sh # open the SH shell. Next instructions will be executed on SH
$ docker container run -it <rest of the command> # the pre-defined runner command you received when creating it
```

You can test the suggestion above and let us know how it goes.

As for your other questions, all bitbucket-hosted machines run in a Kubernetes cluster that uses Ubuntu. You can find more details in our [Infrastructure Changes on BItbucket Pipelines](https://confluence.atlassian.com/bbkb/infrastructure-changes-in-bitbucket-pipelines-1142431176.html) page.

Thank you, [@Kapil Gupta](/t5/user/viewprofilepage/user-id/5223282) !

Patrik S


Tags: bitbucket-pipelines

cloud

template