Skip to content

Commit 6711cd6

Browse files
committed
chore: remove pull_request_trusted workflow
- Removed the `pull_request_trusted` workflow. - Added a new pipeline `run-gha-workflow` to trigger `nightly_push_dispatch` workflow on pull requests. - Removed the `pipelinesascode.tekton.dev/task` annotation from go and linter pipelines. - Updated the default SHA to `HEAD` in `nightly_push_dispatch` workflow, - Changed condition to run e2e tests to be triggered on schedule event only if input sha is specified. The `pull_request_trusted` workflow was deprecated and is no longer needed since we now rely on the `/test` command for triggering E2E tests on pull requests. We now use a PAC to trigger a workflow dispatch event on the `nightly_push_dispatch` GitHub workflow. This allows us to leverage GitHub Actions for running E2E tests on pull requests, providing a more Signed-off-by: Chmouel Boudjnah <[email protected]>
1 parent 219f3e6 commit 6711cd6

File tree

5 files changed

+79
-148
lines changed

5 files changed

+79
-148
lines changed

Diff for: .github/workflows/nightly_push_dispatch.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
sha:
1414
description: "The commit SHA to checkout"
1515
required: false
16-
default: "main"
16+
default: "HEAD"
1717
jobs:
1818
e2e-tests:
1919
concurrency:
@@ -101,7 +101,7 @@ jobs:
101101
./hack/gh-workflow-ci.sh create_second_github_app_controller_on_ghe
102102
103103
- name: Run E2E Tests
104-
if: ${{ github.event_name != 'schedule' }}
104+
if: ${{ github.event_name != 'schedule' || inputs.sha }}
105105
env:
106106
TEST_PROVIDER: ${{ matrix.provider }}
107107
TEST_BITBUCKET_CLOUD_TOKEN: ${{ secrets.BITBUCKET_CLOUD_TOKEN }}

Diff for: .github/workflows/pull_request_trusted.yaml

-144
This file was deleted.

Diff for: .tekton/go.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ kind: PipelineRun
44
metadata:
55
name: go-testing
66
annotations:
7-
pipelinesascode.tekton.dev/task: "[git-clone]"
87
pipelinesascode.tekton.dev/max-keep-runs: "2"
98
pipelinesascode.tekton.dev/cancel-in-progress: "true"
109
pipelinesascode.tekton.dev/on-event: "pull_request"

Diff for: .tekton/linter.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ metadata:
88
pipelinesascode.tekton.dev/on-target-branch: "[*]"
99
pipelinesascode.tekton.dev/max-keep-runs: "2"
1010
pipelinesascode.tekton.dev/cancel-in-progress: "true"
11-
pipelinesascode.tekton.dev/task: "[git-clone]"
1211
spec:
1312
params:
1413
- name: repo_url

Diff for: .tekton/run-gha-workflow.yaml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
apiVersion: tekton.dev/v1beta1
3+
kind: PipelineRun
4+
metadata:
5+
name: start-gha-workflow
6+
annotations:
7+
pipelinesascode.tekton.dev/max-keep-runs: "2"
8+
pipelinesascode.tekton.dev/cancel-in-progress: "true"
9+
pipelinesascode.tekton.dev/on-event: "pull_request"
10+
pipelinesascode.tekton.dev/on-target-branch: "main"
11+
pipelinesascode.tekton.dev/on-path-change: "[***/*.go, .github/workflows/*l]"
12+
spec:
13+
params:
14+
- name: repo_url
15+
value: "{{repo_url}}"
16+
- name: revision
17+
value: "{{revision}}"
18+
pipelineSpec:
19+
params:
20+
- name: repo_url
21+
- name: revision
22+
tasks:
23+
- name: trigger-workflow
24+
taskSpec:
25+
workspaces:
26+
- name: source
27+
steps:
28+
- name: fetch-repo
29+
ref:
30+
resolver: http
31+
params:
32+
- name: url
33+
value: https://raw.githubusercontent.com/tektoncd/catalog/main/stepaction/git-clone/0.1/git-clone.yaml
34+
params:
35+
- name: output-path
36+
value: $(workspaces.source.path)
37+
- name: url
38+
value: "$(params.repo_url)"
39+
- name: revision
40+
value: "$(params.revision)"
41+
- name: dispatch-workflow
42+
# it has curl and we already pulled it
43+
image: registry.access.redhat.com/ubi9/ubi
44+
workingDir: $(workspaces.source.path)
45+
env:
46+
- name: HUB_TOKEN
47+
valueFrom:
48+
secretKeyRef:
49+
name: "nightly-ci-github-hub-token"
50+
key: "hub-token"
51+
script: |
52+
#!/usr/bin/env bash
53+
set -eux
54+
WORKFLOW=nightly_push_dispatch.yaml
55+
REPO=""
56+
57+
url=$(curl -s -f -X GET -H "Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview" \
58+
-H "Authorization: token ${HUB_TOKEN}" \
59+
-H "User-Agent: PAC" \
60+
https://api.github.com/repos/{{ repo_owner }}/{{ repo_name }}/actions/workflows/.github%2Fworkflows%2F${WORKFLOW} |
61+
sed -n 's/.*"url":"\([^"]*\)".*/\1/p')
62+
[[ -z $url ]] && { echo "No url found" && exit 1; }
63+
64+
curl -s -f -X POST -H "Accept: application/vnd.github.v3+json" \
65+
-H "Authorization: token ${HUB_TOKEN}" \
66+
-H "Content-Type: application/json" \
67+
-d '{"ref":"main", "inputs": {"sha": "{{ revision }}"}}' \
68+
${url}/dispatches
69+
70+
workspaces:
71+
- name: source
72+
workspace: source
73+
workspaces:
74+
- name: source
75+
workspaces:
76+
- name: source
77+
emptyDir: {}

0 commit comments

Comments
 (0)