Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the privileged extension #132

Merged
merged 4 commits into from
Mar 30, 2021
Merged

Add the privileged extension #132

merged 4 commits into from
Mar 30, 2021

Conversation

galou
Copy link
Contributor

@galou galou commented Mar 24, 2021

Signed-off-by: Gaël Écorchard gael.ecorchard@cvut.cz

Signed-off-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
@galou galou requested a review from tfoote as a code owner March 24, 2021 10:25
Copy link
Collaborator

@tfoote tfoote left a comment

Choose a reason for hiding this comment

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

Thanks this will be useful to add. I had a few requests to clean up the patch but otherwise it looks good.

setup.py Outdated
@@ -31,30 +31,31 @@

kwargs = {
'name': 'rocker',
'version': '0.2.3',
'version': '0.3.0',
Copy link
Collaborator

Choose a reason for hiding this comment

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

please don't change the version number in a patch. This will be done at release time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My point of view on this is that we add a functionality and thus must increment the minor version number but will obey to your request. I'll increment first RP #130.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that's the policy for semantic versioning. But this commit is not the release. There may be multiple additions that go into the next release. And I couldn't merge this PR at the same time as your other one because this change would conflict.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get it with the version number. I actually never contributed to a release-based repository. How do you then manage the version change? Do contributors have to notify somewhere that they did a change that provokes a version change?

setup.py Outdated
'packages': ['rocker'],
'package_dir': {'': 'src'},
'package_data': {'rocker': ['templates/*.em']},
'entry_points': {
'console_scripts': [
'rocker = rocker.cli:main',
'detect_docker_image_os = rocker.cli:detect_image_os',
],
],
Copy link
Collaborator

Choose a reason for hiding this comment

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

please avoid unrelated changes to the PR.

Copy link
Collaborator

Choose a reason for hiding this comment

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

A little cleanup can be done, but it should be at least separated to a different commit.

return ''

def get_docker_args(self, cli_args):
return '--privileged'
Copy link
Collaborator

Choose a reason for hiding this comment

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

This needs to be prepended with whitespace to make sure not to run into a preceding argument if not first.

Suggested change
return '--privileged'
return ' --privileged'

They are currently string appended

docker_args += e.get_docker_args(self.cliargs)
This could be made more robust with a ' '.join(...) it looks like other places have this potential problem depending on ordering.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wouldn't it be better to actually let extensions return a list of strings and let core.py manage formatting the command, if needed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think a single string at least with core.py inserting the space. "If needed" is not clearly resolved if I return multiple.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There might be a few words missing in these last sentences and I don't get their sense. Anyway, with "if needed", I meant that subprocess.run and partially pexcpect.spawn accept a list of strings as argument to launch the command.

- Add a space before the argument in the case that the option is not
  first.
- Increment patch version rather than minor (i.e. partially revert
  previous commit).
- Revert unrelated changes compared to master.

Signed-off-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
Signed-off-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
@galou
Copy link
Contributor Author

galou commented Mar 26, 2021

Reverted the version number and unrelated changes. Should I squeeze commits?

Copy link
Collaborator

@tfoote tfoote left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning it up. I added some tests too. I'll just wait for CI to return. Don't worry about cleaning up the commit history, I'll squash when merging.

@tfoote
Copy link
Collaborator

tfoote commented Mar 30, 2021

Coverage isn't reporting directly: 100% diff coverage now https://app.codecov.io/gh/osrf/rocker/compare/132/overview

@tfoote tfoote merged commit 4214d73 into osrf:master Mar 30, 2021
@galou galou deleted the privileged branch April 16, 2021 05:44
130s pushed a commit to plusone-robotics/rocker that referenced this pull request Apr 17, 2021
* Add the privileged extension

Signed-off-by: Gaël Écorchard <gael.ecorchard@cvut.cz>
Co-authored-by: Tully Foote <tfoote@osrfoundation.org>
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.

2 participants