[CI] Refactor the maven role
To make it more flexible. Also cross-test with library-template (build) since it is now possible to do so. Change-Id: I137013dc6bba01ef9a20f3f86cb4e4ced014421e
This commit is contained in:
parent
96c00d9e7a
commit
62341c39f4
@ -2,13 +2,8 @@
|
|||||||
roles:
|
roles:
|
||||||
- install-jdk
|
- install-jdk
|
||||||
- install-maven
|
- install-maven
|
||||||
tasks:
|
- role: maven
|
||||||
- name: Build the project with Maven
|
|
||||||
shell: mvn clean install
|
|
||||||
args:
|
|
||||||
chdir: "{{ library_path }}" # Pointing to the directory with pom.xml
|
|
||||||
vars:
|
vars:
|
||||||
library_path: "{{ zuul.project.src_dir }}/{{ java_libraries[0].context }}"
|
# TODO: support more
|
||||||
environment:
|
maven_pom_dir: "{{ java_libraries[0].context }}"
|
||||||
MAVEN_HOME: "/opt/apache-maven-3.8.8"
|
maven_phases: ["install"]
|
||||||
PATH: "{{ ansible_env.PATH }}:/opt/apache-maven-3.8.8/bin"
|
|
||||||
|
5
roles/maven/defaults/main.yml
Normal file
5
roles/maven/defaults/main.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
zuul_work_dir: "{{ zuul.project.src_dir }}"
|
||||||
|
|
||||||
|
maven_version: "3.8.8"
|
||||||
|
maven_phases: []
|
||||||
|
maven_pom_dir: ""
|
9
roles/maven/tasks/main.yml
Normal file
9
roles/maven/tasks/main.yml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
- name: Run Maven
|
||||||
|
command:
|
||||||
|
argv: "{{ ['mvn'] + maven_phases }}"
|
||||||
|
chdir: "{{ zuul_work_dir }}/{{ maven_pom_dir }}"
|
||||||
|
vars:
|
||||||
|
maven_home: "/opt/apache-maven-{{ maven_version }}"
|
||||||
|
environment:
|
||||||
|
MAVEN_HOME: "{{ maven_home }}"
|
||||||
|
PATH: "{{ maven_home }}/bin:{{ ansible_env.PATH }}"
|
@ -34,5 +34,16 @@
|
|||||||
- opendev-buildset-registry:
|
- opendev-buildset-registry:
|
||||||
files: *nebulous-component-template-apply-helm-charts-files
|
files: *nebulous-component-template-apply-helm-charts-files
|
||||||
|
|
||||||
|
# cross-testing with library-template
|
||||||
|
- nebulous-library-template-build-java-libraries:
|
||||||
|
vars:
|
||||||
|
zuul_work_dir: src/opendev.org/nebulous/library-template
|
||||||
|
required-projects:
|
||||||
|
- nebulous/library-template
|
||||||
|
files:
|
||||||
|
- ^playbooks/java-libraries/
|
||||||
|
- ^roles/install-jdk/
|
||||||
|
- ^roles/install-maven/
|
||||||
|
|
||||||
gate:
|
gate:
|
||||||
jobs: *check-jobs
|
jobs: *check-jobs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user