ci: use tags as markers

This commit is contained in:
Fu Hanxi
2022-05-22 00:38:17 +08:00
parent 3e78898d2c
commit 7e0bb1dabd
4 changed files with 118 additions and 128 deletions
+13
View File
@@ -204,6 +204,16 @@ class Gitlab(object):
return os.path.join(os.path.realpath(destination), root_name)
def get_job_tags(self, job_id: int) -> str:
"""
Get tags of a job
:param job_id: job id
:return: comma-separated tags of the job
"""
job = self.project.jobs.get(job_id)
return ','.join(job.tag_list)
def main() -> None:
parser = argparse.ArgumentParser()
@@ -231,6 +241,9 @@ def main() -> None:
elif args.action == 'get_project_id':
ret = gitlab_inst.get_project_id(args.project_name)
print('project id: {}'.format(ret))
elif args.action == 'get_job_tags':
ret = gitlab_inst.get_job_tags(args.job_id)
print(ret)
if __name__ == '__main__':
+10 -5
View File
@@ -62,17 +62,22 @@ function warning() {
}
function run_cmd() {
local args=( "$@" )
local cmd="${args[@]}"
local start=$(date +%s)
eval "$@"
info "\$ ${cmd}"
eval "${cmd}"
local ret=$?
local end=$(date +%s)
local duration=$((end - start))
local runtime=$((end-start))
if [[ $ret -eq 0 ]]; then
info "(\$ $*) succeeded in ${duration} seconds."
info "==> '\$ ${cmd}' succeeded in ${runtime} seconds."
return 0
else
error "(\$ $*) failed in ${duration} seconds."
echo
error "==> '\$ ${cmd}' failed (${ret}) in ${runtime} seconds."
return $ret
fi
}