Skip to content

Commit a1ff727

Browse files
committed
feat(core): docker build add missing network param
1 parent 8dddfe6 commit a1ff727

File tree

32 files changed

+62158
-2157
lines changed

32 files changed

+62158
-2157
lines changed

packages/@aws-cdk/aws-lambda-go-alpha/lib/bundling.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ export class Bundling implements cdk.BundlingOptions {
148148
IMAGE: Runtime.GO_1_X.bundlingImage.image, // always use the GO_1_X build image
149149
},
150150
platform: props.architecture.dockerPlatform,
151+
network: props.network,
151152
})
152153
: cdk.DockerImage.fromRegistry('dummy'); // Do not build if we don't need to
153154

packages/@aws-cdk/aws-lambda-go-alpha/test/bundling.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ test('bundling', () => {
3939
environment: {
4040
KEY: 'value',
4141
},
42+
network: 'host',
4243
});
4344

4445
expect(Code.fromAsset).toHaveBeenCalledWith(path.dirname(moduleDir), {
@@ -65,6 +66,7 @@ test('bundling', () => {
6566
IMAGE: expect.stringMatching(/build-go/),
6667
}),
6768
platform: 'linux/amd64',
69+
network: 'host',
6870
}));
6971
});
7072

packages/@aws-cdk/aws-lambda-python-alpha/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ new python.PythonFunction(this, 'function', {
197197
entry,
198198
runtime: Runtime.PYTHON_3_8,
199199
bundling: {
200-
network: 'host',
201-
securityOpt: 'no-new-privileges',
202-
user: 'user:group',
203-
volumesFrom: ['777f7dc92da7'],
204-
volumes: [{ hostPath: '/host-path', containerPath: '/container-path' }],
205-
},
200+
network: 'host',
201+
securityOpt: 'no-new-privileges',
202+
user: 'user:group',
203+
volumesFrom: ['777f7dc92da7'],
204+
volumes: [{ hostPath: '/host-path', containerPath: '/container-path' }],
205+
},
206206
});
207207
```
208208

packages/@aws-cdk/aws-lambda-python-alpha/lib/bundling.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export class Bundling implements CdkBundlingOptions {
105105
IMAGE: runtime.bundlingImage.image,
106106
},
107107
platform: architecture.dockerPlatform,
108+
network: props.network,
108109
});
109110
this.command = props.command ?? ['bash', '-c', chain(bundlingCommands)];
110111
this.entrypoint = props.entrypoint;

packages/@aws-cdk/aws-lambda-python-alpha/test/bundling.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ test('Bundling a function without dependencies', () => {
3131
entry: entry,
3232
runtime: Runtime.PYTHON_3_7,
3333
architecture: Architecture.X86_64,
34+
network: 'host',
3435
});
3536

3637
// Correctly bundles
@@ -48,6 +49,7 @@ test('Bundling a function without dependencies', () => {
4849
IMAGE: expect.stringMatching(/build-python/),
4950
}),
5051
platform: 'linux/amd64',
52+
network: 'host',
5153
}));
5254

5355
const files = fs.readdirSync(assetCode.path);
@@ -426,7 +428,6 @@ test('Bundling with volumes from other container', () => {
426428
entry: entry,
427429
runtime: Runtime.PYTHON_3_7,
428430
volumesFrom: ['777f7dc92da7'],
429-
430431
});
431432

432433
expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({
@@ -442,7 +443,6 @@ test('Bundling with custom volume paths', () => {
442443
entry: entry,
443444
runtime: Runtime.PYTHON_3_7,
444445
volumes: [{ hostPath: '/host-path', containerPath: '/container-path' }],
445-
446446
});
447447

448448
expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({
@@ -474,7 +474,6 @@ test('Bundling with custom user', () => {
474474
entry: entry,
475475
runtime: Runtime.PYTHON_3_7,
476476
user: 'user:group',
477-
478477
});
479478

480479
expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({
@@ -490,7 +489,6 @@ test('Bundling with custom securityOpt', () => {
490489
entry: entry,
491490
runtime: Runtime.PYTHON_3_7,
492491
securityOpt: 'no-new-privileges',
493-
494492
});
495493

496494
expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({
@@ -506,7 +504,6 @@ test('Bundling with custom network', () => {
506504
entry: entry,
507505
runtime: Runtime.PYTHON_3_7,
508506
network: 'host',
509-
510507
});
511508

512509
expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({
@@ -522,7 +519,6 @@ test('Bundling with docker copy variant', () => {
522519
entry: entry,
523520
runtime: Runtime.PYTHON_3_7,
524521
bundlingFileAccess: BundlingFileAccess.VOLUME_COPY,
525-
526522
});
527523

528524
expect(Code.fromAsset).toHaveBeenCalledWith(entry, expect.objectContaining({

0 commit comments

Comments
 (0)