diff --git a/packages/aws-cdk/bin/cdk.ts b/packages/aws-cdk/bin/cdk.ts index 94eda56cf5ad1..80e576dd073f9 100644 --- a/packages/aws-cdk/bin/cdk.ts +++ b/packages/aws-cdk/bin/cdk.ts @@ -61,7 +61,7 @@ async function parseCommandLineArguments() { .command('deploy [STACKS..]', 'Deploys the stack(s) named STACKS into your AWS account', yargs => yargs .option('exclusively', { type: 'boolean', alias: 'e', desc: 'only deploy requested stacks, don\'t include dependencies' }) .option('require-approval', { type: 'string', choices: [RequireApproval.Never, RequireApproval.AnyChange, RequireApproval.Broadening], desc: 'what security-sensitive changes need manual approval' })) - .option('ci', { type: 'boolean', desc: 'Force CI detection. Use --no-ci to disable CI autodetection.', default: undefined }) + .option('ci', { type: 'boolean', desc: 'Force CI detection. Use --no-ci to disable CI autodetection.', default: process.env.CI !== undefined }) .command('destroy [STACKS..]', 'Destroy the stack(s) named STACKS', yargs => yargs .option('exclusively', { type: 'boolean', alias: 'x', desc: 'only deploy requested stacks, don\'t include dependees' }) .option('force', { type: 'boolean', alias: 'f', desc: 'Do not ask for confirmation before destroying the stacks' })) diff --git a/packages/aws-cdk/lib/docker.ts b/packages/aws-cdk/lib/docker.ts index 8e6548e5304d5..d9a092120e13f 100644 --- a/packages/aws-cdk/lib/docker.ts +++ b/packages/aws-cdk/lib/docker.ts @@ -41,7 +41,7 @@ export async function prepareContainerAsset(asset: ContainerImageAssetMetadataEn let loggedIn = false; // In CI we try to pull latest first - if (ci === true || (process.env.CI && ci !== false)) { + if (ci) { await dockerLogin(toolkitInfo); loggedIn = true; @@ -58,7 +58,7 @@ export async function prepareContainerAsset(asset: ContainerImageAssetMetadataEn 'build', '--quiet', asset.path]; - const command = process.env.CI + const command = ci ? [...baseCommand, '--cache-from', latest] // This does not fail if latest is not available : baseCommand; const imageId = (await shell(command, { quiet: true })).trim();