Set up Git
task-run "set git", "git-base", %(
email => 'melezhik@gmail.com',
name => 'Alexey Melezhik',
config_scope => 'local',
set_credential_cache => 'on'
);
List total commits by author (sorted by commit count)
my %state = task-run "commits-by-authors", "git-commits-by-author";
for %state%<list><> -> $i {
say "author: ",$i, "commits: ", $i, "email: ", $i
}
Aueue Azure DevOps build and wait till it finishes
my %state = task_run "run my build", "ado-pipeline-build", %(
name => "WebApp",
variables => "foo:1 bar:2"
action => "run"
);
# wait till the my build finishes
task_run "wait my build", "ado-pipeline-build", %(
action => "wait",
build_id => %state<build_id>
);
Run GitLab Pipeline
task-run "pipe-run", "gitlab-run-pipeline", %(
debug => True,
project => 1001,
gitlab_api => "https://git.company.com/api/v4/",
variables => %(
color => "green",
size => "big",
use_salt => True
)
)
Test if a k8s deployment exists and has attributes
task-run "dpl check", "k8s-deployment-check" %(
name => "animals",
namespace => "pets",
cat => %(
command => "/usr/bin/cat",
args => [
"eat", "milk", "fish"
],
env => [
"ENABLE_LOGGING"
]
volume-mounts => {
foo-bar => "/opt/foo/bar",
}
)
);
Test if k8s config map exists and has entries
task-run "cm check", "k8s-config-check", %(
type => "configmap",
name => "web-config",
namespace => "dashboards",
# check if we have admin and password entries
# in config map
data => [
"note: creds for login",
"[admin=root]",
'regexp: "[password=" \S+ "]" $$',
]
);
Check that Azure KV secrets exists
task-run "check secrets", "azure-kv-secrets-check", %(
name => "kv100", # the name of keyvault
exists => [ # these keys should exists
'password1',
'password2',
'db-password1',
'db-password2'
]
)
Calculate permission number for Azure Devops permissions
task-run "permissions sum", "ado-permissions-calculator", %(
namespace => "Library",
actions => qqw{View Create}
);
Lint yaml files
task-run "lint these files", "yaml-lint", %(
files => "path/to/dir/*.yaml",
use_python => False
);
Clean up python cache files
task-run "clean-cache", "python-helpers", %(
task => "clean-cache",
dir => [ "{%*ENV}/.local", '/tmp/foo/' ]
)