Skip to content

Add docker device mapping configuration#10645

Merged
diemol merged 6 commits intoSeleniumHQ:trunkfrom
gifflet:add_docker_device_mapping
May 23, 2022
Merged

Add docker device mapping configuration#10645
diemol merged 6 commits intoSeleniumHQ:trunkfrom
gifflet:add_docker_device_mapping

Conversation

@gifflet
Copy link
Copy Markdown
Contributor

@gifflet gifflet commented May 13, 2022

Description

Configure docker containers device mapping

Motivation and Context

Sometimes is needed to map a device file to a docker
container to make possible some tasks like virtualize
a VM or something else. Because of this, I believe it
is desirable to have a way to configure which device
files should be available in containers.

In this commit, we can define which device files should
be mapped in containers through the standard selenium grid
configuration file.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 13, 2022

CLA assistant check
All committers have signed the CLA.

@gifflet
Copy link
Copy Markdown
Contributor Author

gifflet commented May 16, 2022

The documentation was updated in SeleniumHQ/seleniumhq.github.io#1011

@gifflet gifflet marked this pull request as ready for review May 16, 2022 02:12
@pujagani pujagani requested a review from diemol May 18, 2022 11:23
Copy link
Copy Markdown
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine, thanks for the PR. I'd just like to understand better what the use case for this is, how would you be using this feature?

@gifflet
Copy link
Copy Markdown
Contributor Author

gifflet commented May 18, 2022

Thank you @diemol for reviewing this PR.

Answering your question, I implemented this change because the containers launched by selenium grid perform virtualization of virtual machines, that is, a virtual machine is started offering the native web browser of the platform at the same time that the selenium server runs in the virtual machine in standalone mode . So I need the containers to have access to the /dev/kvm device, available on the host, for the virtualization tool to work as expected.

@diemol
Copy link
Copy Markdown
Member

diemol commented May 18, 2022

Can volumes be used instead of devices?

@gifflet
Copy link
Copy Markdown
Contributor Author

gifflet commented May 18, 2022

Unfortunately not. When we share a device through a volume, the container does not have the proper read and write permissions to the shared device.

image

@diemol
Copy link
Copy Markdown
Member

diemol commented May 18, 2022

Got it, thanks.

Can you please have a look at the issues reported by Sonar?

@gifflet
Copy link
Copy Markdown
Contributor Author

gifflet commented May 18, 2022

Sure, I will work on it.

@gifflet
Copy link
Copy Markdown
Contributor Author

gifflet commented May 18, 2022

@diemol, I could not reproduce the issue reported by Sonar but I think that the last commit solves it.

@diemol
Copy link
Copy Markdown
Member

diemol commented May 18, 2022

Can you please rebase first? Or let us do it by enabling the PR?

@diemol
Copy link
Copy Markdown
Member

diemol commented May 18, 2022

Maybe I missed it, but I do not see the other Sonar issues being addressed.

gifflet added 5 commits May 18, 2022 20:07
Sometimes is needed to map a device file to a docker
container to make possible some tasks like virtualize
a VM or something else. Because of this, I believe it
is desirable to have a way to configure which device
files should be available in containers.

In this commit, we can define which device files should
be mapped in containers through the standard selenium grid
configuration file.
@gifflet
Copy link
Copy Markdown
Contributor Author

gifflet commented May 18, 2022

The other issues reported by Sonar was fixed in the last commit. The rebase was done as suggested.

@diemol
Copy link
Copy Markdown
Member

diemol commented May 23, 2022

I'd love to merge this but if I can't update this branch on my own is just going to take longer. Can you please update your fork?

@gifflet
Copy link
Copy Markdown
Contributor Author

gifflet commented May 23, 2022

@diemol, I just enabled maintainer editing, so I believe you will be able to update this branch.

@diemol
Copy link
Copy Markdown
Member

diemol commented May 23, 2022

Thanks

@sonarqubecloud
Copy link
Copy Markdown

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@diemol diemol merged commit ecc58fd into SeleniumHQ:trunk May 23, 2022
Copy link
Copy Markdown
Member

@diemol diemol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @dilhelh!

diemol pushed a commit to SeleniumHQ/seleniumhq.github.io that referenced this pull request May 23, 2022
* Update docker configuration section in documentation

This PR is the documentation of SeleniumHQ/selenium#10645.

* Comment out the devices declaration

[deploy site]
selenium-ci added a commit to SeleniumHQ/seleniumhq.github.io that referenced this pull request May 23, 2022
* Update docker configuration section in documentation

This PR is the documentation of SeleniumHQ/selenium#10645.

* Comment out the devices declaration

[deploy site] 78dc23e
@gifflet gifflet deleted the add_docker_device_mapping branch June 3, 2022 11:52
elgatov pushed a commit to elgatov/selenium that referenced this pull request Jun 27, 2022
* Add docker device mapping configuration

Sometimes is needed to map a device file to a docker
container to make possible some tasks like virtualize
a VM or something else. Because of this, I believe it
is desirable to have a way to configure which device
files should be available in containers.

In this commit, we can define which device files should
be mapped in containers through the standard selenium grid
configuration file.

* Device mapping configuration added do selenium grid cli options

* Added tests to cover the device mapping processing and validation

* Trying to fix the regex backtracking issue

* Fix code smells reported by Sonar

Co-authored-by: Diego Molina <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants