Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Use local devices on self hosted runners

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?

2 answers

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 ?

+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!

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

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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

📣 Calling Bitbucket Data Center customers to participate in research

Hi everyone, Are you Bitbucket DC customer? If so, we'd love to talk to you! Our team wants to dive deep to understand your long-term plans regarding Bitbucket DC and Atlassian Cloud. Do you plan...

236 views 2 5
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you