Merge pull request #1280 from estesp/add-default-path-env
Add back default UNIX env to container config
This commit is contained in:
commit
b431316edd
@ -112,6 +112,7 @@ func (c *criService) containerSpec(id string, sandboxID string, sandboxPid uint3
|
|||||||
customopts.WithoutDefaultSecuritySettings,
|
customopts.WithoutDefaultSecuritySettings,
|
||||||
customopts.WithRelativeRoot(relativeRootfsPath),
|
customopts.WithRelativeRoot(relativeRootfsPath),
|
||||||
customopts.WithProcessArgs(config, imageConfig),
|
customopts.WithProcessArgs(config, imageConfig),
|
||||||
|
oci.WithDefaultPathEnv,
|
||||||
// this will be set based on the security context below
|
// this will be set based on the security context below
|
||||||
oci.WithNewPrivileges,
|
oci.WithNewPrivileges,
|
||||||
}
|
}
|
||||||
|
@ -269,6 +269,27 @@ func TestContainerSpecTty(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestContainerSpecDefaultPath(t *testing.T) {
|
||||||
|
testID := "test-id"
|
||||||
|
testSandboxID := "sandbox-id"
|
||||||
|
testPid := uint32(1234)
|
||||||
|
expectedDefault := "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
containerConfig, sandboxConfig, imageConfig, specCheck := getCreateContainerTestData()
|
||||||
|
ociRuntime := config.Runtime{}
|
||||||
|
c := newTestCRIService()
|
||||||
|
for _, pathenv := range []string{"", "PATH=/usr/local/bin/games"} {
|
||||||
|
expected := expectedDefault
|
||||||
|
if pathenv != "" {
|
||||||
|
imageConfig.Env = append(imageConfig.Env, pathenv)
|
||||||
|
expected = pathenv
|
||||||
|
}
|
||||||
|
spec, err := c.containerSpec(testID, testSandboxID, testPid, "", containerConfig, sandboxConfig, imageConfig, nil, ociRuntime)
|
||||||
|
require.NoError(t, err)
|
||||||
|
specCheck(t, testID, testSandboxID, testPid, spec)
|
||||||
|
assert.Contains(t, spec.Process.Env, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestContainerSpecReadonlyRootfs(t *testing.T) {
|
func TestContainerSpecReadonlyRootfs(t *testing.T) {
|
||||||
testID := "test-id"
|
testID := "test-id"
|
||||||
testSandboxID := "sandbox-id"
|
testSandboxID := "sandbox-id"
|
||||||
|
Loading…
Reference in New Issue
Block a user