-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate Pull Request Checklist - Check Tasks Completed
As described in #910, we have a submitter checklists in pull requests that enforce with our standards. Currently, maintainers and reviewers have to manually check that the submitter checklist has been checked off and verify each item in the list. If the submitter checklist has not been checked off, they need to follow up with the user and request them to follow the standards and check them off. In this change, we add automation that checks that the checklist has been checked off. If there's an incomplete item, the check reports that there are incomplete tasks but does not fail yet. In a future change, we will make the check fail if the submitter checklist is not checked off.
- Loading branch information
Showing
6 changed files
with
198 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: github-tasks-completed | ||
namespace: tektonci | ||
description: | | ||
Verifies that a PR has all the tasks completed | ||
spec: | ||
params: | ||
- name: body | ||
description: The body of the Pull Request | ||
stepTemplate: | ||
env: | ||
- name: HOME | ||
value: /tekton/home | ||
steps: | ||
- name: install-pyyaml | ||
image: python:3-alpine | ||
script: | | ||
pip install pyyaml --user | ||
- name: check-github-tasks-completed | ||
image: python:3-alpine | ||
script: | | ||
#!/usr/bin/env python | ||
import sys | ||
prBodyText = """$(params.body)""" | ||
incompleteTasks = prBodyText.count("- []") | ||
if incompleteTasks > 0: | ||
msg = "Error: {} incomplete GitHub Tasks found, expecting no incomplete GitHub Tasks".format(incompleteTasks) | ||
print(msg) | ||
# TODO (jerop): comment out in a follow up PR | ||
# Check failed. Return exit code 1. | ||
# sys.exit(1) | ||
else: | ||
print("Found no incomplete GitHub Tasks) | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: tekton-github-tasks-completed | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: checkName | ||
description: The name of the GitHub check that this pipeline is used for | ||
- name: gitHubCommand | ||
description: The command that was used to trigger testing | ||
- name: body | ||
description: The body of the Pull Request | ||
tasks: | ||
- name: github-tasks-completed | ||
conditions: | ||
- conditionRef: "check-name-matches" | ||
params: | ||
- name: gitHubCommand | ||
value: $(params.gitHubCommand) | ||
- name: checkName | ||
value: $(params.checkName) | ||
taskRef: | ||
name: github-tasks-completed | ||
params: | ||
- name: body | ||
value: $(params.body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: tekton-ci-github-base | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: buildUUID | ||
value: $(header.X-GitHub-Delivery) | ||
- name: package | ||
value: $(body.repository.full_name) | ||
- name: gitRepository | ||
value: $(body.repository.html_url) | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: tekton-ci-clone-depth | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: gitCloneDepth | ||
value: $(extensions.git_clone_depth) | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: tekton-ci-webhook-pull-request | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: gitRevision | ||
value: $(body.pull_request.head.sha) | ||
- name: pullRequestNumber | ||
value: $(body.pull_request.number) | ||
- name: pullRequestUrl | ||
value: $(body.pull_request.html_url) | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: tekton-ci-webhook-comment | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: gitRevision | ||
value: $(body.extensions.add_pr_body.pull_request_body.head.sha) | ||
- name: pullRequestNumber | ||
value: $(body.extensions.add_pr_body.pull_request_body.number) | ||
- name: pullRequestUrl | ||
value: $(body.issue.pull_request.html_url) | ||
- name: gitHubCommand | ||
value: $(body.comment.body) | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: tekton-ci-webhook-tektoncd-comment | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: gitHubCommand | ||
value: $(body.comment.body) | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: tekton-ci-webhook-pr-labels | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: labels | ||
value: $(body.pull_request.labels) | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: tekton-ci-webhook-issue-labels | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: labels | ||
value: $(body.issue.labels) | ||
--- | ||
apiVersion: triggers.tekton.dev/v1alpha1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: tekton-ci-webhook-pr-body | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: labels | ||
value: $(body.pull_request.body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters