Skip to content

Commit

Permalink
check/in: ensure fetch_tags empty and null work
Browse files Browse the repository at this point in the history
Since we use true/false/"" as value, it need to be a string.
With this commit we ensure to take care about bool if user define it.

Signed-off-by: talset <talset55@gmail.com>
  • Loading branch information
talset committed Apr 21, 2020
1 parent 467097a commit c647abf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 3 additions & 4 deletions assets/check
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ branch=$(jq -r '.source.branch // ""' < $payload)
paths="$(jq -r '(.source.paths // ["."])[]' < $payload)" # those "'s are important
ignore_paths="$(jq -r '":!" + (.source.ignore_paths // [])[]' < $payload)" # these ones too
tag_filter=$(jq -r '.source.tag_filter // ""' < $payload)
fetch_tags=$(jq -r '.source.fetch_tags // ""' < $payload)
git_config_payload=$(jq -r '.source.git_config // []' < $payload)
ref=$(jq -r '.version.ref // ""' < $payload)
skip_ci_disabled=$(jq -r '.source.disable_ci_skip // false' < $payload)
Expand All @@ -38,10 +37,10 @@ configure_git_global "${git_config_payload}"
destination=$TMPDIR/git-resource-repo-cache

tagflag=""
if [ "$fetch_tags" == "false" ] ; then
tagflag="--no-tags"
elif [ -n "$tag_filter" ] || [ "$fetch_tags" == "true" ] ; then
if [ -n "$tag_filter" ] ; then
tagflag="--tags"
else
tagflag="--no-tags"
fi

# We're just checking for commits; we don't ever need to fetch LFS files here!
Expand Down
6 changes: 3 additions & 3 deletions assets/in
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ submodule_remote=$(jq -r '(.params.submodule_remote // false)' < $payload)
commit_verification_key_ids=$(jq -r '(.source.commit_verification_key_ids // [])[]' < $payload)
commit_verification_keys=$(jq -r '(.source.commit_verification_keys // [])[]' < $payload)
tag_filter=$(jq -r '.source.tag_filter // ""' < $payload)
fetch_tags=$(jq -r '.params.fetch_tags // ""' < $payload)
fetch_tags=$(jq -r '.params.fetch_tags' < $payload)
gpg_keyserver=$(jq -r '.source.gpg_keyserver // "hkp://ipv4.pool.sks-keyservers.net/"' < $payload)
disable_git_lfs=$(jq -r '(.params.disable_git_lfs // false)' < $payload)
clean_tags=$(jq -r '(.params.clean_tags // false)' < $payload)
short_ref_format=$(jq -r '(.params.short_ref_format // "%s")' < $payload)

# If params not defined, get it from source
if [ -z "$fetch_tags" ] ; then
fetch_tags=$(jq -r '.source.fetch_tags // ""' < $payload)
if [ -z "$fetch_tags" ] || [ "$fetch_tags" == "null" ] ; then
fetch_tags=$(jq -r '.source.fetch_tags' < $payload)
fi

configure_git_global "${git_config_payload}"
Expand Down

0 comments on commit c647abf

Please sign in to comment.