Project: new-project

Build now

Configuration

sparrowdo:
  no_sudo: true
  no_index_update: true
  bootstrap: false
  format: default
allow_manual_run: true
vars:
  -
      name: repo
      type: input
  -
      name: disabled
      type: checkbox
      default: false

Job

#!raku

my $git = tags()<repo> || die "repo required";
my $base = "{%*ENV<HOME>}/.sparky";
my $image = tags()<image> || "debian_arm";

say "git: $git";

$git ~~ /<-[\w\_\-\.\@\:\/\\\s\^\~]>/ && die "bad symbols found in repo (hackers attempt?)";

bash "timeout 20 git ls-remote --exit-code -h \"$git\"", %(
  :description<check if this is valid git repo>
);

my $repo;

if $git ~~ / \S+ '@' \S+ ":" (\S+) / {
  $repo = "$0".split("/").tail(2).join("-");
} else {
  $repo = $git.split("/").tail(2).join("-");
}

say "repo: $repo";

my $container = $repo.subst(/<-[\w]>/,"",:g);

say "container: $container";

directory "$base/projects/$repo";

my $disabled = tags()<disabled> ?? True !! False;

say "disabled: $disabled";

template6 "$base/projects/$repo/sparky.yaml", %(
 vars => %(
  :$repo,
  :$git,
  :$image,
  :$container,
  :$disabled,
 ),
 :template_dir<templates>,
 :template<sparky>,
 #:dry_run, 
);

file "$base/projects/$repo/sparrowfile", %(
  action  => 'create',
  mode    => '644',
  content => "files/sparrowfile".IO.slurp,
);