Skip to content

Gerrit Verify (Hybrid) #244

Gerrit Verify (Hybrid)

Gerrit Verify (Hybrid) #244

---
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2025 The Linux Foundation
name: Gerrit Verify (Hybrid)
on:
workflow_dispatch:
inputs:
GERRIT_BRANCH:
description: "Branch that change is against"
required: false
type: string
GERRIT_CHANGE_ID:
description: "The ID for the change"
required: false
type: string
GERRIT_CHANGE_NUMBER:
description: "The Gerrit number"
required: false
type: string
GERRIT_CHANGE_URL:
description: "URL to the change"
required: true
type: string
GERRIT_EVENT_TYPE:
description: "Type of Gerrit event"
required: false
type: string
GERRIT_PATCHSET_NUMBER:
description: "The patch number for the change"
required: true
type: string
GERRIT_PATCHSET_REVISION:
description: "The revision sha"
required: false
type: string
GERRIT_PROJECT:
description: "Project in Gerrit"
required: false
type: string
GERRIT_REFSPEC:
description: "Gerrit refspec of change"
required: false
type: string
TARGET_REPO:
# yamllint disable-line rule:line-length
description: "The target GitHub repository needing the bypassable workflow"
required: false
type: string
concurrency:
group: gerrit-verify-${{ github.ref }}
cancel-in-progress: true
permissions: read-all
jobs:
prepare:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Skip if ACT
if: ${{ env.ACT == 'true' }}
run: echo "Skipping vote clearing in ACT mode" && exit 0
- name: Clear votes
if: ${{ env.ACT != 'true' }}
# yamllint disable-line rule:line-length
uses: lfit/gerrit-review-action@9627b9a144f2a2cad70707ddfae87c87dce60729 # v0.8
with:
host: ${{ vars.GERRIT_SERVER }}
username: ${{ vars.GERRIT_SSH_USER }}
key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
vote-type: clear
- name: Allow replication
if: ${{ env.ACT != 'true' }}
run: sleep 10s
local-tox:
runs-on: ubuntu-latest
timeout-minutes: 30
# yamllint disable rule:line-length
steps:
- name: Check if running in ACT
if: ${{ env.ACT == 'true' }}
run: echo "Running local tox build via ACT"
- uses: actions/checkout@v4
if: ${{ env.ACT == 'true' }}
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
if: ${{ env.ACT == 'true' }}
with:
python-version: '3.x'
- name: Install tox
if: ${{ env.ACT == 'true' }}
run: pip install --upgrade pip && pip install tox
- name: Run docs & linkcheck
if: ${{ env.ACT == 'true' }}
run: tox -e docs,docs-linkcheck
call-gerrit-change-info:
runs-on: ubuntu-latest
timeout-minutes: 5
# yamllint disable rule:line-length
outputs:
GERRIT_BRANCH: ${{ steps.gerrit-change-info.outputs.GERRIT_BRANCH }}
GERRIT_CHANGE_ID: ${{ steps.gerrit-change-info.outputs.GERRIT_CHANGE_ID }}
GERRIT_CHANGE_NUMBER: ${{ steps.gerrit-change-info.outputs.GERRIT_CHANGE_NUMBER }}
GERRIT_CHANGE_URL: ${{ steps.gerrit-change-info.outputs.GERRIT_CHANGE_URL }}
GERRIT_EVENT_TYPE: ${{ steps.gerrit-change-info.outputs.GERRIT_EVENT_TYPE }}
GERRIT_PATCHSET_NUMBER: ${{ steps.gerrit-change-info.outputs.GERRIT_PATCHSET_NUMBER }}
GERRIT_PATCHSET_REVISION: ${{ steps.gerrit-change-info.outputs.GERRIT_PATCHSET_REVISION }}
GERRIT_PROJECT: ${{ steps.gerrit-change-info.outputs.GERRIT_PROJECT }}
GERRIT_REFSPEC: ${{ steps.gerrit-change-info.outputs.GERRIT_REFSPEC }}
GERRIT_HOSTNAME: ${{ steps.gerrit-change-info.outputs.GERRIT_HOSTNAME }}
steps:
- name: Skip if ACT
if: ${{ env.ACT == 'true' }}
run: echo "Skipping Gerrit change info in ACT mode" && exit 0
- name: Gerrit change information
if: ${{ env.ACT != 'true' }}
id: gerrit-change-info
uses: lfreleng-actions/gerrit-change-info@ce31825cacd6da170d6301fb36cc1b70ce029f8a # v0.1.3
with:
gerrit_change_url: ${{ inputs.GERRIT_CHANGE_URL }}
gerrit_patchset_number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
ssh_user_name: ${{ vars.GERRIT_SSH_USER_G2G }}
ssh_private_key: ${{ secrets.GERRIT_SSH_PRIVKEY_G2G }}
gerrit_known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
path_prefix: "gerrit-change-info"
call-gerrit-tox-verify:
needs: [prepare, call-gerrit-change-info]
# yamllint disable rule:line-length
uses: lfit/releng-reusable-workflows/.github/workflows/gerrit-compose-required-tox-verify.yaml@4231fda07b06d356c904fe39a868522393dee4bb # v0.2.21
with:
GERRIT_BRANCH: ${{ needs.call-gerrit-change-info.outputs.GERRIT_BRANCH }}
GERRIT_CHANGE_ID: ${{ needs.call-gerrit-change-info.outputs.GERRIT_CHANGE_ID }}
GERRIT_CHANGE_NUMBER: ${{ needs.call-gerrit-change-info.outputs.GERRIT_CHANGE_NUMBER }}
GERRIT_CHANGE_URL: ${{ needs.call-gerrit-change-info.outputs.GERRIT_CHANGE_URL }}
GERRIT_EVENT_TYPE: ${{ needs.call-gerrit-change-info.outputs.GERRIT_EVENT_TYPE }}
GERRIT_PATCHSET_NUMBER: ${{ needs.call-gerrit-change-info.outputs.GERRIT_PATCHSET_NUMBER }}
GERRIT_PATCHSET_REVISION: ${{ needs.call-gerrit-change-info.outputs.GERRIT_PATCHSET_REVISION }}
GERRIT_PROJECT: ${{ needs.call-gerrit-change-info.outputs.GERRIT_PROJECT }}
GERRIT_REFSPEC: ${{ needs.call-gerrit-change-info.outputs.GERRIT_REFSPEC }}
TOX_ENVS: '["docs","docs-linkcheck"]'
rtd-validation:
needs: [prepare, call-gerrit-change-info]
# yamllint disable rule:line-length
uses: lfit/releng-reusable-workflows/.github/workflows/gerrit-compose-required-rtdv3-verify.yaml@4231fda07b06d356c904fe39a868522393dee4bb # v0.2.21
with:
GERRIT_BRANCH: ${{ needs.call-gerrit-change-info.outputs.GERRIT_BRANCH }}
GERRIT_CHANGE_ID: ${{ needs.call-gerrit-change-info.outputs.GERRIT_CHANGE_ID }}
GERRIT_CHANGE_NUMBER: ${{ needs.call-gerrit-change-info.outputs.GERRIT_CHANGE_NUMBER }}
GERRIT_CHANGE_URL: ${{ needs.call-gerrit-change-info.outputs.GERRIT_CHANGE_URL }}
GERRIT_EVENT_TYPE: ${{ needs.call-gerrit-change-info.outputs.GERRIT_EVENT_TYPE }}
GERRIT_PATCHSET_NUMBER: ${{ needs.call-gerrit-change-info.outputs.GERRIT_PATCHSET_NUMBER }}
GERRIT_PATCHSET_REVISION: ${{ needs.call-gerrit-change-info.outputs.GERRIT_PATCHSET_REVISION }}
GERRIT_PROJECT: ${{ needs.call-gerrit-change-info.outputs.GERRIT_PROJECT }}
GERRIT_REFSPEC: ${{ needs.call-gerrit-change-info.outputs.GERRIT_REFSPEC }}
TARGET_REPO: ${{ inputs.TARGET_REPO || github.repository }}
secrets:
RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
vote:
if: ${{ always() }}
needs: [call-gerrit-tox-verify, rtd-validation, call-gerrit-change-info]
runs-on: ubuntu-latest
timeout-minutes: 5
# yamllint disable rule:line-length
steps:
- name: Skip if ACT
if: ${{ env.ACT == 'true' }}
run: echo "Skipping vote in ACT mode" && exit 0
- uses: im-open/workflow-conclusion@e4f7c4980600fbe0818173e30931d3550801b992 # v2.2.3
if: ${{ env.ACT != 'true' }}
- name: Set vote
if: ${{ env.ACT != 'true' }}
uses: lfit/gerrit-review-action@9627b9a144f2a2cad70707ddfae87c87dce60729 # v0.8
with:
host: ${{ vars.GERRIT_SERVER }}
username: ${{ vars.GERRIT_SSH_USER }}
key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
gerrit-change-number: ${{ needs.call-gerrit-change-info.outputs.GERRIT_CHANGE_NUMBER }}
gerrit-patchset-number: ${{ needs.call-gerrit-change-info.outputs.GERRIT_PATCHSET_NUMBER }}
vote-type: ${{ env.WORKFLOW_CONCLUSION }}