balena-cli
Version:
The official balena Command Line Interface
47 lines (45 loc) • 1.93 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const core_1 = require("@oclif/core");
const _1 = require(".");
const lazy_1 = require("../../utils/lazy");
class ReleaseFinalizeCmd extends core_1.Command {
async run() {
const { args: params } = await this.parse(ReleaseFinalizeCmd);
const balena = (0, lazy_1.getBalenaSdk)();
const release = await balena.models.release.get(params.commitOrId, {
$select: ['id', 'is_final'],
});
if (release.is_final) {
console.log(`Release ${params.commitOrId} is already finalized!`);
return;
}
await balena.models.release.finalize(release.id);
console.log(`Release ${params.commitOrId} finalized`);
}
}
ReleaseFinalizeCmd.description = (0, lazy_1.stripIndent) `
Finalize a release.
Finalize a release. Releases can be "draft" or "final", and this command
changes a draft release into a final release. Draft releases can be created
with the \`--draft\` option of the \`balena build\` or \`balena deploy\`
commands.
Draft releases are not automatically deployed to devices tracking the latest
release. For a draft release to be deployed to a device, the device should be
explicity pinned to that release. Conversely, final releases may trigger immediate
deployment to unpinned devices (subject to a device's polling period) and, for
this reason, final releases cannot be changed back to draft status.
`;
ReleaseFinalizeCmd.examples = [
'$ balena release finalize a777f7345fe3d655c1c981aa642e5555',
'$ balena release finalize 1234567',
];
ReleaseFinalizeCmd.args = {
commitOrId: (0, _1.commitOrIdArg)({
description: 'the commit or ID of the release to finalize',
required: true,
}),
};
ReleaseFinalizeCmd.authenticated = true;
exports.default = ReleaseFinalizeCmd;
//# sourceMappingURL=finalize.js.map