File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ configure_credentials "$payload"
3838destination=$TMPDIR /git-resource-repo-cache
3939uri=$( jq -r ' .source.uri // ""' <<< " $payload" )
4040uri=${uri# }
41+ if [[ -z " $uri " ]]; then
42+ echo " source.uri is required and must not be empty"
43+ exit 1
44+ fi
4145
4246version_type=$( jq -r ' .source.version_type // "commits"' <<< " $payload" )
4347
Original file line number Diff line number Diff line change @@ -16,11 +16,6 @@ filter_exclude_all_match=$(jq -r '.source.commit_filter.exclude_all_match // fal
1616version_depth=$( jq -r ' .source.version_depth // 1' <<< " $payload" )
1717reverse=false
1818
19- if [[ -z " $uri " ]]; then
20- echo " source.uri is required and must not be empty"
21- exit 1
22- fi
23-
2419# Optimization when last commit only is checked and skip ci is disabled
2520# Get the commit id with git ls-remote instead of downloading the whole repo
2621if [ " $skip_ci_disabled " = " true" ] && \
Original file line number Diff line number Diff line change @@ -51,6 +51,10 @@ configure_credentials "$payload"
5151# These vars are used by multiple version_type's
5252uri=$( jq -r ' .source.uri // ""' <<< " $payload" )
5353uri=${uri# }
54+ if [[ -z " $uri " ]]; then
55+ echo " source.uri is required and must not be empty"
56+ exit 1
57+ fi
5458
5559version_type=$( jq -r ' .source.version_type // "commits"' <<< " $payload" )
5660
Original file line number Diff line number Diff line change @@ -26,12 +26,6 @@ if [ -z "$fetch_tags" ] || [ "$fetch_tags" == "null" ] ; then
2626 fetch_tags=$( jq -r ' .source.fetch_tags' <<< " $payload" )
2727fi
2828
29- if [ -z " $uri " ]; then
30- echo " invalid payload (missing uri):"
31- cat $payload
32- exit 1
33- fi
34-
3529branchflag=" "
3630if [ -n " $branch " ]; then
3731 branchflag=" --branch $branch "
Original file line number Diff line number Diff line change @@ -10,12 +10,6 @@ gpg_keyserver=$(jq -r '.source.gpg_keyserver // "hkp://keyserver.ubuntu.com/"' <
1010short_ref_format=$( jq -r ' (.params.short_ref_format // "%s")' <<< " $payload" )
1111timestamp_format=$( jq -r ' (.params.timestamp_format // "iso8601")' <<< " $payload" )
1212
13- if [ -z " $uri " ]; then
14- echo " invalid payload (missing uri):"
15- cat $payload
16- exit 1
17- fi
18-
1913if [ " $disable_git_lfs " == " true" ]; then
2014 # skip the fetching of LFS objects for all following git commands
2115 export GIT_LFS_SKIP_SMUDGE=1
@@ -86,7 +80,7 @@ if [ "$submodules" != "none" ]; then
8680 fi
8781
8882 # check for ssh submodule_credentials
89- submodule_cred=$( jq --arg submodule_url " ${submodule_url} " ' .source.submodule_credentials // [] | [.[] | select(.url==$submodule_url)] | first // empty' <<< ${payload} )
83+ submodule_cred=$( jq --arg submodule_url " ${submodule_url} " ' .source.submodule_credentials // [] | [.[] | select(.url==$submodule_url)] | first // empty' <<< " ${payload}" )
9084
9185 if [[ -z ${submodule_cred} ]]; then
9286
Original file line number Diff line number Diff line change @@ -45,6 +45,10 @@ configure_credentials "$payload"
4545# These vars are used by multiple version_type's
4646uri=$( jq -r ' .source.uri // ""' <<< " $payload" )
4747uri=${uri# }
48+ if [[ -z " $uri " ]]; then
49+ echo " source.uri is required and must not be empty"
50+ exit 1
51+ fi
4852
4953version_type=$( jq -r ' .source.version_type // "commits"' <<< " $payload" )
5054
Original file line number Diff line number Diff line change @@ -16,18 +16,13 @@ push_options=$(jq -r '.params.push_options // []' <<< "$payload")
1616# useful for pushing to special ref types like refs/for in gerrit.
1717refs_prefix=$( jq -r ' .params.refs_prefix // "refs/heads"' <<< " $payload" )
1818
19- if [ -z " $uri " ]; then
20- echo " invalid payload (missing uri)"
21- exit 1
22- fi
23-
2419if [ -z " $branch " ] && [ " $only_tag " != " true" ] && [ -z " $override_branch " ]; then
25- echo " invalid payload (missing branch) "
20+ echo " invalid payload. Must specify one of: source. branch, params.branch, or set params.only_tag=true "
2621 exit 1
2722fi
2823
2924if [ -z " $repository " ]; then
30- echo " invalid payload (missing repository)"
25+ echo " invalid payload (missing params. repository)"
3126 exit 1
3227fi
3328
You can’t perform that action at this time.
0 commit comments