| 1 | # SPDX-FileCopyrightText: SUSE LLC | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # SPDX-License-Identifier: GPL-2.0-or-later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | package Cavil::CLI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use Mojo::Base -base, -signatures; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Cavil::CLI::Archive; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Cavil::CLI::Client; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Cavil::CLI::Config; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | ▶ | use Cavil::CLI::Progress; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | ▶ | use Cavil::CLI::Util qw(gate render_json render_text); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use Mojo::File qw(path tempdir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | use Mojo::JSON qw(to_json); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 6 | ▶ | use Mojo::Util qw(encode extract_usage getopt); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | ▶ | use Time::HiRes (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | our $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | has client => sub { Cavil::CLI::Client->new }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # Exit codes: clean, gate failed, usage/config problem, server/connection error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 6 | ▶ | use constant {EXIT_CLEAN => 0, EXIT_GATE => 1, EXIT_USAGE => 2, EXIT_SERVER => 3}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # Refuse before uploading an archive the server would reject anyway, so an accidental huge file (a build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # artifact, a data dump) fails fast with guidance instead of a slow doomed upload. Defaults to Cavil's own | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | # request limit; CAVIL_MAX_UPLOAD_MB raises it for an instance configured to accept more. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | ▶ | use constant UPLOAD_MAX_MB => 250; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 9 | ▶ | sub _max_upload_bytes () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_max_upload_bytes: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 9 | ▶ | return (defined $ENV{CAVIL_MAX_UPLOAD_MB} ? $ENV{CAVIL_MAX_UPLOAD_MB} : UPLOAD_MAX_MB) * 1024 * 1024; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 18 | ▶ | sub run ($self) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=26 SCAR=38.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 18 | getopt | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 'url=s' => \my $url_opt, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 'name=s' => \my $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 'priority=i' => \my $priority, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 'fail-on-risk=i' => \my $fail_on_risk, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 'external-link=s' => \my $external_link, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 'sbom:s' => \my $sbom, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 'notice:s' => \my $notice, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 'respect-gitignore' => \my $respect_gitignore, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 'exclude-path=s@' => \my $exclude_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 'timeout=i' => \my $timeout, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 'format=s' => \my $format, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 'show' => \my $show, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 'no-color' => \my $no_color, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 'quiet' => \my $quiet, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 'h|help' => \my $help; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 18 | ▶ | return print(extract_usage) ? EXIT_CLEAN : EXIT_CLEAN if $help; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 18 | my ($command, $path) = @ARGV; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 18 | ▶ | unless (defined $command && ($command eq 'check' || $command eq 'whoami' || $command eq 'config')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%6/9
defined $command and $command eq "check" || $command eq "whoami" || $command eq "config"
$command eq "check" or $command eq "whoami" or $command eq "config"
$command eq "check" or $command eq "whoami"
MC/DC0%0/4
defined $command and $command eq "check" || $command eq "whoami" || $command eq "config"
defined $command
$command eq "check"
$command eq "whoami"
$command eq "config"
Truth table60%3/5
A and B or C or D
A= defined $commandB= $command eq "check"C= $command eq "whoami"D= $command eq "config"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | print STDERR extract_usage; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | return EXIT_USAGE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 18 | my $config = Cavil::CLI::Config->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # Saving settings needs no server, and is the only place a URL may be given: see below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 18 | ▶ | return $self->_config($config, $url_opt, $show) if $command eq 'config'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 16 | ▶ | if (defined $url_opt) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 1 | print STDERR "--url only applies to 'cavil-cli config'; set CAVIL_URL (with CAVIL_API_KEY) to aim elsewhere\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 1 | return EXIT_USAGE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | # Server and token are resolved together, from one source, and never mixed. Taking the URL from one place and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | # the token from another is how a token saved for one instance ends up being sent to a different one. For the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # same reason there is no --token at all: an argument is world-readable in ps and stays in shell history. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | my ($url, $token) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | = defined $ENV{CAVIL_URL} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 15 | ▶ | || defined $ENV{CAVIL_API_KEY} ? ($ENV{CAVIL_URL}, $ENV{CAVIL_API_KEY}) : @{$config->load}{qw(url token)}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $ENV{"CAVIL_URL"} or defined $ENV{"CAVIL_API_KEY"}
MC/DC100%2/2
defined $ENV{"CAVIL_URL"} or defined $ENV{"CAVIL_API_KEY"}
defined $ENV{"CAVIL_URL"}
defined $ENV{"CAVIL_API_KEY"}
Truth table100%3/3
A or B
A= defined $ENV{"CAVIL_URL"}B= defined $ENV{"CAVIL_API_KEY"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 15 | ▶ | unless (defined $url && defined $token) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $url and defined $token
MC/DC100%2/2
defined $url and defined $token
defined $url
defined $token
Truth table100%3/3
A and B
A= defined $urlB= defined $token
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | print STDERR "A Cavil URL and API token are required, from the same source:\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | . " run 'cavil-cli config' to save both, or set CAVIL_URL and CAVIL_API_KEY together\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 2 | return EXIT_USAGE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 13 | ▶ | $format //= 'text'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$format //= "text"
MC/DC100%1/1
$format //= "text"
$format
Truth table100%2/2
A
A= $format
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 13 | ▶ | return $self->_whoami({url => $url, token => $token, format => $format}) if $command eq 'whoami'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 9 | my %seen; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | my @exclude_paths = grep { !$seen{$_}++ } map {s{/\z}{}r} grep {length} @{$exclude_path // []}, split /[\s,]+/, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$exclude_path // []
$ENV{"CAVIL_EXCLUDE_PATHS"} // ""
MC/DC0%0/1
$exclude_path // []
$exclude_path
MC/DC0%0/1
$ENV{"CAVIL_EXCLUDE_PATHS"} // ""
$ENV{"CAVIL_EXCLUDE_PATHS"}
Truth table50%1/2
A
A= $exclude_path
Truth table50%1/2
A
A= $ENV{"CAVIL_EXCLUDE_PATHS"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 9 | ($ENV{CAVIL_EXCLUDE_PATHS} // ''); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 9 | ▶ | my $color = $format eq 'text' && !$no_color && !$ENV{NO_COLOR} && -t STDOUT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
$format eq 'text' && !$no_color && !$ENV{'NO_COLOR'} && -t STDOUT
$format eq "text" and not $no_color and not $ENV{"NO_COLOR"}
$format eq "text" and not $no_color
MC/DC0%0/4
$format eq 'text' && !$no_color && !$ENV{'NO_COLOR'} && -t STDOUT
$format eq "text"
not $no_color
not $ENV{"NO_COLOR"}
-t STDOUT
Truth table20%1/5
A and not(B) and not(C) && D
A= $format eq "text"B= not $no_colorC= not $ENV{"NO_COLOR"}D= -t STDOUT
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 9 | ▶ | return $self->_check( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition44%4/9
$path // "."
$priority // 5
$timeout // 900
not $quiet and -t STDERR
MC/DC0%0/1
$path // "."
$path
MC/DC0%0/1
$priority // 5
$priority
MC/DC0%0/1
$timeout // 900
$timeout
MC/DC0%0/2
not $quiet and -t STDERR
not $quiet
-t STDERR
Truth table50%1/2
A
A= $path
Truth table50%1/2
A
A= $priority
Truth table50%1/2
A
A= $timeout
Truth table33%1/3
not(A) and B
A= not $quietB= -t STDERR
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | $path // '.', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | url => $url, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | token => $token, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | priority => $priority // 5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | fail_on_risk => $fail_on_risk, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | external_link => $external_link, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | sbom => $sbom, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | notice => $notice, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | respect_gitignore => $respect_gitignore ? 1 : 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | exclude_paths => \@exclude_paths, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | timeout => $timeout // 900, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | format => $format, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | color => $color, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | progress => (!$quiet && -t STDERR ? 1 : 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | # Save the Cavil URL and API token to the config file, or show what is stored. The token is read from a hidden | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | # prompt, or from stdin when piped; there is no option to pass it, anywhere. --show never prints it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 2 | ▶ | sub _config ($self, $config, $url, $show) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_config: called CC=16 SCAR=39.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 2 | my $saved = $config->load; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 2 | ▶ | if ($show) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | print STDOUT 'Configuration file: ' . $config->file . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1 | ▶ | print STDOUT ' url: ' . ($saved->{url} // '(not set)') . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$saved->{"url"} // "(not set)"
MC/DC0%0/1
$saved->{"url"} // "(not set)"
$saved->{"url"}
Truth table50%1/2
A
A= $saved->{"url"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1 | ▶ | print STDOUT ' token: ' . ($saved->{token} ? '******** (set)' : '(not set)') . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 1 | return EXIT_CLEAN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | # The URL is not secret, so it may come from --url; otherwise prompt, offering the current value as default. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 1 | ▶ | if (defined $url) { $saved->{url} = $url } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | my $current = $saved->{url}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | print STDERR 'Cavil URL' . (defined $current ? " [$current]" : '') . ': '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $line = readline STDIN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | chomp $line if defined $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | $saved->{url} = $line if defined $line && length $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $line and length $line
MC/DC0%0/2
defined $line and length $line
defined $line
length $line
Truth table0%0/3
A and B
A= defined $lineB= length $line
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | # The token is secret: hidden prompt on a terminal, one stdin line when piped. Empty input keeps the existing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 1 | ▶ | my $entered = _read_secret('Cavil API token' . ($saved->{token} ? ' [keep existing]' : '') . ': '); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | ▶ | $saved->{token} = $entered if defined $entered && length $entered; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $entered and length $entered
MC/DC0%0/2
defined $entered and length $entered
defined $entered
length $entered
Truth table33%1/3
A and B
A= defined $enteredB= length $entered
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 1 | ▶ | unless (length($saved->{url} // '') && length($saved->{token} // '')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition42%3/7
length($saved->{"url"} // "") and length($saved->{"token"} // "")
$saved->{"url"} // ""
$saved->{"token"} // ""
MC/DC0%0/2
length($saved->{"url"} // "") and length($saved->{"token"} // "")
$saved->{"url"}
$saved->{"token"}
Truth table33%1/3
A and B
A= $saved->{"url"}B= $saved->{"token"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | print STDERR "A Cavil URL and API token are both required\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | return EXIT_USAGE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 1 | $config->save($saved); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 1 | print STDOUT 'Saved configuration to ' . $config->file . " (token hidden)\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 1 | return EXIT_CLEAN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | # Read one line without echoing it, so a typed token never appears on screen. Only toggles the terminal when | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | # stdin is one; piped input (tests, scripts) is read as a plain line. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 1 | ▶ | sub _read_secret ($prompt) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_read_secret: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 1 | print STDERR $prompt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 1 | my $hide = -t STDIN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 1 | ▶ | system('stty', '-echo') if $hide; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | my $line = readline STDIN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | if ($hide) { system('stty', 'echo'); print STDERR "\n" } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | ▶ | chomp $line if defined $line; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | return $line; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | # Confirm the url and token work by asking the instance who the token belongs to, and time the round trip so a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | # user can also see the instance is reachable and responsive. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 4 | ▶ | sub _whoami ($self, $opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_whoami: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 4 | my $client = $self->client->url($opts->{url})->token($opts->{token}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 4 | my $t0 = Time::HiRes::time; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 4 | my $info = eval { $client->whoami }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 4 | my $ms = int((Time::HiRes::time - $t0) * 1000); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 4 | ▶ | if (my $err = $@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 1 | chomp(my $msg = $err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 1 | print STDERR "Not authenticated with $opts->{url}:\n $msg\n" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | . "Check the saved config ('cavil-cli config --show'), or CAVIL_URL / CAVIL_API_KEY.\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | return EXIT_SERVER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 3 | ▶ | if ($opts->{format} eq 'json') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | print STDOUT encode('UTF-8', to_json({%$info, round_trip_ms => $ms}) . "\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 1 | return EXIT_CLEAN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | ▶ | my $roles = @{$info->{roles} || []} ? join(', ', @{$info->{roles}}) : 'none'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$info->{'roles'} || []
MC/DC0%0/1
$info->{'roles'} || []
$info->{'roles'}
Truth table50%1/2
A
A= $info->{'roles'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | print STDOUT encode('UTF-8', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 2 | ▶ | "Authenticated as $info->{user} (id @{[$info->{id} // '?']}) on $opts->{url}\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$info->{"id"} // "?"
MC/DC0%0/1
$info->{"id"} // "?"
$info->{"id"}
Truth table50%1/2
A
A= $info->{"id"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | . " roles: $roles\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 2 | ▶ | . " write access: @{[$info->{write_access} ? 'yes' : 'no']}\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | . " round-trip: $ms ms\n"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 2 | return EXIT_CLEAN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | # Upload the working tree, wait for the standard review, then print the verdict and gate the exit code on risk. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 9 | ▶ | sub _check ($self, $dir, $opts) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check: called CC=14 SCAR=28.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 9 | my $client = $self->client->url($opts->{url})->token($opts->{token}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 9 | my $progress = Cavil::CLI::Progress->new(enabled => $opts->{progress}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | $client->on_wait(sub { $progress->spin }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | # Confirm access before packaging what may be a large tree, and fail with a clear reason if the key cannot. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 9 | eval { $client->whoami }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 9 | ▶ | if (my $err = $@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | $progress->finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | chomp(my $msg = $err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | print STDERR "Not authenticated with $opts->{url}:\n $msg\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | return EXIT_SERVER; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 9 | ▶ | my $name = $opts->{name} // _package_name($dir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$opts->{"name"} // _package_name($dir)
MC/DC0%0/2
$opts->{"name"} // _package_name($dir)
$opts->{"name"}
_package_name($dir)
Truth table66%2/3
A // B
A= $opts->{"name"}B= _package_name($dir)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 9 | ▶ | my $link = $opts->{external_link} // _external_link($dir); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$opts->{"external_link"} // _external_link($dir)
MC/DC0%0/2
$opts->{"external_link"} // _external_link($dir)
$opts->{"external_link"}
_external_link($dir)
Truth table33%1/3
A // B
A= $opts->{"external_link"}B= _external_link($dir)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 9 | my $tmp = tempdir; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 9 | my $archive = $tmp->child('upload.tar.gz')->to_string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 9 | $progress->start("Packaging $name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 9 | my $checksum = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | Cavil::CLI::Archive->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | dir => $dir, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | respect_gitignore => $opts->{respect_gitignore}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | excludes => $opts->{exclude_paths} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 9 | )->build($archive); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if (my $err = $@) { $progress->finish; chomp(my $m = $err); print STDERR "$m\n"; return EXIT_USAGE; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 9 | my $max_bytes = _max_upload_bytes(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 9 | my $size = -s $archive; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 9 | ▶ | if ($size > $max_bytes) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | $progress->finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 1 | printf STDERR "The archive is %d MiB, over the %d MiB upload limit. Trim it with a .cavilignore file or " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | . "--exclude-path (or remove large generated files), then try again.\n", $size / 1024 / 1024, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | $max_bytes / 1024 / 1024; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 1 | return EXIT_USAGE; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 8 | $progress->start('Uploading'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 8 | my $saved = eval { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | $client->upload($archive, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 8 | {name => $name, priority => $opts->{priority}, checksum => $checksum, external_link => $link}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 8 | ▶ | if (my $err = $@) { $progress->finish; chomp(my $m = $err); print STDERR "$m\n"; return EXIT_SERVER; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 5 | my $id = $saved->{saved}{id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 5 | $progress->start('Reviewing'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 5 | my $json = eval { _poll($client, $id, $opts->{timeout}, $progress) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 5 | my $poll_err = $@; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 5 | $progress->finish; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | if ($poll_err) { chomp(my $m = $poll_err); print STDERR "$m\n"; return EXIT_SERVER } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 5 | my $info = _verdict($json, $opts, $id, $name); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # Optional documents, requested when --sbom / --notice are present (with or without an explicit path). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 5 | ▶ | $progress->start('Fetching documents') if defined $opts->{sbom} || defined $opts->{notice}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $opts->{"sbom"} or defined $opts->{"notice"}
MC/DC50%1/2
defined $opts->{"sbom"} or defined $opts->{"notice"}
defined $opts->{"sbom"}
defined $opts->{"notice"}
Truth table66%2/3
A or B
A= defined $opts->{"sbom"}B= defined $opts->{"notice"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | $info->{sbom} = _save_document($client, $id, 'spdx', $opts->{sbom}, "$name.spdx.json", $opts->{timeout}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 5 | ▶ | if defined $opts->{sbom}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | $info->{notice} = _save_document($client, $id, 'notice', $opts->{notice}, "$name.NOTICE.txt", $opts->{timeout}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 5 | ▶ | if defined $opts->{notice}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 5 | ▶ | my $output = $opts->{format} eq 'json' ? render_json($info) : render_text($info, color => $opts->{color}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 5 | print STDOUT encode('UTF-8', $output); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 5 | ▶ | return gate($info->{risk}, $info->{threshold})->{failed} ? EXIT_GATE : EXIT_CLEAN; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | # Server pipeline stages, mapped to what the progress line shows, so the wait names what is happening rather | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | # than sitting on a bare "Reviewing". | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 6 | my %STAGE_LABEL = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | queued => 'Queued for review', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | unpacking => 'Unpacking', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | indexing => 'Indexing', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | analyzing => 'Analyzing', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | finalizing => 'Finalizing report' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | # Poll the report until it is ready, showing the current pipeline stage between attempts; die on timeout. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 5 | ▶ | sub _poll ($client, $id, $timeout, $progress) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_poll: called CC=6 SCAR=18.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 5 | my $deadline = Time::HiRes::time + $timeout; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 5 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 6 | my $res = $client->report($id, 'json'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 6 | ▶ | return $res->{data} if $res->{ready}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 1 | ▶ | $progress->label($STAGE_LABEL{$res->{stage} // ''} // 'Reviewing'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$STAGE_LABEL{$res->{"stage"} // ""} // "Reviewing"
$res->{"stage"} // ""
MC/DC0%0/1
$STAGE_LABEL{$res->{"stage"} // ""} // "Reviewing"
$STAGE_LABEL{$res->{"stage"} // ""}
MC/DC0%0/1
$res->{"stage"} // ""
$res->{"stage"}
Truth table50%1/2
A
A= $STAGE_LABEL{$res->{"stage"} // ""}
Truth table50%1/2
A
A= $res->{"stage"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | ▶ | die "Timed out after ${timeout}s waiting for the review (package $id)\n" if Time::HiRes::time >= $deadline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 1 | for (1 .. 10) { $progress->spin; Time::HiRes::sleep(0.2) } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # Normalize a report response into the flat verdict the renderers consume. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 5 | ▶ | sub _verdict ($json, $opts, $id, $name) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_verdict: called CC=9 SCAR=22.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 5 | ▶ | my $pkg = $json->{package} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$json->{"package"} // {}
MC/DC0%0/1
$json->{"package"} // {}
$json->{"package"}
Truth table50%1/2
A
A= $json->{"package"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 5 | ▶ | my $rep = $json->{report} // {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$json->{"report"} // {}
MC/DC0%0/1
$json->{"report"} // {}
$json->{"report"}
Truth table50%1/2
A
A= $json->{"report"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 5 | ▶ | my $accept = $json->{acceptable_risk} // 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$json->{"acceptable_risk"} // 3
MC/DC0%0/1
$json->{"acceptable_risk"} // 3
$json->{"acceptable_risk"}
Truth table50%1/2
A
A= $json->{"acceptable_risk"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 5 | ▶ | my $threshold = $opts->{fail_on_risk} // ($accept + 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$opts->{"fail_on_risk"} // $accept + 1
MC/DC100%1/1
$opts->{"fail_on_risk"} // $accept + 1
$opts->{"fail_on_risk"}
Truth table100%2/2
A
A= $opts->{"fail_on_risk"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | my @licenses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 4 | ▶ | = sort { $b->{risk} <=> $a->{risk} || $a->{name} cmp $b->{name} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$Cavil::CLI::b->{'risk'} <=> $Cavil::CLI::a->{'risk'} || $Cavil::CLI::a->{'name'} cmp $Cavil::CLI::b->{'name'}
MC/DC0%0/2
$Cavil::CLI::b->{'risk'} <=> $Cavil::CLI::a->{'risk'} || $Cavil::CLI::a->{'name'} cmp $Cavil::CLI::b->{'name'}
$Cavil::CLI::b->{'risk'} <=> $Cavil::CLI::a->{'risk'}
$Cavil::CLI::a->{'name'} cmp $Cavil::CLI::b->{'name'}
Truth table66%2/3
A || B
A= $Cavil::CLI::b->{'risk'} <=> $Cavil::CLI::a->{'risk'}B= $Cavil::CLI::a->{'name'} cmp $Cavil::CLI::b->{'name'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 9 | map { {name => $_, risk => $rep->{licenses}{$_}{risk}, spdx => $rep->{licenses}{$_}{spdx}} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 5 | ▶ | keys %{$rep->{licenses} // {}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$rep->{"licenses"} // {}
MC/DC0%0/1
$rep->{"licenses"} // {}
$rep->{"licenses"}
Truth table50%1/2
A
A= $rep->{"licenses"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 5 | my $risk = $json->{risk}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | risk => $risk, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | acceptable_risk => $accept, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | threshold => $threshold, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | state => $pkg->{state}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | unresolved => $pkg->{unresolved_matches} // 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | licenses => \@licenses, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | report_url => "$opts->{url}/reviews/details/$id", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 5 | ▶ | gate => (gate($risk, $threshold)->{failed} ? 'fail' : 'pass') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$pkg->{"unresolved_matches"} // 0
MC/DC0%0/1
$pkg->{"unresolved_matches"} // 0
$pkg->{"unresolved_matches"}
Truth table50%1/2
A
A= $pkg->{"unresolved_matches"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | # Download a generated document to a file, polling while the server builds it. Returns the path written. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 1 | ▶ | sub _save_document ($client, $id, $key, $requested, $default, $timeout) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_save_document: called CC=5 SCAR=17.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 1 | ▶ | my $file = length($requested // '') ? $requested : $default; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$requested // ""
MC/DC0%0/1
$requested // ""
$requested
Truth table50%1/2
A
A= $requested
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 1 | my $deadline = Time::HiRes::time + $timeout; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | 1 | while (1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 2 | my $body = $client->document($id, $key); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 2 | ▶ | if (defined $body) { path($file)->spew($body); return $file } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | ▶ | last if Time::HiRes::time >= $deadline; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 1 | Time::HiRes::sleep(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | print STDERR "Timed out waiting for the $key document\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # A package name Cavil accepts (^[A-Za-z0-9.-]+$), derived from the directory being checked. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 1 | ▶ | sub _package_name ($dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_package_name: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 1 | my $base = path($dir)->to_abs->basename; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | $base =~ s/[^A-Za-z0-9.\-]+/-/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 1 | $base =~ s/^-+|-+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 1 | ▶ | return length $base ? $base : 'project'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | # Best-effort provenance for the review: the git remote and short commit, when the tree is a checkout. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 9 | ▶ | sub _external_link ($dir) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_external_link: called CC=3 SCAR=18.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 9 | ▶ | my $rev = _git($dir, 'rev-parse', '--short', 'HEAD') // return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
_git($dir, "rev-parse", "--short", "HEAD") // (return undef)
MC/DC0%0/1
_git($dir, "rev-parse", "--short", "HEAD") // (return undef)
_git($dir, "rev-parse", "--short", "HEAD")
Truth table50%1/2
A
A= _git($dir, "rev-parse", "--short", "HEAD")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | my $url = _git($dir, 'config', '--get', 'remote.origin.url'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | return defined $url ? "$url\@$rev" : $rev; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 9 | ▶ | sub _git ($dir, @args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_git: called CC=4 SCAR=18.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 9 | my $cmd = join ' ', 'git', '-C', quotemeta($dir), map { quotemeta $_ } @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 9 | my $out = `$cmd 2>/dev/null`; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 9 | ▶ | return undef if !defined $out || $? != 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $out or $? != 0
MC/DC0%0/2
not defined $out or $? != 0
not defined $out
$? != 0
Truth table33%1/3
not(A) or B
A= not defined $outB= $? != 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | chomp $out; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | return length $out ? $out : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | Cavil::CLI - Submit a project to Cavil for a legal review and gate CI on the result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | Usage: cavil-cli <command> [DIR] [OPTIONS] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | # Save the URL and token once (prompts for the token without echoing it) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | cavil-cli config --url https://legaldb.suse.de | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | # Confirm the URL and token are set up right (and time the round trip) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | cavil-cli whoami | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # Upload the current directory for a legal review and print the verdict | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | cavil-cli check | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | # Check another directory, and also download the SBOM | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | cavil-cli check ./project --sbom | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | # Machine-readable output for CI (URL and token from the environment) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | CAVIL_URL=https://legaldb.suse.de CAVIL_API_KEY=1234 cavil-cli check --format json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | Commands: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | check [DIR] Upload a project for a legal review and report its licensing risk (default DIR: .) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | whoami Show the user the token belongs to, to verify login | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | config Save the URL and token to ~/.config/cavil-cli (--show to display, token masked) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | Credentials come from the saved config ("cavil-cli config"), or CAVIL_URL/CAVIL_API_KEY in CI, always as a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | pair from one source. There is no --token (an argument is world-readable in ps and stays in shell history), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | and --url is only accepted by "config", since aiming elsewhere would send it a token saved for this server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | The uploaded archive is the working tree as it sits on disk, including installed vendored dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | (node_modules and the like) that a full legal review must cover; only .git and excludes are dropped. If the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | archive is over the server's upload limit (250 MiB by default, or CAVIL_MAX_UPLOAD_MB) the check refuses | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | before uploading and tells you to trim it, so an accidental large file does not start a doomed upload. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | Options: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | --url <url> Cavil server URL, when saving settings ("config" only) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | --name <name> Package name to review under (default: the directory name) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | --priority <n> Review priority 1-8 (default 5) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | --fail-on-risk <n> Exit non-zero at this risk or above (default: the instance's acceptable risk + 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | --external-link <s> Source label for traceability (default: the git remote and commit, if any) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | --sbom [<file>] Download the SPDX SBOM (default file: <name>.spdx.json) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | --notice [<file>] Download the NOTICE attribution file (default file: <name>.NOTICE.txt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | --respect-gitignore Also drop .gitignore'd paths from the archive (off by default, to keep vendored code) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | --exclude-path <p> Drop this path from the archive (a tar pattern). Repeatable; also CAVIL_EXCLUDE_PATHS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | --timeout <n> Seconds to wait for the review before giving up (default 900) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | --format <format> Output format, "text" (default) or "json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | --no-color Disable coloured output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | --quiet Do not show the progress line while working | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | -h, --help Show this summary of available options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | A command-line client that uploads the project you are working on to a Cavil instance, runs its standard legal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | review, and reports the licensing risk, for a developer's laptop or a CI gate. See C<docs/Architecture.md> for | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | the design. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||