zuul-jobs/roles/ensure-rust/tasks/rustup.yaml
Ian Wienand 048aff6c98 Add ensure-rust role
Add a role to install Rust via the rustup tool.  It defaults to
installing globally, which avoids having to worry too much about
setting paths for follow-on jobs.

Packaged Rust and the upstream rustup install tool can live together,
and there's various documentation about it.  Thus I've made this such
that we can expand it with packaged Rust support if there is a need,
but I have not implemented that yet.

Change-Id: I32f9b285904a7036f9a80ada8a49fa9cf31b5163
2020-08-25 09:04:43 +10:00

14 lines
450 B
YAML

- name: Install Rust
shell: | # noqa 303
set -o pipefail
curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain {{ ensure_rust_rustup_toolchain }}
environment:
RUSTUP_HOME: '{{ ensure_rust_rustup_path }}'
CARGO_HOME: '{{ ensure_rust_rustup_path }}'
args:
executable: /bin/bash
become: yes
- name: Use as selected Rust toolchain
command: rustup default {{ ensure_rust_rustup_toolchain }}