[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:
|
||||
- install-jdk
|
||||
- install-maven
|
||||
tasks:
|
||||
- name: Build the project with Maven
|
||||
shell: mvn clean install
|
||||
args:
|
||||
chdir: "{{ library_path }}" # Pointing to the directory with pom.xml
|
||||
- role: maven
|
||||
vars:
|
||||
library_path: "{{ zuul.project.src_dir }}/{{ java_libraries[0].context }}"
|
||||
environment:
|
||||
MAVEN_HOME: "/opt/apache-maven-3.8.8"
|
||||
PATH: "{{ ansible_env.PATH }}:/opt/apache-maven-3.8.8/bin"
|
||||
# TODO: support more
|
||||
maven_pom_dir: "{{ java_libraries[0].context }}"
|
||||
maven_phases: ["install"]
|
||||
|
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:
|
||||
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:
|
||||
jobs: *check-jobs
|
||||
|
Loading…
Reference in New Issue
Block a user