Blyx Nest Blyx language
Registry / Framework
framework · v0.1.2

Artifact Promote

Promote exactly the artifact digest token that passed staging and block substituted build IDs.

Source repository · Package JSON

Use Artifact Promote

use vendor::artifact_promote::artifact_promote;

Run the example

nest demo artifact_promote@0.1.2
blyxc native-run artifact_promote-demo/main.blyx
Example source and expected output
use std::cli;
use std::text;
use vendor::artifact_promote::artifact_promote;

fn main() {
    let arguments = cli_args();
    if args_len(arguments) > 0 {
        if args_len(arguments) % 2 != 0 {
            stderr_line("Expected event and value pairs");
            process_exit(2);
        }
        let mut live = artifact_promote_start();
        let mut i = 0;
        while i < args_len(arguments) {
            let input = args_at(arguments, i + 1);
            if !text_is_number(input) {
                stderr_line("Expected a whole numeric event value");
                process_exit(2);
            }
            live = artifact_promote_step(live, args_at(arguments, i), text_number(input));
            let command = artifact_promote_command(live);
            println!(command);
            if command == "reject" { process_exit(1); }
            i += 2;
        }
        return;
    }
    let mut state = artifact_promote_start();
    state = artifact_promote_step(state, "build", 17.0);
    println!(artifact_promote_command(state));
    state = artifact_promote_step(state, "passed", 17.0);
    println!(artifact_promote_command(state));
    state = artifact_promote_step(state, "approve", 17.0);
    println!(artifact_promote_command(state));
    state = artifact_promote_step(state, "promote", 18.0);
    println!(artifact_promote_command(state));
    state = artifact_promote_step(state, "promote", 17.0);
    println!(artifact_promote_command(state));
}

Expected output

deploy_staging
request_signoff
permit_promotion
reject
deploy_production

Published versions

VersionPackageSource commitSHA-256
0.1.2Download ZIP · Browse filesae53b937c70fd495eff0e501bf14b436d67eb6d2877ff0e8dd153ae383bdf9e794befd48b5
0.1.1Download ZIP · Browse filesfdc3593f1aafc9eda47ffc78dd4768f7a3b260caec88613ea5b6ceb5e91eaefc4001120571
0.1.0Download ZIP · Browse files6349f237845e63fadc36c9f421a36879fe020645e9dbac5988203858106a8a243a83224ed7