Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/core/lib/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class BundlingDockerImage {
...options.user
? ['-u', options.user]
: [],
...flatten(volumes.map(v => ['-v', `${v.hostPath}:${v.containerPath}:${v.consistency ?? DockerVolumeConsistency.DELEGATED}`])),
...flatten(volumes.map(v => ['-v', `${v.hostPath}:${v.containerPath}:z,${v.consistency ?? DockerVolumeConsistency.DELEGATED}`])),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we only add this if the OS is selinux?

...flatten(Object.entries(environment).map(([k, v]) => ['--env', `${k}=${v}`])),
...options.workingDirectory
? ['-w', options.workingDirectory]
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/core/test/test.bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export = {
test.ok(spawnSyncStub.calledWith('docker', [
'run', '--rm',
'-u', 'user:group',
'-v', '/host-path:/container-path:delegated',
'-v', '/host-path:/container-path:z,delegated',
'--env', 'VAR1=value1',
'--env', 'VAR2=value2',
'-w', '/working-directory',
Expand Down
10 changes: 5 additions & 5 deletions packages/@aws-cdk/core/test/test.staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export = {
const assembly = app.synth();
test.deepEqual(
readDockerStubInput(),
`run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`,
`run --rm ${USER_ARG} -v /input:/asset-input:z,delegated -v /output:/asset-output:z,delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`,
);
test.deepEqual(fs.readdirSync(assembly.directory), [
'asset.2f37f937c51e2c191af66acf9b09f548926008ec68c575bd2ee54b6e997c0e00',
Expand Down Expand Up @@ -162,7 +162,7 @@ export = {

test.equal(
readDockerStubInput(),
`run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS_NO_OUTPUT`,
`run --rm ${USER_ARG} -v /input:/asset-input:z,delegated -v /output:/asset-output:z,delegated -w /asset-input alpine DOCKER_STUB_SUCCESS_NO_OUTPUT`,
);
test.done();
},
Expand All @@ -186,7 +186,7 @@ export = {
// THEN
test.equal(
readDockerStubInput(),
`run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`,
`run --rm ${USER_ARG} -v /input:/asset-input:z,delegated -v /output:/asset-output:z,delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`,
);
test.equal(asset.assetHash, '33cbf2cae5432438e0f046bc45ba8c3cef7b6afcf47b59d1c183775c1918fb1f');

Expand Down Expand Up @@ -230,7 +230,7 @@ export = {
}), /Cannot specify `bundle` for `assetHashType`/);
test.equal(
readDockerStubInput(),
`run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`,
`run --rm ${USER_ARG} -v /input:/asset-input:z,delegated -v /output:/asset-output:z,delegated -w /asset-input alpine DOCKER_STUB_SUCCESS`,
);

test.done();
Expand Down Expand Up @@ -284,7 +284,7 @@ export = {
}), /Failed to run bundling Docker image for asset stack\/Asset/);
test.equal(
readDockerStubInput(),
`run --rm ${USER_ARG} -v /input:/asset-input:delegated -v /output:/asset-output:delegated -w /asset-input this-is-an-invalid-docker-image DOCKER_STUB_FAIL`,
`run --rm ${USER_ARG} -v /input:/asset-input:z,delegated -v /output:/asset-output:z,delegated -w /asset-input this-is-an-invalid-docker-image DOCKER_STUB_FAIL`,
);

test.done();
Expand Down