Skip to content

chore: remove pull_request_trusted workflow #2024

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: E2E Tests for push, schedule and dispatch
name: E2E Tests

on:
schedule:
Expand All @@ -10,51 +10,46 @@ on:
description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)"
required: false
default: false
sha:
description: "The commit SHA to checkout"
required: false
default: "main"
pull_request_target:
types:
- labeled
- opened
- reopened
- synchronize

jobs:
e2e-tests:
# Only run if it's a scheduled run, manual dispatch, or has e2e label
if: >
github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch') ||
(github.event_name == 'pull_request_target' && (github.event.label.name == 'e2e' || contains(github.event.pull_request.labels.*.name, 'e2e')))

concurrency:
group: ${{ github.workflow }}-${{ matrix.provider }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

name: e2e tests
runs-on: ubuntu-latest
strategy:
matrix:
provider: [providers, gitea_others]

env:
KO_DOCKER_REPO: localhost:5000
CONTROLLER_DOMAIN_URL: controller.paac-127-0-0-1.nip.io
TEST_GITHUB_REPO_OWNER_GITHUBAPP: openshift-pipelines/pipelines-as-code-e2e-tests
KUBECONFIG: /home/runner/.kube/config.kind
# Configure test environment variables
# [Rest of the environment variables remain the same as in the original workflow]
TEST_BITBUCKET_CLOUD_API_URL: https://api.bitbucket.org/2.0
TEST_BITBUCKET_CLOUD_E2E_REPOSITORY: cboudjna/pac-e2e-tests
TEST_BITBUCKET_CLOUD_USER: cboudjna
TEST_EL_URL: http://controller.paac-127-0-0-1.nip.io
TEST_GITEA_API_URL: http://localhost:3000
TEST_GITEA_USERNAME: pac
TEST_GITEA_PASSWORD: pac
TEST_GITEA_REPO_OWNER: pac/pac
TEST_GITHUB_API_URL: api.github.com
TEST_GITHUB_REPO_OWNER_WEBHOOK: openshift-pipelines/pipelines-as-code-e2e-tests-webhook
TEST_GITHUB_PRIVATE_TASK_URL: https://github.com/openshift-pipelines/pipelines-as-code-e2e-tests-private/blob/main/remote_task.yaml
TEST_GITHUB_PRIVATE_TASK_NAME: task-remote
TEST_GITHUB_SECOND_API_URL: ghe.pipelinesascode.com
TEST_GITHUB_SECOND_EL_URL: http://ghe.paac-127-0-0-1.nip.io
TEST_GITHUB_SECOND_REPO_OWNER_GITHUBAPP: pipelines-as-code/e2e
TEST_GITHUB_SECOND_REPO_INSTALLATION_ID: 1
TEST_GITLAB_API_URL: https://gitlab.com
TEST_GITLAB_PROJECT_ID: 34405323
TEST_BITBUCKET_SERVER_USER: pipelines
TEST_BITBUCKET_SERVER_E2E_REPOSITORY: PAC/pac-e2e-tests
# ... [other environment variables from the original workflow]

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.sha || github.sha }}
ref: ${{ github.sha }}

- uses: actions/setup-go@v5
with:
Expand Down Expand Up @@ -101,7 +96,7 @@ jobs:
./hack/gh-workflow-ci.sh create_second_github_app_controller_on_ghe

- name: Run E2E Tests
if: ${{ github.event_name != 'schedule' }}
if: ${{ github.event_name != 'schedule' || github.event.label.name == 'e2e' || contains(github.event.pull_request.labels.*.name, 'e2e') }}
env:
TEST_PROVIDER: ${{ matrix.provider }}
TEST_BITBUCKET_CLOUD_TOKEN: ${{ secrets.BITBUCKET_CLOUD_TOKEN }}
Expand Down
144 changes: 0 additions & 144 deletions .github/workflows/pull_request_trusted.yaml

This file was deleted.

73 changes: 73 additions & 0 deletions .tekton/e2e-label.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: e2e-label.yaml
annotations:
pipelinesascode.tekton.dev/max-keep-runs: "2"
pipelinesascode.tekton.dev/cancel-in-progress: "true"
pipelinesascode.tekton.dev/on-event: "pull_request"
pipelinesascode.tekton.dev/on-target-branch: "main"
pipelinesascode.tekton.dev/on-path-change: "[***/*.go, .github/workflows/*l]"
spec:
pipelineSpec:
tasks:
- name: label-pr
taskSpec:
steps:
- name: label-pr
# it has curl and we already pulled it
image: registry.access.redhat.com/ubi9/ubi
env:
- name: HUB_TOKEN
valueFrom:
secretKeyRef:
name: "nightly-ci-github-hub-token"
key: "hub-token"
script: |
#!/usr/bin/env python3

import os
import sys
import requests

PR_NUMBER = "{{ pull_request_number }}"
REPO_OWNER = "{{ repo_owner }}"
REPO_NAME = "{{ repo_name }}"
LABEL = "e2e"
HUB_TOKEN = os.getenv("HUB_TOKEN")

headers = {
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {HUB_TOKEN}",
"User-Agent": "PAC"
}

# Check if the PR already has the label
response = requests.get(
f"https://api.github.com/repos/{REPO_OWNER}/{REPO_NAME}/issues/{PR_NUMBER}/labels",
headers=headers
)

if response.status_code != 200:
print(f"Failed to get labels, response code: {response.status_code}")
sys.exit(1)

labels = [label['name'] for label in response.json()]

if LABEL in labels:
print(f"Pull request already has the label '{LABEL}'")
sys.exit(0)

# Add the label to the PR
response = requests.post(
f"https://api.github.com/repos/{REPO_OWNER}/{REPO_NAME}/issues/{PR_NUMBER}/labels",
headers=headers,
json={"labels": [LABEL]}
)

if response.status_code != 200:
print(f"Failed to add label, response code: {response.status_code}")
sys.exit(1)

print(f"Label '{LABEL}' added to pull request #{PR_NUMBER} successfully")
1 change: 0 additions & 1 deletion .tekton/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ kind: PipelineRun
metadata:
name: go-testing
annotations:
pipelinesascode.tekton.dev/task: "[git-clone]"
pipelinesascode.tekton.dev/max-keep-runs: "2"
pipelinesascode.tekton.dev/cancel-in-progress: "true"
pipelinesascode.tekton.dev/on-event: "pull_request"
Expand Down
1 change: 0 additions & 1 deletion .tekton/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ metadata:
pipelinesascode.tekton.dev/on-target-branch: "[*]"
pipelinesascode.tekton.dev/max-keep-runs: "2"
pipelinesascode.tekton.dev/cancel-in-progress: "true"
pipelinesascode.tekton.dev/task: "[git-clone]"
spec:
params:
- name: repo_url
Expand Down