mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-04 10:24:37 +00:00
Merge pull request #4387 from snir911/tmp-workflow-main
workflow: trigger test-kata-deploy with pull_request and fix workflow_dispatch
This commit is contained in:
55
.github/workflows/kata-deploy-test.yaml
vendored
55
.github/workflows/kata-deploy-test.yaml
vendored
@@ -1,6 +1,19 @@
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch: # this is used to trigger the workflow on non-main branches
|
pull_request: # this will trigger the workflow on PRs that changes release version
|
||||||
issue_comment:
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
paths:
|
||||||
|
- VERSION
|
||||||
|
workflow_dispatch: # this allows to trigger the workflow manually on non-main branches
|
||||||
|
inputs:
|
||||||
|
pr:
|
||||||
|
description: 'PR number from the selected branch to test'
|
||||||
|
type: string
|
||||||
|
required: true
|
||||||
|
issue_comment: # this allows to trigger the workflow from main by commenting "/test_kata_deploy"
|
||||||
types: [created, edited]
|
types: [created, edited]
|
||||||
|
|
||||||
name: test-kata-deploy
|
name: test-kata-deploy
|
||||||
@@ -13,19 +26,21 @@ jobs:
|
|||||||
&& github.event_name == 'issue_comment'
|
&& github.event_name == 'issue_comment'
|
||||||
&& github.event.action == 'created'
|
&& github.event.action == 'created'
|
||||||
&& startsWith(github.event.comment.body, '/test_kata_deploy')
|
&& startsWith(github.event.comment.body, '/test_kata_deploy')
|
||||||
|
|| github.event_name == 'workflow_dispatch'
|
||||||
|
|| github.event_name == 'pull_request'
|
||||||
steps:
|
steps:
|
||||||
- name: Check membership
|
- name: Check membership on comment or dispatch
|
||||||
uses: kata-containers/is-organization-member@1.0.1
|
uses: kata-containers/is-organization-member@1.0.1
|
||||||
id: is_organization_member
|
id: is_organization_member
|
||||||
with:
|
with:
|
||||||
organization: kata-containers
|
organization: kata-containers
|
||||||
username: ${{ github.event.comment.user.login }}
|
username: ${{ github.event.comment.user.login || github.event.sender.login }} # first one applies only on issue_comment
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Fail if not member
|
- name: Fail if not member
|
||||||
run: |
|
run: |
|
||||||
result=${{ steps.is_organization_member.outputs.result }}
|
result=${{ steps.is_organization_member.outputs.result }}
|
||||||
if [ $result == false ]; then
|
if [ $result == false ]; then
|
||||||
user=${{ github.event.comment.user.login }}
|
user=${{ github.event.comment.user.login || github.event.sender.login }}
|
||||||
echo Either ${user} is not part of the kata-containers organization
|
echo Either ${user} is not part of the kata-containers organization
|
||||||
echo or ${user} has its Organization Visibility set to Private at
|
echo or ${user} has its Organization Visibility set to Private at
|
||||||
echo https://github.com/orgs/kata-containers/people?query=${user}
|
echo https://github.com/orgs/kata-containers/people?query=${user}
|
||||||
@@ -53,8 +68,14 @@ jobs:
|
|||||||
- name: get-PR-ref
|
- name: get-PR-ref
|
||||||
id: get-PR-ref
|
id: get-PR-ref
|
||||||
run: |
|
run: |
|
||||||
ref=$(cat $GITHUB_EVENT_PATH | jq -r '.issue.pull_request.url' | sed 's#^.*\/pulls#refs\/pull#' | sed 's#$#\/merge#')
|
if [ ${{ github.event_name }} == 'issue_comment' ]; then
|
||||||
echo "reference for PR: " ${ref}
|
ref=$(cat $GITHUB_EVENT_PATH | jq -r '.issue.pull_request.url' | sed 's#^.*\/pulls#refs\/pull#' | sed 's#$#\/merge#')
|
||||||
|
elif [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
|
||||||
|
ref="refs/pull/${{ github.event.inputs.pr }}/merge"
|
||||||
|
elif [ ${{ github.event_name }} == 'pull_request' ]; then
|
||||||
|
ref="refs/pull/${{ github.event.number }}/merge"
|
||||||
|
fi
|
||||||
|
echo "reference for PR: " ${ref} "event:" ${{ github.event_name }}
|
||||||
echo "##[set-output name=pr-ref;]${ref}"
|
echo "##[set-output name=pr-ref;]${ref}"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
@@ -89,8 +110,14 @@ jobs:
|
|||||||
- name: get-PR-ref
|
- name: get-PR-ref
|
||||||
id: get-PR-ref
|
id: get-PR-ref
|
||||||
run: |
|
run: |
|
||||||
ref=$(cat $GITHUB_EVENT_PATH | jq -r '.issue.pull_request.url' | sed 's#^.*\/pulls#refs\/pull#' | sed 's#$#\/merge#')
|
if [ ${{ github.event_name }} == 'issue_comment' ]; then
|
||||||
echo "reference for PR: " ${ref}
|
ref=$(cat $GITHUB_EVENT_PATH | jq -r '.issue.pull_request.url' | sed 's#^.*\/pulls#refs\/pull#' | sed 's#$#\/merge#')
|
||||||
|
elif [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
|
||||||
|
ref="refs/pull/${{ github.event.inputs.pr }}/merge"
|
||||||
|
elif [ ${{ github.event_name }} == 'pull_request' ]; then
|
||||||
|
ref="refs/pull/${{ github.event.number }}/merge"
|
||||||
|
fi
|
||||||
|
echo "reference for PR: " ${ref} "event:" ${{ github.event_name }}
|
||||||
echo "##[set-output name=pr-ref;]${ref}"
|
echo "##[set-output name=pr-ref;]${ref}"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
@@ -116,8 +143,14 @@ jobs:
|
|||||||
- name: get-PR-ref
|
- name: get-PR-ref
|
||||||
id: get-PR-ref
|
id: get-PR-ref
|
||||||
run: |
|
run: |
|
||||||
ref=$(cat $GITHUB_EVENT_PATH | jq -r '.issue.pull_request.url' | sed 's#^.*\/pulls#refs\/pull#' | sed 's#$#\/merge#')
|
if [ ${{ github.event_name }} == 'issue_comment' ]; then
|
||||||
echo "reference for PR: " ${ref}
|
ref=$(cat $GITHUB_EVENT_PATH | jq -r '.issue.pull_request.url' | sed 's#^.*\/pulls#refs\/pull#' | sed 's#$#\/merge#')
|
||||||
|
elif [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
|
||||||
|
ref="refs/pull/${{ github.event.inputs.pr }}/merge"
|
||||||
|
elif [ ${{ github.event_name }} == 'pull_request' ]; then
|
||||||
|
ref="refs/pull/${{ github.event.number }}/merge"
|
||||||
|
fi
|
||||||
|
echo "reference for PR: " ${ref} "event:" ${{ github.event_name }}
|
||||||
echo "##[set-output name=pr-ref;]${ref}"
|
echo "##[set-output name=pr-ref;]${ref}"
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
|
@@ -48,7 +48,7 @@
|
|||||||
### Merge all bump version Pull requests
|
### Merge all bump version Pull requests
|
||||||
|
|
||||||
- The above step will create a GitHub pull request in the Kata projects. Trigger the CI using `/test` command on each bump Pull request.
|
- The above step will create a GitHub pull request in the Kata projects. Trigger the CI using `/test` command on each bump Pull request.
|
||||||
- Trigger the `test-kata-deploy` workflow which is under the `Actions` tab on the repository GitHub page (make sure to select the correct branch and validate it passes).
|
- `test-kata-deploy` workflow should be triggered automatically, validate it passes under the `Actions` tab on the repository GitHub page (you're also able to run it manually from there).
|
||||||
- Check any failures and fix if needed.
|
- Check any failures and fix if needed.
|
||||||
- Work with the Kata approvers to verify that the CI works and the pull requests are merged.
|
- Work with the Kata approvers to verify that the CI works and the pull requests are merged.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user