zuul-jobs/roles/ensure-bazel/tasks/install-bazel.yaml
Paul Albertella ad7297199d Add Bazel build and ensure roles
* Build role requires build target to be specified via a variable
* Ensure role checks for a specific version of Bazel and downloads
  and installs if missing; defaults to v3.1.0 and downloading from
  bazelbuild Github, but these can be overrriden using variables
* Also installs dependencies for Bazel; only supports Ubuntu/Debian
  at present, but includes scope to extend for other platforms
* Includes test playbook and job

Change-Id: I83f198aaf20c2b3664bea6fc05edd3b4fca13a4f
2020-04-30 18:05:41 +01:00

30 lines
1.0 KiB
YAML

- name: Create temp directory
tempfile:
state: directory
register: bazel_installer_tempdir
- name: Get installer checksum
uri:
url: "{{ bazel_release_url }}/{{ bazel_version }}/bazel-{{ bazel_version }}-installer-linux-x86_64.sh.sha256"
return_content: true
register: bazel_installer_checksum
- debug: msg="Checksum is {{ bazel_installer_checksum.content.split(' ')[0] }}"
- 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.content.split(' ')[0] }}"
- debug: msg="Distribution is {{ ansible_distribution }}"
- debug: msg="OS family is {{ ansible_os_family }}"
- name: Install bazel and platform-specific dependencies
include: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}.yaml"
- "{{ ansible_os_family }}.yaml"
- "default.yaml"