zuul-jobs/test-playbooks/build-roles/ensure-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

25 lines
798 B
YAML

- name: Test correct version of bazel installed
hosts: all
roles:
- role: ensure-bazel
post_tasks:
- name: Confirm correct version installed
shell: bazel --version | grep -Eo '([0-9]+\.)+[0-9]+'
ignore_errors: yes
register: confirmed_bazel_version
failed_when: bazel_version != confirmed_bazel_version.stdout
- name: Test bazel not installed when install_bazel_if_missing is false
hosts: all
roles:
- role: ensure-bazel
vars:
bazel_version: '1.2.1'
install_bazel_if_missing: False
post_tasks:
- name: Confirm version not installed
shell: bazel --version | grep -Eo '([0-9]+\.)+[0-9]+'
ignore_errors: yes
register: confirmed_bazel_version
failed_when: bazel_version == confirmed_bazel_version.stdout