Fix: Set MVN_PHASES to clean and install
[aaa.git] / .github / workflows / gerrit-verify.yaml
1 ---
2 name: Gerrit Composed Maven Verify
3
4 # yamllint disable-line rule:truthy
5 on:
6   workflow_dispatch:
7     inputs:
8       GERRIT_BRANCH:
9         description: "Branch that change is against"
10         required: true
11         type: string
12       GERRIT_CHANGE_ID:
13         description: "The ID for the change"
14         required: true
15         type: string
16       GERRIT_CHANGE_NUMBER:
17         description: "The Gerrit number"
18         required: true
19         type: string
20       GERRIT_CHANGE_URL:
21         description: "URL to the change"
22         required: true
23         type: string
24       GERRIT_EVENT_TYPE:
25         description: "Type of Gerrit event"
26         required: true
27         type: string
28       GERRIT_PATCHSET_NUMBER:
29         description: "The patch number for the change"
30         required: true
31         type: string
32       GERRIT_PATCHSET_REVISION:
33         description: "The revision sha"
34         required: true
35         type: string
36       GERRIT_PROJECT:
37         description: "Project in Gerrit"
38         required: true
39         type: string
40       GERRIT_REFSPEC:
41         description: "Gerrit refspec of change"
42         required: true
43         type: string
44
45 concurrency:
46   # yamllint disable-line rule:line-length
47   group: compose-maven-verify-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
48   cancel-in-progress: true
49
50 jobs:
51   prepare:
52     runs-on: ubuntu-latest
53     steps:
54       - name: Clear votes
55         # yamllint disable-line rule:line-length
56         uses: lfit/gerrit-review-action@6ac4c2322b68c0120a9b516eb0421491ee1b3fdf  # v0.4
57         with:
58           host: ${{ vars.GERRIT_SERVER }}
59           username: ${{ vars.GERRIT_SSH_USER }}
60           key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
61           known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
62           gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
63           gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
64           vote-type: clear
65           comment-only: true
66       - name: Allow replication
67         run: sleep 10s
68
69   maven-verify:
70     needs: prepare
71     # use compose-jjb-verify from the v0.4 series of releng-reusable-workflows
72     # yamllint disable-line rule:line-length
73     uses: lfit/releng-reusable-workflows/.github/workflows/compose-maven-verify.yaml@main
74     with:
75       GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
76       GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
77       GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
78       GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
79       GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
80       GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
81       GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
82       GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
83       GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
84       JDK_VERSION: "17"
85       MVN_VERSION: "3.8.3"
86       MVN_PROFILES: "docker"
87       MVN_PHASES: "clean, install"
88       # yamllint disable rule:line-length
89       MVN_OPTS: >-
90         -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
91         -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
92         -DaltDeploymentRepository=staging::default::file:"${GITHUB_WORKSPACE}"/m2repo
93         -Dkaraf.keep.unpack
94       # yamllint enable rule:line-length
95       ENV_VARS: ${{ toJSON(vars) }}
96
97   vote:
98     if: ${{ always() }}
99     # yamllint enable rule:line-length
100     needs: [prepare, maven-verify]
101     runs-on: ubuntu-latest
102     steps:
103       - name: Get conclusion
104         # yamllint disable-line rule:line-length
105         uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5  # v3.0.3
106       - name: Set vote
107         # yamllint disable-line rule:line-length
108         uses: lfit/gerrit-review-action@6ac4c2322b68c0120a9b516eb0421491ee1b3fdf  # v0.4
109         with:
110           host: ${{ vars.GERRIT_SERVER }}
111           username: ${{ vars.GERRIT_SSH_USER }}
112           key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
113           known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
114           gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
115           gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
116           vote-type: ${{ env.WORKFLOW_CONCLUSION }}
117           comment-only: true