|
|
|
---
|
|
|
|
|
|
|
|
- name: Ensure we have sane configuration
|
|
|
|
fail:
|
|
|
|
msg: You must set "besu_git_repo" for this role to run when "besu_build_from_source" is enabled
|
|
|
|
when: not (besu_git_repo is defined) or besu_git_repo|length == 0
|
|
|
|
|
|
|
|
- name: Check JDK version
|
|
|
|
shell: javac -version | egrep -o '[0-9]+\.[0-9]+\.[0-9]+'
|
|
|
|
register: jdk_version
|
|
|
|
changed_when: false
|
|
|
|
ignore_errors: true
|
|
|
|
|
|
|
|
- name: Ensure JDK is installed
|
|
|
|
fail:
|
|
|
|
msg: "You must have JDK 17 or later installed. {{ 'No version found.' if jdk_version is failed else 'Found version ' + jdk_version.stdout }}"
|
|
|
|
when: jdk_version.stdout is version('17.0.0', '<')
|
|
|
|
|
|
|
|
- name: Clone Besu Sources
|
|
|
|
git:
|
|
|
|
repo: "{{ besu_git_repo }}"
|
|
|
|
dest: '/tmp/besu'
|
|
|
|
version: "{{ besu_git_commit }}"
|
|
|
|
recursive: false
|
|
|
|
depth: 1
|
|
|
|
|
|
|
|
- name: Build Besu
|
|
|
|
shell: "JAVA_HOME=$(update-java-alternatives --list | grep 17 | tail -n 1 | awk '{print $3}') ./gradlew --no-daemon --parallel clean assemble"
|
|
|
|
args:
|
|
|
|
chdir: /tmp/besu
|
|
|
|
changed_when: true
|
|
|
|
|
|
|
|
- name: Get Besu Version
|
|
|
|
shell: "basename build/distributions/*.tar.gz .tar.gz | sed 's/^besu-//'"
|
|
|
|
args:
|
|
|
|
chdir: /tmp/besu
|
|
|
|
register: besu_version_cmd
|
|
|
|
changed_when: false
|
|
|
|
|
|
|
|
- name: Set Besu Version Fact
|
|
|
|
set_fact:
|
|
|
|
besu_version: "{{ besu_version_cmd.stdout }}"
|