Skip to content

Commit

Permalink
Added a parameter to optionally ignore errors on push
Browse files Browse the repository at this point in the history
Provides an implementation of the feature requested in
#408.

Signed-off-by: Anonymous-Coward <[email protected]>
  • Loading branch information
fjurcov committed Jul 20, 2023
1 parent 0a2b7d7 commit 2daed40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,13 @@ and the `rebase` parameter is not provided, the push will fail.
attempt to merge remote to local before pushing. Only one of `merge` or
`rebase` can be provided, but not both.

* `quiet`: *Optional.* supress errors. Whether a push succeeds or not, the
`put` step in the concourse pipeline will always succeed. There are
situations in which a task running before the put may or may not modify
a repository which then needs to be pushed - git push with no changes
generates a non-zero exit code and breaks the concourse job. Setting this
parameter to 'true' will prevent that.

* `returning`: *Optional.* When passing the `merge` flag, specify whether the
merge commit or the original, unmerged commit should be passed as the output
ref. Options are `merged` and `unmerged`. Defaults to `merged`.
Expand Down
9 changes: 7 additions & 2 deletions assets/out
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ notes_file=$(jq -r '.params.notes // ""' <<< "$payload")
override_branch=$(jq -r '.params.branch // ""' <<< "$payload")
# useful for pushing to special ref types like refs/for in gerrit.
refs_prefix=$(jq -r '.params.refs_prefix // "refs/heads"' <<< "$payload")
quiet=$(jq -r '.params.quiet // false' <<< "$payload")

configure_git_global "${git_config_payload}"

Expand Down Expand Up @@ -175,7 +176,9 @@ elif [ "$merge" = "true" ]; then
if [ "$result" = "0" ]; then
break
elif [ "$result" = "1" ]; then
exit 1
if [ "$quiet" != "true" ]; then
exit 1
fi
fi

echo "merging and trying again..."
Expand All @@ -192,7 +195,9 @@ elif [ "$rebase" = "true" ]; then
if [ "$result" = "0" ]; then
break
elif [ "$result" = "1" ]; then
exit 1
if [ "$quiet" != "true" ]; then
exit 1
fi
fi

echo "rebasing and trying again..."
Expand Down

0 comments on commit 2daed40

Please sign in to comment.