Merge pull request #2270 from balena-io/allow-draft-releases

Add `--draft` option to `balena push`
This commit is contained in:
bulldozer-balena[bot] 2021-08-15 17:07:36 +00:00 committed by GitHub
commit 3b56ed278e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 1 deletions

View File

@ -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).
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

View File

@ -58,6 +58,7 @@ interface FlagsDef {
'noconvert-eol': boolean;
'multi-dockerignore': boolean;
'release-tag'?: string[];
draft: boolean;
help: void;
}
@ -267,6 +268,14 @@ export default class PushCmd extends Command {
multiple: true,
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,
};
@ -362,6 +371,7 @@ export default class PushCmd extends Command {
registrySecrets,
headless: options.detached,
convertEol: !options['noconvert-eol'],
isDraft: options.draft,
};
const args = {
appSlug: application.slug,
@ -394,7 +404,7 @@ export default class PushCmd extends Command {
registrySecrets: RegistrySecrets,
) {
// Check for invalid options
const remoteOnlyOptions: Array<keyof FlagsDef> = ['release-tag'];
const remoteOnlyOptions: Array<keyof FlagsDef> = ['release-tag', 'draft'];
this.checkInvalidOptions(
remoteOnlyOptions,
options,

View File

@ -42,6 +42,7 @@ export interface BuildOpts {
headless: boolean;
convertEol: boolean;
multiDockerignore: boolean;
isDraft: boolean;
}
export interface RemoteBuild {
@ -92,6 +93,7 @@ async function getBuilderEndpoint(
emulated: opts.emulated,
nocache: opts.nocache,
headless: opts.headless,
isdraft: opts.isDraft,
});
// Note that using https (rather than http) is a requirement when using the
// --registry-secrets feature, as the secrets are not otherwise encrypted.

View File

@ -73,6 +73,7 @@ const commonQueryParams = [
['emulated', 'false'],
['nocache', 'false'],
['headless', 'false'],
['isdraft', 'false'],
];
const hr =