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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,428
Community Members
 
Community Events
176
Community Groups

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

Atlassian Community Events