push (local device): Add --pull option to force pulling base images again

Connects-to: #1584
Change-type: minor
This commit is contained in:
Paulo Castro 2020-09-08 14:55:56 +01:00
parent 73f49765ec
commit 93e18bea27
3 changed files with 14 additions and 0 deletions

View File

@ -2188,6 +2188,11 @@ purposes" (as the cloud builder needs previous images to compute delta
updates), but the logs will not display the "Using cache" lines for each updates), but the logs will not display the "Using cache" lines for each
build step of a Dockerfile. build step of a Dockerfile.
#### --pull
When pushing to a local device, force the base images to be pulled again.
Currently this option is ignored when pushing to the balenaCloud builders.
#### --noparent-check #### --noparent-check
Disable project validation check of 'docker-compose.yml' file in parent folder Disable project validation check of 'docker-compose.yml' file in parent folder

View File

@ -33,6 +33,7 @@ interface FlagsDef {
emulated: boolean; emulated: boolean;
dockerfile?: string; // DeviceDeployOptions.dockerfilePath (alternative Dockerfile) dockerfile?: string; // DeviceDeployOptions.dockerfilePath (alternative Dockerfile)
nocache?: boolean; nocache?: boolean;
pull?: boolean;
'noparent-check'?: boolean; 'noparent-check'?: boolean;
'registry-secrets'?: string; 'registry-secrets'?: string;
gitignore?: boolean; gitignore?: boolean;
@ -138,6 +139,11 @@ export default class PushCmd extends Command {
build step of a Dockerfile.`, build step of a Dockerfile.`,
char: 'c', char: 'c',
}), }),
pull: flags.boolean({
description: stripIndent`
When pushing to a local device, force the base images to be pulled again.
Currently this option is ignored when pushing to the balenaCloud builders.`,
}),
'noparent-check': flags.boolean({ 'noparent-check': flags.boolean({
description: stripIndent` description: stripIndent`
Disable project validation check of 'docker-compose.yml' file in parent folder`, Disable project validation check of 'docker-compose.yml' file in parent folder`,
@ -310,6 +316,7 @@ export default class PushCmd extends Command {
registrySecrets, registrySecrets,
multiDockerignore: options['multi-dockerignore'] || false, multiDockerignore: options['multi-dockerignore'] || false,
nocache: options.nocache || false, nocache: options.nocache || false,
pull: options.pull || false,
nogitignore, nogitignore,
noParentCheck: options['noparent-check'] || false, noParentCheck: options['noparent-check'] || false,
nolive: options.nolive || false, nolive: options.nolive || false,

View File

@ -58,6 +58,7 @@ export interface DeviceDeployOptions {
nogitignore: boolean; nogitignore: boolean;
noParentCheck: boolean; noParentCheck: boolean;
nolive: boolean; nolive: boolean;
pull: boolean;
detached: boolean; detached: boolean;
services?: string[]; services?: string[];
system: boolean; system: boolean;
@ -526,6 +527,7 @@ async function assignDockerBuildOpts(
t: generateImageName(task.serviceName), t: generateImageName(task.serviceName),
nocache: opts.nocache, nocache: opts.nocache,
forcerm: true, forcerm: true,
pull: opts.pull,
}; };
if (task.external) { if (task.external) {
task.dockerOpts.authconfig = await getAuthConfigObj( task.dockerOpts.authconfig = await getAuthConfigObj(