[Dev] Check pipeline argument before starting process
This commit is contained in:
parent
48ab309698
commit
aa90bedd37
|
@ -130,7 +130,39 @@ main() (
|
|||
usage
|
||||
fail "Missing positionnal argument PIPELINE."
|
||||
fi
|
||||
|
||||
# Check pipeline validity.
|
||||
pipeline="$1"
|
||||
case "${pipeline}" in
|
||||
newcommit)
|
||||
if [ -z "${repo_name}" ]; then
|
||||
usage
|
||||
fail "missing option -n|--name for pipeline '${pipeline}'."
|
||||
fi
|
||||
if [ -z "${repo_hash}" ]; then
|
||||
usage
|
||||
fail "missing option -h|--hash for pipeline '${pipeline}'."
|
||||
fi
|
||||
;;
|
||||
newtag)
|
||||
if [ -z "${repo_name}" ]; then
|
||||
usage
|
||||
fail "Missing option -n|--name for pipeline '${pipeline}'."
|
||||
fi
|
||||
if [ -z "${repo_hash}" ]; then
|
||||
usage
|
||||
fail "Missing option -H|--hash for pipeline '${pipeline}'."
|
||||
fi
|
||||
if [ -z "${repo_tag}" ]; then
|
||||
usage
|
||||
fail "Missing option -T|--tag for pipeline '${pipeline}'."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
fail "Unexpected value for PIPELINE: '${pipeline}'."
|
||||
;;
|
||||
esac
|
||||
|
||||
# Load config file.
|
||||
if [ ! -r "${config_file}" ]; then
|
||||
|
@ -189,17 +221,9 @@ main() (
|
|||
rd_pipeline_sock_dir="${pipeline_sock_dir}/${pipeline}-${tsp}-${random}"
|
||||
rd_pipeline_sock="${rd_pipeline_sock_dir}/pipeline.sock"
|
||||
|
||||
# Check pipeline with options.
|
||||
# Build runner request.
|
||||
case "${pipeline}" in
|
||||
newcommit)
|
||||
if [ -z "${repo_name}" ]; then
|
||||
usage
|
||||
fail "Missing option -n|--name for pipeline '${pipeline}'."
|
||||
fi
|
||||
if [ -z "${repo_hash}" ]; then
|
||||
usage
|
||||
fail "Missing option -H|--hash for pipeline '${pipeline}'."
|
||||
fi
|
||||
runner_request="$(jq --null-input --compact-output \
|
||||
--arg s "${rd_pipeline_sock}" \
|
||||
--arg n "${repo_name}" \
|
||||
|
@ -207,18 +231,6 @@ main() (
|
|||
'{"response_sock":$s,"repo_name":$n,"repo_hash":$h}')"
|
||||
;;
|
||||
newtag)
|
||||
if [ -z "${repo_name}" ]; then
|
||||
usage
|
||||
fail "Missing option -n|--name for pipeline '${pipeline}'."
|
||||
fi
|
||||
if [ -z "${repo_hash}" ]; then
|
||||
usage
|
||||
fail "Missing option -H|--hash for pipeline '${pipeline}'."
|
||||
fi
|
||||
if [ -z "${repo_tag}" ]; then
|
||||
usage
|
||||
fail "Missing option -T|--tag for pipeline '${pipeline}'."
|
||||
fi
|
||||
runner_request="$(jq --null-input --compact-output \
|
||||
--arg s "${rd_pipeline_sock}" \
|
||||
--arg n "${repo_name}" \
|
||||
|
|
Loading…
Reference in New Issue