bbaa9e45a4643e5309931f550a0553c0afc43b19
[nonrtric/plt/ranpm.git] / .github / workflows / gerrit-novote-merge.yaml
1 ---
2 name: Gerrit Merge
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     secrets:
45       SONAR_TOKEN:
46         description: "Sonar Cloud access token"
47         required: true
48
49 concurrency:
50   # yamllint disable-line rule:line-length
51   group: gerrit-merge-${{ github.workflow }}-${{ github.event.inputs.GERRIT_CHANGE_ID || github.run_id }}
52   cancel-in-progress: true
53
54 jobs:
55   notify:
56     runs-on: ubuntu-latest
57     steps:
58       - name: Notify job start
59         # yamllint disable-line rule:line-length
60         uses: lfit/gerrit-review-action@9627b9a144f2a2cad70707ddfae87c87dce60729  # v0.8
61         with:
62           host: ${{ vars.GERRIT_SERVER }}
63           username: ${{ vars.GERRIT_SSH_USER }}
64           key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
65           known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
66           gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
67           gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
68           vote-type: clear
69           comment-only: true
70       - name: Allow replication
71         run: sleep 10s
72
73   call-prescan-sonarcloud:
74     needs: notify
75     # yamllint disable-line rule:line-length
76     uses: lfit/releng-reusable-workflows/.github/workflows/composed-prescan-sonar-cloud.yaml@main
77     with:
78       GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
79       GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
80       GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
81       GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
82       GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
83       GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
84       GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
85       GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
86       GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
87       JDK_VERSION: "17"
88       # yamllint disable-line rule:line-length
89       PRE_BUILD_SCRIPT_URL: "https://raw.githubusercontent.com/o-ran-sc/ci-management/master/jjb/nonrtric-plt-ranpm/prescan-pm-file-converter-ubuntu.sh"
90       SONAR_PROJECTBASEDIR: pm-file-converter
91       SONAR_ARGS: >
92         -Dsonar.organization=o-ran-sc
93         -Dsonar.projectKey=o-ran-sc_nonrtric-plt-ranpm-pm-file-converter
94         -Dsonar.projectName=nonrtric-plt-ranpm-pm-file-converter
95         -Dsonar.build.sourceEncoding=UTF-8
96         -Dsonar.language=go
97         -Dsonar.go.coverage.reportPaths=coverage.txt
98         -Dsonar.inclusions=**/**.go
99         -Dsonar.exclusions=**/*_test.go
100         -Dsonar.verbose=true
101     secrets:
102       SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
103
104   run-maven-sonar-pmproducer:
105     needs: notify
106     # yamllint disable-line rule:line-length
107     uses: lfit/releng-reusable-workflows/.github/workflows/composed-maven-sonar-cloud.yaml@main
108     with:
109       GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
110       GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
111       GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
112       GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
113       GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
114       GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
115       GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
116       GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
117       GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
118       # yamllint disable rule:line-length
119       ENV_VARS: '{"SONARCLOUD_QUALITYGATE_WAIT": "false","SCAN_DEV_BRANCH": "false"}'
120       ENV_SECRETS: "{}"
121       JDK_VERSION: "17"
122       MVN_POM_FILE: "pmproducer/pom.xml"
123       MVN_PHASES: "clean install"
124       MVN_OPTS: >-
125         -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
126         -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
127         -DaltDeploymentRepository=staging::default::file:"${GITHUB_WORKSPACE}"/m2repo
128       SONAR_PROJECT_KEY: "o-ran-sc_nonrtric-plt-ranpm-pmproducer"
129       SONAR_ORG: "o-ran-sc"
130       SONAR_ARGS: >
131         -Dsonar.verbose=true
132         -Ddocker.skip=true
133     secrets:
134       SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
135
136   run-maven-sonar-influxlogger:
137     needs: notify
138     # yamllint disable-line rule:line-length
139     uses: lfit/releng-reusable-workflows/.github/workflows/composed-maven-sonar-cloud.yaml@main
140     with:
141       GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
142       GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
143       GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
144       GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
145       GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
146       GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
147       GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
148       GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
149       GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
150       # yamllint disable rule:line-length
151       ENV_VARS: '{"SONARCLOUD_QUALITYGATE_WAIT": "false","SCAN_DEV_BRANCH": "false"}'
152       ENV_SECRETS: "{}"
153       JDK_VERSION: "17"
154       MVN_POM_FILE: "influxlogger/pom.xml"
155       MVN_PHASES: "clean install"
156       MVN_OPTS: >-
157         -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
158         -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
159         -DaltDeploymentRepository=staging::default::file:"${GITHUB_WORKSPACE}"/m2repo
160       SONAR_PROJECT_KEY: "o-ran-sc_nonrtric-plt-ranpm-influxlogger"
161       SONAR_ORG: "o-ran-sc"
162       SONAR_ARGS: >
163         -Dsonar.verbose=true
164         -Ddocker.skip=true
165     secrets:
166       SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
167
168   run-maven-sonar-datafilecollector:
169     needs: notify
170     # yamllint disable-line rule:line-length
171     uses: lfit/releng-reusable-workflows/.github/workflows/composed-maven-sonar-cloud.yaml@main
172     with:
173       GERRIT_BRANCH: ${{ inputs.GERRIT_BRANCH }}
174       GERRIT_CHANGE_ID: ${{ inputs.GERRIT_CHANGE_ID }}
175       GERRIT_CHANGE_NUMBER: ${{ inputs.GERRIT_CHANGE_NUMBER }}
176       GERRIT_CHANGE_URL: ${{ inputs.GERRIT_CHANGE_URL }}
177       GERRIT_EVENT_TYPE: ${{ inputs.GERRIT_EVENT_TYPE }}
178       GERRIT_PATCHSET_NUMBER: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
179       GERRIT_PATCHSET_REVISION: ${{ inputs.GERRIT_PATCHSET_REVISION }}
180       GERRIT_PROJECT: ${{ inputs.GERRIT_PROJECT }}
181       GERRIT_REFSPEC: ${{ inputs.GERRIT_REFSPEC }}
182       # yamllint disable rule:line-length
183       ENV_VARS: '{"SONARCLOUD_QUALITYGATE_WAIT": "false","SCAN_DEV_BRANCH": "false"}'
184       ENV_SECRETS: "{}"
185       JDK_VERSION: "17"
186       MVN_POM_FILE: "datafilecollector/pom.xml"
187       MVN_PHASES: "clean install"
188       MVN_OPTS: >-
189         -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
190         -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r
191         -DaltDeploymentRepository=staging::default::file:"${GITHUB_WORKSPACE}"/m2repo
192       SONAR_PROJECT_KEY: "o-ran-sc_nonrtric-plt-ranpm-datafilecollector"
193       SONAR_ORG: "o-ran-sc"
194       SONAR_ARGS: >
195         -Dsonar.verbose=true
196         -Ddocker.skip=true
197     secrets:
198       SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
199
200   report-status:
201     if: ${{ always() }}
202     needs: [notify, call-prescan-sonarcloud, run-maven-sonar-pmproducer, run-maven-sonar-influxlogger, run-maven-sonar-datafilecollector]
203     runs-on: ubuntu-latest
204     steps:
205       - name: Get workflow conclusion
206         uses: technote-space/workflow-conclusion-action@v3
207       - name: Report workflow conclusion
208         # yamllint disable-line rule:line-length
209         uses: lfit/gerrit-review-action@9627b9a144f2a2cad70707ddfae87c87dce60729  # v0.8
210         with:
211           host: ${{ vars.GERRIT_SERVER }}
212           username: ${{ vars.GERRIT_SSH_USER }}
213           key: ${{ secrets.GERRIT_SSH_PRIVKEY }}
214           known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
215           gerrit-change-number: ${{ inputs.GERRIT_CHANGE_NUMBER }}
216           gerrit-patchset-number: ${{ inputs.GERRIT_PATCHSET_NUMBER }}
217           vote-type: ${{ env.WORKFLOW_CONCLUSION }}
218           comment-only: true