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
This commit is contained in:
parent
b095e64337
commit
ae22e2c171
@ -11,3 +11,9 @@ Download and install Bazel, if the specified version is not already present.
|
|||||||
:default: 'https://github.com/bazelbuild/bazel/releases/download'
|
:default: 'https://github.com/bazelbuild/bazel/releases/download'
|
||||||
|
|
||||||
The base URL to use when downloading Bazel releases.
|
The base URL to use when downloading Bazel releases.
|
||||||
|
|
||||||
|
.. zuul:rolevar:: bazel_installer_checksum
|
||||||
|
:default: None
|
||||||
|
|
||||||
|
The Bazel installer SHA256 checksum. If not provided, the checksum will be
|
||||||
|
retrieved from Github.
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
bazel_version: '3.1.0'
|
bazel_version: '3.1.0'
|
||||||
bazel_release_url: 'https://github.com/bazelbuild/bazel/releases/download'
|
bazel_release_url: 'https://github.com/bazelbuild/bazel/releases/download'
|
||||||
|
bazel_installer_checksum:
|
||||||
install_bazel_if_missing: true
|
install_bazel_if_missing: true
|
||||||
|
@ -3,22 +3,29 @@
|
|||||||
state: directory
|
state: directory
|
||||||
register: bazel_installer_tempdir
|
register: bazel_installer_tempdir
|
||||||
|
|
||||||
- name: Get installer checksum
|
- name: Fetch checksum from Github
|
||||||
uri:
|
when: not bazel_installer_checksum
|
||||||
url: "{{ bazel_release_url }}/{{ bazel_version }}/bazel-{{ bazel_version }}-installer-linux-x86_64.sh.sha256"
|
block:
|
||||||
return_content: true
|
- name: Get installer checksum
|
||||||
register: bazel_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
|
- name: Display checksum
|
||||||
debug:
|
debug:
|
||||||
msg: "Checksum is {{ bazel_installer_checksum.content.split(' ')[0] }}"
|
msg: "Checksum is {{ bazel_installer_checksum }}"
|
||||||
|
|
||||||
- name: Download bazel installer
|
- name: Download bazel installer
|
||||||
get_url:
|
get_url:
|
||||||
url: "{{ bazel_release_url }}/{{ bazel_version }}/bazel-{{ bazel_version }}-installer-linux-x86_64.sh"
|
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"
|
dest: "{{ bazel_installer_tempdir.path }}/bazel-{{ bazel_version }}-installer-linux-x86_64.sh"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
checksum: "sha256:{{ bazel_installer_checksum.content.split(' ')[0] }}"
|
checksum: "sha256:{{ bazel_installer_checksum }}"
|
||||||
|
|
||||||
- name: Display distribution
|
- name: Display distribution
|
||||||
debug:
|
debug:
|
||||||
|
Loading…
Reference in New Issue
Block a user