Skip to content

Commit

Permalink
[ISV-3824] Merge the PR if all tests are successful. (redhat-openshif…
Browse files Browse the repository at this point in the history
…t-ecosystem#486)

* [ISV-3824] Add a new task merge-pr to the community-hosted-pipeline.

* Remove trailing space.

* Add the when condition in community hosted pipeline task.

* Add the when condition in community hosted pipeline task.

* Add the when condition in community hosted pipeline task.

* Update the force_merge parameter value.

* Update the force_merge parameter value.

* Update the force_merge parameter value.
  • Loading branch information
haripate authored Sep 6, 2023
1 parent e7a3984 commit 9bfc12d
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,34 @@ spec:
- name: github_token_secret_key
value: "$(params.github_token_secret_key)"

# merge PR
- name: merge-pr
when:
- input: "$(tasks.get-ci-reviewer.results.author_is_reviewer)"
operator: in
values: ["true"]
runAfter:
- wait-prow-tests
taskRef:
name: merge-pr
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
- name: git_pr_url
value: $(params.git_pr_url)
- name: bundle_path
value: *addedBundlePath
- name: github_token_secret_name
value: "$(params.github_token_secret_name)"
- name: github_token_secret_key
value: "$(params.github_token_secret_key)"
- name: force_merge
value: "true"
workspaces:
- name: source
workspace: repository
subPath: src

finally:

- name: set-github-passed-label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ spec:
- name: github_token_secret_key
description: The key within the Kubernetes Secret that contains the GitHub token.
default: token
- name: force_merge
description: The boolean which will indicate when to ignore the verification of ci.yaml file.
deafult: "false"
workspaces:
- name: source
results:
Expand All @@ -27,11 +30,15 @@ spec:
image: "$(params.pipeline_image)"
workingDir: $(workspaces.source.path)
script: |
PKG_PATH=$(dirname $(realpath $(params.bundle_path)))
CI_FILE_PATH="$PKG_PATH/ci.yaml"
BOOL_MERGE=$(cat $CI_FILE_PATH | yq -r '.merge')
if [ "$force_merge" = "true" ]; then
echo true >$(results.bool_merge.path)
else
PKG_PATH=$(dirname $(realpath $(params.bundle_path)))
CI_FILE_PATH="$PKG_PATH/ci.yaml"
BOOL_MERGE=$(cat $CI_FILE_PATH | yq -r '.merge')
echo -n "$BOOL_MERGE" | tee $(results.bool_merge.path)
echo -n "$BOOL_MERGE" | tee $(results.bool_merge.path)
fi
- name: review-pull-request
image: "$(params.ubi8_minimal_image)"
Expand Down

0 comments on commit 9bfc12d

Please sign in to comment.