Is it possible to use WSL as runner ?
Asked by Thomas Cangialosi:

Hello

I am testing various things on pipelines to decide whether or not we will use it as CI tool for my company.

I am wondering if it is possible to use WSL as runner for compilation step.

We have a windows based compilation toolchain which include licenced compiler so it is impossible to switch to linux for now.

WSL seems like a promising way to link bitbucket pipeline runners and our toolchain.

The problem is that we must specify a docker image for the runner. Is it possible to use WSL as linux environment AND then as docker image for the runner ?   

If not, is it possible to not specify any docker image and run directly the scripts in wsl ?

I am not an expert in docker images and continuous integration so maybe there are some things I do not see. Please enlight me :)

Thanks a lot


Answers:
author: Dmitry
body: Self-hosted runners work with DockerDesktop on Windows (on WSL), but log files from containers are not available due to another log file location in DockerDesktop (and they are not accessible from WSL runner). I hope this will be fixed.. in some way.


author: Theodora Boudale
body: Hi Thomas and welcome to the community!

Do you need to run your builds on a Windows host?

If so, we have an Early Access Program for Widnows runners. You can see more details here:

* <https://community.atlassian.com/t5/Bitbucket-Pipelines-articles/Bitbucket-Pipelines-Windows-Runners-Early-Access/ba-p/1858047>

There is a link in that post to sign up if you'd be interested and would like to try it.

I'm not sure if it's possible to use WSL as a linux environment for the runner, I would need to test this and check with my team internally, and I'll let you know.

Kind regards,  
Theodora

comments: author: Theodora Boudale
body: Hi [@Thomas Cangialosi](/t5/user/viewprofilepage/user-id/4654790) and [@Dmitry](/t5/user/viewprofilepage/user-id/4699786),

I have checked with my team and our pipelines runners are designed for an actual Linux system, we have not tested it thoroughly with WSL2.

One issue we have seen, as Dmitry mentioned, is that the container log cannot be found, because the Docker command for starting the runner is meant for Docker that runs on a Linux system, which stores the container log under \`/var/lib/docker/containers\` directory.

I have created a feature request to add support for runners on WSL:

* <https://jira.atlassian.com/browse/BCLOUD-21611>

I would suggest adding your vote in that feature request (by selecting the **Vote for this issue** link) as the number of votes helps the development team and product managers better understand the demand for new features. You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the **Start watching this issue** link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy [here](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

Please feel free to let me know if you have any questions.

Kind regards,  
Theodora


author: Dmitry
body: Hello! Thank you for answer, that's a good option. I've added my vote.


author: Theodora Boudale
body: You are very welcome [@Dmitry](/t5/user/viewprofilepage/user-id/4699786) !

[@Thomas Cangialosi](/t5/user/viewprofilepage/user-id/4654790) I just realized I didn't address some of your specific questions:

WSL cannot be used as a Docker image for the runner. When you create a runner from Bitbucket website, you are given a docker run command to start the runner which includes the image that must be used (it's *docker-public.packages.atlassian.com/sox/atlassian/bitbucket-pipelines-runner:1*). It is not possible to not specify any Docker image at all either.

What you can specify is the image that will be used for your builds. After you start a runner, the builds run based on your bitbucket-pipelines.yml file.

For every step in the bitbucket-pipelines.yml file, a new Docker container will start for this step, where the repo is cloned and that step's script commands are executed. If you don't specify any image in the bitbucket-pipelines.yml file, atlassian/default-image:latest will be used for all steps. However, you can specify a different image (e.g. image: openjdk) either at the beginning of the bitbucket-pipelines.yml file, which will be used for all steps, or at the step level.

You can read more here:

* <https://support.atlassian.com/bitbucket-cloud/docs/use-docker-images-as-build-environments/>
* <https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/>

Kind regards,  
Theodora


Tags: bitbucket-pipelines