Skip to content

comment-handler

comment-handler #75

---
name: comment-handler
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
inputs:
GERRIT_BRANCH:
description: "Branch that change is against"
required: true
type: string
GERRIT_CHANGE_ID:
description: "The ID for the change"
required: true
type: string
GERRIT_CHANGE_NUMBER:
description: "The Gerrit number"
required: true
type: string
GERRIT_CHANGE_URL:
description: "URL to the change"
required: true
type: string
GERRIT_EVENT_TYPE:
description: "Type of Gerrit event"
required: true
type: string
GERRIT_PATCHSET_NUMBER:
description: "The patch number for the change"
required: true
type: string
GERRIT_PATCHSET_REVISION:
description: "The revision sha"
required: true
type: string
GERRIT_PROJECT:
description: "Project in Gerrit"
required: true
type: string
GERRIT_REFSPEC:
description: "Gerrit refspec of change"
required: true
type: string
GERRIT_COMMENT:
description: "Full command line from Gerrit comment"
required: true
type: string
permissions:
contents: read
jobs:
notify-start:
runs-on: ubuntu-latest
steps:
- name: Notify workflow start
uses: lfit/gerrit-review-action@v0.4
with:
host: ${{ vars.GERRIT_SERVER }}
username: ${{ vars.GERRIT_SSH_REQUIRED_USER }}
key: ${{ secrets.GERRIT_SSH_REQUIRED_PRIVKEY }}
known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
gerrit-change-number: ${{ github.event.inputs.GERRIT_CHANGE_NUMBER }}
gerrit-patchset-number: ${{ github.event.inputs.GERRIT_PATCHSET_NUMBER }}
vote-type: clear
comment-only: true
dispatch:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
params: ${{ steps.set-matrix.outputs.params }}
steps:
- name: Prepare workflow selection matrix
id: set-matrix
uses: fdio/csit/.github/actions/csit-comment-dispatch@1f3de8c4266cc118bbf3e108dd0f33a42b0cc70f
with:
gerrit_comment: ${{ github.event.inputs.GERRIT_COMMENT }}
csit-verify-handler:
needs: dispatch
# yamllint disable-line rule:line-length
name: csit-${{ matrix.dut }}-perf-verify-${{ matrix.node }}
runs-on:
- self-hosted
- nomad
- fdio:arch=${{ matrix.executor_arch }}
- fdio:class=builder
- fdio:size=csit
- fdio:namespace=prod
- fdio:os=${{ matrix.os }}
timeout-minutes: 3600
strategy:
matrix: ${{ fromJSON(needs.dispatch.outputs.matrix) }}
env:
# yamllint disable-line rule:line-length
BUILD_TAG: csit-${{ matrix.dut }}-perf-verify-${{ github.event.inputs.GERRIT_BRANCH == 'rls2510' && '2510' || github.event.inputs.GERRIT_BRANCH == 'master' && 'master' }}-${{ matrix.node }}-${{ github.run_id }}
# yamllint disable-line rule:line-length
JOB_NAME: csit-${{ matrix.dut }}-perf-verify-${{ github.event.inputs.GERRIT_BRANCH == 'rls2510' && '2510' || github.event.inputs.GERRIT_BRANCH == 'master' && 'master' }}-${{ matrix.node }}
GERRIT_BRANCH: ${{ github.event.inputs.GERRIT_BRANCH }}
GERRIT_EVENT_TYPE: comment-added
GERRIT_EVENT_COMMENT_TEXT: ${{ needs.dispatch.outputs.params }}
steps:
- name: Gerrit Checkout
# yamllint disable-line rule:line-length
uses: lfit/checkout-gerrit-change-action@54d751e8bd167bc91f7d665dabe33fae87aaaa63 # v0.9
with:
gerrit-refspec: ${{ github.event.inputs.GERRIT_REFSPEC }}
gerrit-project: ${{ github.event.inputs.GERRIT_PROJECT }}
gerrit-url: ${{ vars.GERRIT_URL }}
delay: "10s"
ref: refs/heads/${{ github.event.inputs.GERRIT_BRANCH }}
- name: Setup Environment
# yamllint disable-line rule:line-length
uses: fdio/.github/.github/actions/setup-executor-env@b728d1589228e2891a4241a1bba362d76895c225
- name: Run CSIT Bootstrap
# yamllint disable-line rule:line-length
uses: fdio/csit/.github/actions/csit-bootstrap@a372372ca8f89676c55631f8650468dfab86cc2a
with:
bootstrap_script: bootstrap_verify_perf.sh
with_oper: false
- name: AWS S3 Publish Logs
if: ${{ always() }}
# yamllint disable-line rule:line-length
uses: fdio/.github/.github/actions/aws-s3-publish-logs@a28ad9abc70855292df1ea0d59829e814e78c2f4
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: ${{ vars.AWS_REGION }}
s3_bucket: ${{ vars.S3_BUCKET }}
# yamllint disable-line rule:line-length
s3_path: csit-${{ matrix.dut }}-perf-verify-${{ matrix.node }}/${{ github.run_id }}
vote:
if: ${{ always() }}
needs:
- notify-start
- csit-verify-handler
runs-on: ubuntu-latest
steps:
- uses: technote-space/workflow-conclusion-action@v3
- name: Set vote
uses: lfit/gerrit-review-action@v0.4
with:
host: ${{ vars.GERRIT_SERVER }}
username: ${{ vars.GERRIT_SSH_REQUIRED_USER }}
key: ${{ secrets.GERRIT_SSH_REQUIRED_PRIVKEY }}
known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
gerrit-change-number: ${{ github.event.inputs.GERRIT_CHANGE_NUMBER }}
gerrit-patchset-number: ${{ github.event.inputs.GERRIT_PATCHSET_NUMBER }}
vote-type: ${{ env.WORKFLOW_CONCLUSION }}
comment-only: true