Skip to content

Gerrit Composed Maven Merge #78

Gerrit Composed Maven Merge

Gerrit Composed Maven Merge #78

---
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: 2026 The Linux Foundation
name: Gerrit Composed Maven Merge
# 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
concurrency:
# yamllint disable-line rule:line-length
group: gerrit-maven-merge-${{ github.workflow }}-${{ github.event.inputs.GERRIT_BRANCH }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
cancel-in-progress: true
jobs:
prepare:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Clear votes
# yamllint disable-line rule:line-length
uses: lfit/gerrit-review-action@a1c036a59b94c8ab89de26d378f6a28cc7378b13 # v1.1.2
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
comment-only: true
- name: Allow replication
run: sleep 10s
maven-merge:
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 180
steps:
- name: Checkout
# yamllint disable-line rule:line-length
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ inputs.GERRIT_BRANCH }}
submodules: "true"
# yamllint disable-line rule:line-length
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
id: setup-python
with:
python-version: "3.10"
- name: Run Maven
# yamllint disable-line rule:line-length
uses: lfreleng-actions/maven-build-action@c2ded37cb11ff1c2bb1eb7df7011906ddf97bd58 # v0.2.2
with:
java-version: "21"
mvn-version: "3.9.5"
mvn-phases: "clean deploy"
mvn-params: "-Dmerge"
mvn-profiles: "docker"
# yamllint disable rule:line-length
mvn-opts: >-
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
-DaltDeploymentRepository=staging::default::file:"${GITHUB_WORKSPACE}"/m2repo
-Dkaraf.keep.unpack
# yamllint enable rule:line-length
env-vars: ${{ toJSON(vars) }}
global-settings: ${{ vars.GLOBAL_SETTINGS }}
- name: Upload build artifacts
# yamllint disable-line rule:line-length
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: merge-artifact
path: "${{ github.workspace }}/m2repo"
publish-nexus:
needs: maven-merge
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Download build artifacts
# yamllint disable-line rule:line-length
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: merge-artifact
path: "${{ github.workspace }}/m2repo"
- name: Publish to Nexus
# yamllint disable-line rule:line-length
uses: lfreleng-actions/nexus-publish-action@749030f756e5625d1efff260f731dbba92b1f347 # v1.1.2
with:
nexus_server: ${{ vars.NEXUS_SERVER }}
nexus_username: ${{ secrets.NEXUS_USERNAME }}
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
repository_name: ${{ vars.NEXUS_REPO }}
files_path: "${{ github.workspace }}/m2repo"
vote:
if: ${{ always() }}
needs: [prepare, maven-merge, publish-nexus]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Get conclusion
# yamllint disable-line rule:line-length
uses: im-open/workflow-conclusion@8eac7f17381a6917bc04fec3e2c92e70ebc37526 # v3.0.0
- name: Set vote
# yamllint disable-line rule:line-length
uses: lfit/gerrit-review-action@a1c036a59b94c8ab89de26d378f6a28cc7378b13 # v1.1.2
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: ${{ env.WORKFLOW_CONCLUSION }}