Skip to content

Commit 694e9b5

Browse files
committed
When running under podman use keep-groups to maintain the groups of the user
Some of the permissions of the user depend on her extra groups. Not maintaining the entire groups list can prevent some operations Signed-off-by: Ygal Blum <[email protected]>
1 parent d878414 commit 694e9b5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

skipper/runner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ def _run_nested(fqdn_image, environment, command, interactive, name, net, publis
9191
except KeyError:
9292
pass
9393

94+
if utils.get_runtime_command() == "podman":
95+
cmd += ['--group-add', 'keep-groups']
96+
9497
if use_cache:
9598
cmd += ['-e', 'SKIPPER_USE_CACHE_IMAGE=True']
9699

tests/test_runner_podman.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def test_run_simple_command_nested_network_exist(self, resource_filename_mock, c
8282
'-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
8383
'-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
8484
'-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
85+
'--group-add', 'keep-groups',
8586
'-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
8687
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
8788
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
@@ -123,6 +124,7 @@ def test_run_simple_command_nested_network_not_exist(self, resource_filename_moc
123124
'-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
124125
'-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
125126
'-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
127+
'--group-add', 'keep-groups',
126128
'-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
127129
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
128130
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
@@ -164,6 +166,7 @@ def test_run_complex_command_nested(self, resource_filename_mock, check_output_m
164166
'-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
165167
'-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
166168
'-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
169+
'--group-add', 'keep-groups',
167170
'-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
168171
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
169172
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
@@ -209,6 +212,7 @@ def test_run_non_existent_unauthorized_volume(self, resource_filename_mock,
209212
'-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
210213
'-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
211214
'-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
215+
'--group-add', 'keep-groups',
212216
'-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
213217
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
214218
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),
@@ -252,6 +256,7 @@ def test_run_complex_command_nested_with_env(self, resource_filename_mock, check
252256
'-e', 'SKIPPER_UID=%(user_uid)s' % dict(user_uid=USER_ID),
253257
'-e', 'HOME=%(homedir)s' % dict(homedir=HOME_DIR),
254258
'-e', 'CONTAINER_RUNTIME_COMMAND=%(runtime_command)s' % dict(runtime_command=utils.get_runtime_command()),
259+
'--group-add', 'keep-groups',
255260
'-v', get_volume_mapping('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict(homedir=HOME_DIR)),
256261
'-v', get_volume_mapping('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict(homedir=HOME_DIR)),
257262
'-v', get_volume_mapping('%(homedir)s/.docker/config.json:%(homedir)s/.docker/config.json:ro' % dict(homedir=HOME_DIR)),

0 commit comments

Comments
 (0)