Skip to content

Commit

Permalink
feat: improve e2e on PR process (#3033)
Browse files Browse the repository at this point in the history
* Add check for e2e labels

Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
Jorge Turrado Ferrero authored May 12, 2022
1 parent 01a1014 commit d1894fc
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 10 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/pr-e2e-pr-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: e2e-on-pr-validation
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled

jobs:
validate-e2e-labels:
name: Check e2e labels
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
any_of: ok-to-merge
repo_token: ${{ secrets.GITHUB_TOKEN }}
41 changes: 32 additions & 9 deletions .github/workflows/pr-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@ name: pr-e2e-tests
on:
issue_comment:
types: [created]

env:
E2E_LABEL: ok-to-merge

jobs:
triage:
runs-on: ubuntu-latest
name: Comment evaluate
outputs:
run-e2e: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.check-permission.outputs.has-permission }}
run-e2e: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }}
pr_num: ${{ steps.parser.outputs.pr_num }}
image_tag: "pr-${{ steps.parser.outputs.pr_num }}-${{ github.event.comment.id }}"
steps:
- name: Check user permission
if: startsWith(github.event.comment.body,'/run-e2e')
id: check-permission
uses: scherermichael-oss/action-has-permission@master
- uses: tspascoal/get-user-teams-membership@v1
id: checkUserMember
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
username: ${{ github.actor }}
team: 'keda-e2e-test-executors'
GITHUB_TOKEN: ${{ secrets.GH_CHECKING_USER_AUTH }}

- name: Update comment with the execution url
if: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.check-permission.outputs.has-permission }}
if: ${{ startsWith(github.event.comment.body,'/run-e2e') && steps.checkUserMember.outputs.isTeamMember == 'true' }}
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ github.event.comment.id }}
Expand All @@ -46,6 +48,13 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Remove label
id: remove
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABEL}}'
- name: Checkout Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -79,6 +88,13 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Remove label
id: remove
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ needs.triage.outputs.pr_num }} --remove-label '${{ env.E2E_LABEL}}'
- name: Checkout Pull Request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -158,6 +174,13 @@ jobs:
commentId: ${{ github.event.comment.id }}
reaction: "+1"

- name: Remove label
id: remove
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr edit ${{ needs.triage.outputs.pr_num }} --add-label '${{ env.E2E_LABEL}}'
- name: React to comment with failure
uses: dkershner6/reaction-action@v1
if: steps.test.outcome != 'success'
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To learn more about our roadmap, we recommend reading [this document](ROADMAP.md

### Other

- TODO ([#XXX](https://github.com/kedacore/keda/issue/XXX))
- **General:** Improve e2e on PR process. ([3004](https://github.com/kedacore/keda/issues/3004))

## v2.7.1

Expand Down

0 comments on commit d1894fc

Please sign in to comment.