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

Use local devices on self hosted runners

Thomas Augustin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 23, 2021

Hello,

 

I am kind of new to docker and and  to self-hosted runners in bitbucket as well.

I am trying to access a local USB device via a self hosted pipeline runner on a local host PC.

It tried to add 

-t -i --device=/dev/ttyUSB0:/dev/ttyUSB0

to the command to start the local runner on the host PC.

 

And I also tried to added the devices in the .yml file in bitbucket like: 

image: ubuntu

devices:
- "/dev/ttyUSB0:/dev/ttyUSB0"

pipelines:
default:
- step:
name: Run unittests on local host
runs-on:
- 'self.hosted'
script:
- echo "This step will run on a self hosted runner.";
- ls /dev/

 

Unfortunately, I am not able to see the USB devices either way.

 

Is it possible to access or connect to the local USB devices?

If it is possible, how should I do it?

3 answers

1 vote
Michael Wurm
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 24, 2021

+1 for that!

I would really like to see this feature too!  

 

Simply allowing the 'privileged mode' for the Docker image would resolve any issues.

This feature was already requested here: https://jira.atlassian.com/browse/BCLOUD-13420

 

Back then, the privileged mode was not supported, because of security reasons.

However, now that local self-hosted runners are available, it should be one's own decision to run the pipeline in privileged mode!

 

A common use case that requires access to local USB devices:
Development and testing of an embedded device.
Using a programmer to flash i.e. a microcontroller is almost always done through USB!

Thomas Augustin
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 27, 2021

Thanks for the kind answer,

I realized in the meantime, that both ways are not working because when I start the local runner by 

-t -i --device=/dev/ttyUSB0:/dev/ttyUSB0

it only starts the runner with that the usb devices however not the container which is started by the runner.

 

And the other way does not work because bitbucket pipeline does support that option.

 

I solved that issue by using ssh to access the local host pc via the pipeline container and from there I have access to the USB devices. Feels like a detour, but at least I can use the pipeline now to test the embedded device.

Like Michael Wurm likes this
Jarek Piotrowiak January 10, 2022

+1 from me. I could really use this feature for testing embedded system

0 votes
Andreas Pettersson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2024

There seems to still be no way to do this, and I would really like it to be able to use USB devices to test my embedded units.

+1 for any solution to this.

0 votes
Théo Meyer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 9, 2021

Device access or even full host access (file system + device) would open an important amount of possibility for automation of test on real devices.

@Thomas Augustin how did you achieve that using SSH? You ssh from the docker to the runner host ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events