Skip to content

Gerrit Composed Maven Merge #60

Gerrit Composed Maven Merge

Gerrit Composed Maven Merge #60

---
# 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@a5de1d5bf17c2603ae81544dc2a455017b454ec8 # v1.1.1
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: ${{ inputs.GERRIT_BRANCH }}
submodules: "true"
# yamllint disable-line rule:line-length
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
id: setup-python
with:
python-version: "3.10"
- name: Run Maven
# yamllint disable-line rule:line-length
uses: lfreleng-actions/maven-build-action@3e8765bbc2685951fb7c2be03964304179106b70 # v0.2.1
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@55d3b697d3ca1c0f28f574ea5dc7daa6f460deaa # v0.2.1
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@7b146947e59eaf7fc3328822357861ab1758c088 # v2.2.5
- name: Set vote
# yamllint disable-line rule:line-length
uses: lfit/gerrit-review-action@a5de1d5bf17c2603ae81544dc2a455017b454ec8 # v1.1.1
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 }}