mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-06-16 06:48:08 +00:00
Add --draft
option to balena push
This change will allow to build releases as draft and have them being set as final at a later stage. This change is part of a larger feature towards using the builder as part of CI/CD pipelines. Depends-on: https://github.com/balena-io/balena-builder/pull/868 Change-type: minor
This commit is contained in:
committed by
toochevere
parent
d11f49e0f8
commit
254ef1c8cf
@ -2938,6 +2938,13 @@ Set release tags if the image build is successful (balenaCloud only). Multiple
|
|||||||
arguments may be provided, alternating tag keys and values (see examples).
|
arguments may be provided, alternating tag keys and values (see examples).
|
||||||
Hint: Empty values may be specified with "" (bash, cmd.exe) or '""' (PowerShell).
|
Hint: Empty values may be specified with "" (bash, cmd.exe) or '""' (PowerShell).
|
||||||
|
|
||||||
|
#### --draft
|
||||||
|
|
||||||
|
Instruct the builder to create the release as a draft. Draft releases are ignored
|
||||||
|
by the 'track latest' release policy but can be used through release pinning.
|
||||||
|
Draft releases can be marked as final through the API. Releases are created
|
||||||
|
as final by default unless this option is given.
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
|
|
||||||
## settings
|
## settings
|
||||||
|
@ -58,6 +58,7 @@ interface FlagsDef {
|
|||||||
'noconvert-eol': boolean;
|
'noconvert-eol': boolean;
|
||||||
'multi-dockerignore': boolean;
|
'multi-dockerignore': boolean;
|
||||||
'release-tag'?: string[];
|
'release-tag'?: string[];
|
||||||
|
draft: boolean;
|
||||||
help: void;
|
help: void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,6 +268,14 @@ export default class PushCmd extends Command {
|
|||||||
multiple: true,
|
multiple: true,
|
||||||
exclusive: ['detached'],
|
exclusive: ['detached'],
|
||||||
}),
|
}),
|
||||||
|
draft: flags.boolean({
|
||||||
|
description: stripIndent`
|
||||||
|
Instruct the builder to create the release as a draft. Draft releases are ignored
|
||||||
|
by the 'track latest' release policy but can be used through release pinning.
|
||||||
|
Draft releases can be marked as final through the API. Releases are created
|
||||||
|
as final by default unless this option is given.`,
|
||||||
|
default: false,
|
||||||
|
}),
|
||||||
help: cf.help,
|
help: cf.help,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -362,6 +371,7 @@ export default class PushCmd extends Command {
|
|||||||
registrySecrets,
|
registrySecrets,
|
||||||
headless: options.detached,
|
headless: options.detached,
|
||||||
convertEol: !options['noconvert-eol'],
|
convertEol: !options['noconvert-eol'],
|
||||||
|
isDraft: options.draft,
|
||||||
};
|
};
|
||||||
const args = {
|
const args = {
|
||||||
appSlug: application.slug,
|
appSlug: application.slug,
|
||||||
@ -394,7 +404,7 @@ export default class PushCmd extends Command {
|
|||||||
registrySecrets: RegistrySecrets,
|
registrySecrets: RegistrySecrets,
|
||||||
) {
|
) {
|
||||||
// Check for invalid options
|
// Check for invalid options
|
||||||
const remoteOnlyOptions: Array<keyof FlagsDef> = ['release-tag'];
|
const remoteOnlyOptions: Array<keyof FlagsDef> = ['release-tag', 'draft'];
|
||||||
this.checkInvalidOptions(
|
this.checkInvalidOptions(
|
||||||
remoteOnlyOptions,
|
remoteOnlyOptions,
|
||||||
options,
|
options,
|
||||||
|
@ -42,6 +42,7 @@ export interface BuildOpts {
|
|||||||
headless: boolean;
|
headless: boolean;
|
||||||
convertEol: boolean;
|
convertEol: boolean;
|
||||||
multiDockerignore: boolean;
|
multiDockerignore: boolean;
|
||||||
|
isDraft: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RemoteBuild {
|
export interface RemoteBuild {
|
||||||
@ -92,6 +93,7 @@ async function getBuilderEndpoint(
|
|||||||
emulated: opts.emulated,
|
emulated: opts.emulated,
|
||||||
nocache: opts.nocache,
|
nocache: opts.nocache,
|
||||||
headless: opts.headless,
|
headless: opts.headless,
|
||||||
|
isdraft: opts.isDraft,
|
||||||
});
|
});
|
||||||
// Note that using https (rather than http) is a requirement when using the
|
// Note that using https (rather than http) is a requirement when using the
|
||||||
// --registry-secrets feature, as the secrets are not otherwise encrypted.
|
// --registry-secrets feature, as the secrets are not otherwise encrypted.
|
||||||
|
@ -73,6 +73,7 @@ const commonQueryParams = [
|
|||||||
['emulated', 'false'],
|
['emulated', 'false'],
|
||||||
['nocache', 'false'],
|
['nocache', 'false'],
|
||||||
['headless', 'false'],
|
['headless', 'false'],
|
||||||
|
['isdraft', 'false'],
|
||||||
];
|
];
|
||||||
|
|
||||||
const hr =
|
const hr =
|
||||||
|
Reference in New Issue
Block a user