zuul-jobs/roles/ensure-bazel/tasks/install-bazel.yaml
Simon Westphahl ae22e2c171
Allow overriding of Bazel installer checksum
Checksum retrieval from Github doesn't work when Artifactory is used as
a Github mirror when the installer is not already cached.

Allow setting the Bazel installer checksum as a variable to make the
role work in such cases.

See also https://www.jfrog.com/jira/browse/RTFACT-22923

Change-Id: Icc3480420895b9052a4f1c133659a31fff0723be
2022-09-30 10:45:31 +02:00

45 lines
1.4 KiB
YAML

- name: Create temp directory
tempfile:
state: directory
register: bazel_installer_tempdir
- name: Fetch checksum from Github
when: not bazel_installer_checksum
block:
- name: Get installer checksum
uri:
url: "{{ bazel_release_url }}/{{ bazel_version }}/bazel-{{ bazel_version }}-installer-linux-x86_64.sh.sha256"
return_content: true
register: zj_checksum_response
- name: Set installer checksum
set_fact:
bazel_installer_checksum: "{{ zj_checksum_response.content.split(' ')[0] }}"
- name: Display checksum
debug:
msg: "Checksum is {{ bazel_installer_checksum }}"
- name: Download bazel installer
get_url:
url: "{{ bazel_release_url }}/{{ bazel_version }}/bazel-{{ bazel_version }}-installer-linux-x86_64.sh"
dest: "{{ bazel_installer_tempdir.path }}/bazel-{{ bazel_version }}-installer-linux-x86_64.sh"
mode: 0755
checksum: "sha256:{{ bazel_installer_checksum }}"
- name: Display distribution
debug:
msg: "Distribution is {{ ansible_distribution }}"
- name: Display OS family
debug:
msg: "OS family is {{ ansible_os_family }}"
- name: Install bazel and platform-specific dependencies
include_tasks: "{{ zj_distro_os }}"
with_first_found:
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"
loop_control:
loop_var: zj_distro_os