From ab3e50ccf5b72353804df6d6866decdd79d333d0 Mon Sep 17 00:00:00 2001 From: Ben Cordero Date: Sat, 12 Jun 2021 00:42:21 +0100 Subject: [PATCH 1/2] Get started with lal easier Remove the `configs/` and remove the need to provide a defaults file on first startup. From a fresh checkout $ cargo build $ cargo run -- configure $ cargo run -- build The README has been updated with more examples. This is now because the manifest file can contain the environment definitions, and lal will fallback to the user-wide environment definitions only if not found (to preserve behaviour). As a consequence, the environment to build code can now be configured with the code in `.lal/manifest.json`. --- BUILD => .lal/BUILD | 29 ++++++++++++---- manifest.json => .lal/manifest.json | 11 ++++-- Cargo.lock | 48 +++++++++++--------------- Cargo.toml | 2 +- README.md | 53 ++++++++++++++++++++++++++--- configs/demo.json | 28 --------------- configs/edonus.json | 47 ------------------------- configs/standard.json | 24 ------------- lal.complete.sh | 13 ------- src/app.rs | 7 ++-- src/configure.rs | 8 ++--- src/core/config.rs | 35 +++++++++---------- src/core/manifest.rs | 17 ++++++--- src/env.rs | 6 ++-- src/init.rs | 3 +- src/main.rs | 30 +++++++--------- src/storage/artifactory.rs | 13 ++++++- src/storage/local.rs | 3 +- src/storage/traits.rs | 3 +- tests/cases/test_build.rs | 14 +++++--- tests/cases/test_envs.rs | 5 +-- tests/cases/test_publish.rs | 10 +++--- tests/cases/test_shell.rs | 22 +++++++----- tests/cases/test_stash.rs | 16 +++++---- tests/common/build.rs | 15 +++++--- tests/common/envs.rs | 3 +- tests/common/fetch.rs | 1 + tests/common/mod.rs | 45 ++++++++++++++++++------ tests/common/shell.rs | 4 +-- tests/helloworld/manifest.json | 7 ++++ tests/heylib/manifest.json | 7 ++++ tests/prop-base/manifest.json | 1 + tests/prop-leaf/manifest.json | 1 + tests/prop-mid-1/manifest.json | 1 + tests/prop-mid-2/manifest.json | 1 + 35 files changed, 273 insertions(+), 260 deletions(-) rename BUILD => .lal/BUILD (72%) rename manifest.json => .lal/manifest.json (63%) delete mode 100644 configs/demo.json delete mode 100644 configs/edonus.json delete mode 100644 configs/standard.json diff --git a/BUILD b/.lal/BUILD similarity index 72% rename from BUILD rename to .lal/BUILD index cc3b554c..2b0bf3ab 100755 --- a/BUILD +++ b/.lal/BUILD @@ -1,8 +1,9 @@ #!/bin/bash +set -e + +export PKG_CONFIG_ALLOW_CROSS=1 main() { - # build in the currently available muslrust container - set -e if [ ! -d ~/.cargo/registry ]; then echo "Ensure you have created a cargo-cache docker volume to speed up subsequent builds" echo "If this is your first build, this is normal" @@ -10,17 +11,31 @@ main() { echo "Continuing from blank cache..." fi if [[ $1 == "lal" ]]; then - mkdir -p OUTPUT/{bin,share/lal/configs} - cp configs/*.json OUTPUT/share/lal/configs/ + mkdir -p OUTPUT/{bin,share/lal} cp lal.complete* OUTPUT/share/lal/ if [[ $2 == "slim" ]]; then - (set -x; cargo build --no-default-features --release --verbose) + ( + set -x; cargo build \ + --target x86_64-unknown-linux-musl \ + --no-default-features \ + --release \ + --verbose + ) cp ./target/x86_64-unknown-linux-musl/release/lal OUTPUT/bin/ elif [[ $2 == "release" ]]; then - (set -x; cargo build --release --verbose) + ( + set -x; cargo build \ + --target x86_64-unknown-linux-musl \ + --release \ + --verbose + ) cp ./target/x86_64-unknown-linux-musl/release/lal OUTPUT/bin/ elif [[ $2 == "debug" ]]; then - (set -x; cargo build --verbose) + ( + set -x; cargo build \ + --target x86_64-unknown-linux-musl \ + --verbose + ) cp ./target/x86_64-unknown-linux-musl/debug/lal OUTPUT/bin/ else echo "No such configuration $2 found" diff --git a/manifest.json b/.lal/manifest.json similarity index 63% rename from manifest.json rename to .lal/manifest.json index 71f5bf13..6f697059 100644 --- a/manifest.json +++ b/.lal/manifest.json @@ -1,7 +1,14 @@ { "name": "lal", - "environment": "rust", - "supportedEnvironments": ["rust"], + "environment": "default", + "supportedEnvironments": ["default", "rust"], + "environments": { + "default": null, + "rust": { + "name": "clux/muslrust", + "tag": "latest" + } + }, "components": { "lal": { "defaultConfig": "release", diff --git a/Cargo.lock b/Cargo.lock index 9a3535d1..4c99a472 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -204,7 +204,7 @@ checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.8", + "redox_syscall 0.2.9", "winapi 0.3.9", ] @@ -380,7 +380,7 @@ dependencies = [ "serde_json", "sha1", "tar", - "tempdir", + "tempfile", "walkdir", ] @@ -563,9 +563,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.7.2" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3" +checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" [[package]] name = "openssl" @@ -632,7 +632,7 @@ dependencies = [ "cfg-if 1.0.0", "instant", "libc", - "redox_syscall 0.2.8", + "redox_syscall 0.2.9", "smallvec", "winapi 0.3.9", ] @@ -698,13 +698,13 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" dependencies = [ "libc", "rand_chacha", - "rand_core 0.6.2", + "rand_core 0.6.3", "rand_hc", ] @@ -715,7 +715,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] @@ -735,20 +735,20 @@ checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" [[package]] name = "rand_core" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" dependencies = [ "getrandom", ] [[package]] name = "rand_hc" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" dependencies = [ - "rand_core 0.6.2", + "rand_core 0.6.3", ] [[package]] @@ -768,9 +768,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742739e41cd49414de871ea5e549afb7e2a3ac77b589bcbebe8c82fab37147fc" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" dependencies = [ "bitflags", ] @@ -782,7 +782,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ "getrandom", - "redox_syscall 0.2.8", + "redox_syscall 0.2.9", ] [[package]] @@ -979,16 +979,6 @@ dependencies = [ "xattr", ] -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - [[package]] name = "tempfile" version = "3.2.0" @@ -997,8 +987,8 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.3", - "redox_syscall 0.2.8", + "rand 0.8.4", + "redox_syscall 0.2.9", "remove_dir_all", "winapi 0.3.9", ] diff --git a/Cargo.toml b/Cargo.toml index e0038d92..dbfd5471 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ sha1 = "0.3.0" tar = "0.4.26" walkdir = "1.0.7" dirs = "2.0.2" -tempdir = "0.3.7" +tempfile = "3" [dependencies.indicatif] optional = true diff --git a/README.md b/README.md index 1f75197e..b2746481 100644 --- a/README.md +++ b/README.md @@ -49,15 +49,60 @@ lal configure cfg.json These are built on [CI](https://github.com/lalbuild/lal/releases) via [muslrust](https://github.com/clux/muslrust). You can drop `sudo` if you own or `chown` your install prefix. ## Building -Clone, install from source with [rust](https://www.rust-lang.org/en-US/install.html), setup autocomplete, and select your site-config: +Clone, install from source with [rust](https://www.rust-lang.org/en-US/install.html), setup autocomplete, and site configuration. + +The following sections assume you are working from a local git clone of the repository. ```sh -git clone git@github.com:lalbuild/lal.git && cd lal -cargo install +git clone git@github.com:lalbuild/lal.git +cd lal echo "source $PWD/lal.complete.sh" >> ~/.bash_completion -lal configure configs/demo.json ``` +### Native (with cargo) + +If you don't have `lal` installed yet, you can install it using `cargo install` from git. +It doesn't use `docker` if you don't have it and it doesn't depend on having `lal` installed. + +However, this is not the cleanest build method, and may dynamically link against your system libraries. +The compiled binary may break with future system updates. + +```sh +cargo install + +# Set the initial configuration from defaults +lal configure +``` + +### Native (with lal) + +If you already have `lal` installed, you can build `lal` with `lal`. + +```sh +lal build +cp -v ./OUTPUT/bin/lal ~/bin/lal + +# Pick up configuration updates by reconfiguring with the new binary +lal configure +``` +This is our preferred way to update lal from source. +It doesn't use `docker` if you don't have it, as it uses your local rustup toolchains. +The compiled binary is statically linked, using our configuration options by default. + +### Docker (with muslrust) + +If you have `docker` and `lal` installed, but don't have a rust compiler, you can use our shared toolchain. + +```sh +# Set a temporary override to use a prepared `rust` environment. +lal env set rust + +lal build +cp -v ./OUTPUT/bin/lal ~/bin/lal +lal configure +``` +The compiled binary is statically linked, using our build toolchain for reproducibility. + ## Usage ### Creating a new component diff --git a/configs/demo.json b/configs/demo.json deleted file mode 100644 index 19f7d185..00000000 --- a/configs/demo.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "backend": { - "local": {} - }, - "environments": { - "default": null, - "alpine": { - "name": "clux/lal-alpine", - "tag": "3.6" - }, - "xenial": { - "name": "clux/lal-xenial", - "tag": "latest" - }, - "rust": { - "name": "clux/lal-muslrust", - "tag": "latest" - } - }, - "mounts": [ - { - "src": "~/.lal/history", - "dest": "/home/lal/.bash_history", - "readonly": false - } - ], - "minimum_lal": "3.7.0" -} diff --git a/configs/edonus.json b/configs/edonus.json deleted file mode 100644 index 11fe39d9..00000000 --- a/configs/edonus.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "backend": { - "artifactory": { - "master": "https://engci-maven-master.cisco.com/artifactory", - "slave": "https://engci-maven.cisco.com/artifactory", - "release": "CME-release", - "vgroup": "CME-group", - "credentials": null - } - }, - "environments": { - "py3": { - "name": "edonusdevelopers/build_python", - "tag": "latest" - }, - "rust": { - "name": "edonusdevelopers/muslrust", - "tag": "latest" - }, - "xenial": { - "name": "edonusdevelopers/build_xenial", - "tag": "latest" - }, - "artful": { - "name": "edonusdevelopers/build_artful", - "tag": "latest" - } - }, - "mounts": [ - { - "src": "~/.lal/history", - "dest": "/home/lal/.bash_history", - "readonly": false - }, - { - "src": "/mnt/tools", - "dest": "/tools", - "readonly": true - }, - { - "src": "cargo-cache", - "dest": "/home/lal/.cargo", - "readonly": false - } - ], - "minimum_lal": "3.5.0" -} diff --git a/configs/standard.json b/configs/standard.json deleted file mode 100644 index 3bc8d8ab..00000000 --- a/configs/standard.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "backend": { - "local": {} - }, - "environments": { - "default": null, - "xenial": { - "name": "clux/lal-xenial", - "tag": "latest" - }, - "muslrust": { - "name": "clux/lal-muslrust", - "tag": "latest" - } - }, - "mounts": [ - { - "src": "~/.lal/history", - "dest": "/home/lal/.bash_history", - "readonly": false - } - ], - "minimum_lal": "3.8.0" -} diff --git a/lal.complete.sh b/lal.complete.sh index bce61533..d34d78ce 100644 --- a/lal.complete.sh +++ b/lal.complete.sh @@ -135,19 +135,6 @@ _lal() fi ;; configure) - # figure out what type of lal installation we have - # and from that infer where the configs would be - local -r run_pth=$(readlink -f "$(which lal)") - local config_dir; - if [[ $run_pth == *target/debug/lal ]] || [[ $run_pth == *target/release/lal ]]; then - # compiled lal => configs in the source dir (up from the target build dir) - config_dir="${run_pth%/target/*}/configs" - else - # musl release => configs in prefix/share/lal/configs - config_dir="${run_pth%/bin/*}/share/lal/configs" - fi - local -r configs=$(find "$config_dir" -type f) - COMPREPLY=($(compgen -W "$configs" -- "$cur")) ;; help) COMPREPLY=($(compgen -W "$subcommands" -- "$cur")) diff --git a/src/app.rs b/src/app.rs index 56cb8c19..f93363bf 100644 --- a/src/app.rs +++ b/src/app.rs @@ -188,11 +188,8 @@ pub fn new<'a>() -> App<'a, 'a> { .arg(Arg::with_name("force") .short("f") .help("overwrites manifest if necessary"))) - .subcommand(SubCommand::with_name("configure") - .about("Creates a default lal config ~/.lal/ from a defaults file") - .arg(Arg::with_name("file") - .required(true) - .help("An environments file to seed the config with"))) + .subcommand(SubCommand::with_name("configure")) + .about("Creates a default lal config ~/.lal/config from defaults") .subcommand(SubCommand::with_name("export") .about("Fetch a raw tarball from artifactory") .arg(Arg::with_name("component") diff --git a/src/configure.rs b/src/configure.rs index caabe3fb..32747b50 100644 --- a/src/configure.rs +++ b/src/configure.rs @@ -205,7 +205,7 @@ fn create_lal_dir(home: Option<&Path>) -> LalResult { /// /// A boolean option to discard the output is supplied for tests. /// A defaults file must be supplied to seed the new config with defined environments -pub fn configure(save: bool, interactive: bool, defaults: &str, home: Option<&Path>) -> LalResult { +pub fn configure(save: bool, interactive: bool, home: Option<&Path>) -> LalResult { let _ = create_lal_dir(home)?; for exe in ["tar", "touch", "id", "find", "mkdir", "chmod", "uname"].iter() { @@ -223,14 +223,14 @@ pub fn configure(save: bool, interactive: bool, defaults: &str, home: Option<&Pa ssl_cert_sanity()?; non_root_sanity()?; - let def = ConfigDefaults::read(defaults)?; + let defaults = ConfigDefaults::new(); // Enforce minimum_lal version check here if it's set in the defaults file - if let Some(minlal) = def.minimum_lal.clone() { + if let Some(minlal) = defaults.minimum_lal.clone() { lal_version_check(&minlal)?; } - let mut cfg = Config::new(def, home); + let mut cfg = Config::new(defaults, home); cfg.interactive = interactive; // need to override default for tests if save { cfg.write(false, home)?; diff --git a/src/core/config.rs b/src/core/config.rs index cac31059..a551ca02 100644 --- a/src/core/config.rs +++ b/src/core/config.rs @@ -8,7 +8,7 @@ use std::{ }; use super::{CliError, Container, Environment, LalResult}; -use crate::storage::BackendConfiguration; +use crate::storage::{BackendConfiguration, LocalConfig}; fn find_home_dir() -> PathBuf { // Either we have LAL_CONFIG_HOME evar, or HOME @@ -29,7 +29,7 @@ pub fn config_dir(home: Option<&Path>) -> PathBuf { } /// Docker volume mount representation -#[derive(Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone)] pub struct Mount { /// File or folder to mount pub src: String, @@ -41,7 +41,7 @@ pub struct Mount { /// Representation of `~/.lal/config` #[allow(non_snake_case)] -#[derive(Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone)] pub struct Config { /// Configuration settings for the `Backend` pub backend: BackendConfiguration, @@ -78,16 +78,14 @@ pub struct ConfigDefaults { impl ConfigDefaults { /// Open and deserialize a defaults file - pub fn read(file: &str) -> LalResult { - let pth = Path::new(file); - if !pth.exists() { - error!("No such defaults file '{}'", file); // file open will fail below + pub fn new() -> Self { + ConfigDefaults { + backend: BackendConfiguration::Local(LocalConfig{}), + environments: BTreeMap::::new(), + mounts: Vec::::new(), + minimum_lal: Option::::None, + } - let mut f = fs::File::open(&pth)?; - let mut data = String::new(); - f.read_to_string(&mut data)?; - let defaults: ConfigDefaults = serde_json::from_str(&data)?; - Ok(defaults) } } @@ -120,7 +118,6 @@ fn check_mount(name: &str) -> LalResult { } } - impl Config { /// Initialize a Config with ConfigDefaults /// @@ -202,18 +199,18 @@ impl Config { } /// Resolve an arbitrary environment shorthand - pub fn get_environment(&self, env: String) -> LalResult { - if let Some(environment) = self.environments.get(&env) { + pub fn get_environment(&self, env: &str) -> LalResult { + if let Some(environment) = self.environments.get(env) { return Ok(environment.clone()); } - Err(CliError::MissingEnvironment(env)) + Err(CliError::MissingEnvironment(env.to_string())) } /// Resolve an arbitrary container shorthand - pub fn get_container(&self, env: String) -> LalResult { - match self.get_environment(env.clone())? { + pub fn get_container(&self, env: &str) -> LalResult { + match self.get_environment(env)? { Environment::Container(container) => Ok(container), - Environment::None => Err(CliError::MissingEnvironment(env)), + Environment::None => Err(CliError::MissingEnvironment(env.to_string())), } } } diff --git a/src/core/manifest.rs b/src/core/manifest.rs index 6e97c3d3..5aae2559 100644 --- a/src/core/manifest.rs +++ b/src/core/manifest.rs @@ -6,7 +6,7 @@ use std::{ vec::Vec, }; -use super::{CliError, LalResult}; +use super::{CliError, LalResult, Environment}; /// A startup helper used in a few places pub fn create_lal_subdir(pwd: &Path) -> LalResult<()> { @@ -19,7 +19,7 @@ pub fn create_lal_subdir(pwd: &Path) -> LalResult<()> { /// Representation of a value of the manifest.components hash #[allow(non_snake_case)] -#[derive(Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone)] pub struct ComponentConfiguration { /// The default config to use if not passed in - default is "release" pub defaultConfig: String, @@ -38,7 +38,7 @@ impl Default for ComponentConfiguration { /// Representation of `manifest.json` #[allow(non_snake_case)] -#[derive(Serialize, Deserialize, Clone, Default)] +#[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct Manifest { /// Name of the main component pub name: String, @@ -46,6 +46,8 @@ pub struct Manifest { pub environment: String, /// All the environments dependencies can currently be found in pub supportedEnvironments: Vec, + /// Custom environment definitions, or fallback to ~/.lal/config + pub environments: BTreeMap, /// Components and their available configurations that are buildable pub components: BTreeMap, /// Dependencies that are always needed @@ -100,7 +102,6 @@ impl ManifestLocation { } } - impl Manifest { /// Initialize a manifest struct based on a name /// @@ -190,4 +191,12 @@ impl Manifest { } Ok(()) } + + /// Resolve an arbitrary environment + pub fn get_environment(&self, env: &str) -> LalResult { + if let Some(environment) = self.environments.get(env) { + return Ok(environment.clone()); + } + Err(CliError::MissingEnvironment(env.to_string())) + } } diff --git a/src/env.rs b/src/env.rs index 26c8843b..bee3c860 100644 --- a/src/env.rs +++ b/src/env.rs @@ -1,6 +1,6 @@ use std::{path::Path, process::Command, vec::Vec}; -use super::{CliError, Config, Environment, LalResult, StickyOptions}; +use super::{CliError, Config, Environment, LalResult, Manifest, StickyOptions}; /// Pull the current environment from docker pub fn update(component_dir: &Path, environment: &Environment, env: &str) -> LalResult<()> { @@ -25,8 +25,8 @@ pub fn update(component_dir: &Path, environment: &Environment, env: &str) -> Lal } /// Creates and sets the environment in the local .lal/opts file -pub fn set(component_dir: &Path, opts_: &StickyOptions, cfg: &Config, env: &str) -> LalResult<()> { - if !cfg.environments.contains_key(env) { +pub fn set(component_dir: &Path, opts_: &StickyOptions, cfg: &Config, mf: &Manifest, env: &str) -> LalResult<()> { + if !cfg.environments.contains_key(env) && !mf.environments.contains_key(env) { return Err(CliError::MissingEnvironment(env.into())); } // mutate a temporary copy - lal binary is done after this function anyway diff --git a/src/init.rs b/src/init.rs index ee745a89..fa5c9337 100644 --- a/src/init.rs +++ b/src/init.rs @@ -3,7 +3,6 @@ use std::path::{Component, Path}; use super::{CliError, Config, LalResult}; use crate::core::manifest::*; - /// Generates a blank manifest in the current directory /// /// This will use the directory name as the assumed default component name @@ -12,7 +11,7 @@ use crate::core::manifest::*; /// The function will not overwrite an existing `manifest.json`, /// unless the `force` bool is set. pub fn init(cfg: &Config, force: bool, component_dir: &Path, env: &str) -> LalResult<()> { - cfg.get_environment(env.into())?; + cfg.get_environment(env)?; let last_comp: Component<'_> = component_dir.components().last().unwrap(); let dirname = last_comp.as_os_str().to_str().unwrap(); diff --git a/src/main.rs b/src/main.rs index 6765e475..51ced627 100644 --- a/src/main.rs +++ b/src/main.rs @@ -144,12 +144,13 @@ fn handle_env_command( args: &ArgMatches<'_>, component_dir: &Path, cfg: &Config, + mf: &Manifest, env: &str, stickies: &StickyOptions, ) -> Environment { // lookup associated container from - let environment = cfg - .get_environment(env.into()) + let environment = mf.get_environment(env) + .or_else(|_| cfg.get_environment(env)) .map_err(|e| { error!("Environment error: {}", e); println!("Ensure that manifest.environment has a corresponding entry in ~/.lal/config"); @@ -170,7 +171,7 @@ fn handle_env_command( } else if let Some(sa) = a.subcommand_matches("set") { result_exit( "env override", - lal::env::set(&component_dir, stickies, cfg, sa.value_of("environment").unwrap()), + lal::env::set(&component_dir, stickies, cfg, mf, sa.value_of("environment").unwrap()), ) } else { // just print current environment @@ -209,7 +210,6 @@ fn handle_upgrade(args: &ArgMatches, cfg: &Config) { } } - fn handle_docker_cmds( args: &ArgMatches<'_>, component_dir: &Path, @@ -261,11 +261,9 @@ fn handle_docker_cmds( &component_dir, ) } else if let Some(a) = args.subcommand_matches("run") { - let xs = if a.is_present("parameters") { - a.values_of("parameters").unwrap().collect::>() - } else { - vec![] - }; + let xs: Vec<&str> = a.values_of("parameters") + .map_or_else(Vec::new, |p| p.collect()); + let modes = ShellModes { printonly: a.is_present("print"), x11_forwarding: a.is_present("x11"), @@ -300,10 +298,10 @@ fn main() { .unwrap(); // Allow lal configure without assumptions - if let Some(a) = args.subcommand_matches("configure") { + if let Some(_a) = args.subcommand_matches("configure") { result_exit( "configure", - lal::configure(true, true, a.value_of("file").unwrap(), None), + lal::configure(true, true, None), ); } @@ -312,11 +310,7 @@ fn main() { .map_err(|e| { error!("Configuration error: {}", e); println!(); - println!("If you just got upgraded use `lal configure `"); - println!( - "Site configs are found in {{install_prefix}}/share/lal/configs/ \ - and should auto-complete" - ); + println!("If you have just installed or upgraded, run `lal configure`"); process::exit(1); }) .unwrap(); @@ -362,7 +356,7 @@ fn main() { let explicit_env = args.value_of("environment"); if let Some(env) = explicit_env { config - .get_environment(env.into()) + .get_environment(env) .map_err(|e| { error!("Environment error: {}", e); process::exit(1) @@ -392,7 +386,7 @@ fn main() { } else { manifest.environment.clone() }; - let environment = handle_env_command(&args, &component_dir, &config, &env, &stickies); + let environment = handle_env_command(&args, &component_dir, &config, &manifest, &env, &stickies); // Warn users who are using an unsupported environment let sub = args.subcommand_name().unwrap(); diff --git a/src/storage/artifactory.rs b/src/storage/artifactory.rs index 85a3562d..d299bdf1 100644 --- a/src/storage/artifactory.rs +++ b/src/storage/artifactory.rs @@ -1,6 +1,7 @@ #![allow(missing_docs)] use std::{ + fmt, fs::File, io::{Read, Write}, path::{Path, PathBuf}, @@ -30,8 +31,18 @@ pub struct Credentials { pub password: String, } +// Impl Debug without exposing `password` +impl fmt::Debug for Credentials { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fmt.debug_struct("Credentals") + .field("username", &self.username) + .field("password", &format!("*** ({} characters)", self.password.len())) + .finish() + } +} + /// Static Artifactory locations -#[derive(Serialize, Deserialize, Clone, Default)] +#[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct ArtifactoryConfig { /// Location of artifactory API master (for API queries) pub master: String, diff --git a/src/storage/local.rs b/src/storage/local.rs index 81753bb8..c84c33da 100644 --- a/src/storage/local.rs +++ b/src/storage/local.rs @@ -10,9 +10,8 @@ use std::{ use crate::core::{config_dir, ensure_dir_exists_fresh, CliError, LalResult}; - /// LocalBackend configuration options (currently none) -#[derive(Serialize, Deserialize, Clone, Default)] +#[derive(Debug, Serialize, Deserialize, Clone, Default)] pub struct LocalConfig {} use super::{Backend, Component}; diff --git a/src/storage/traits.rs b/src/storage/traits.rs index 49096f72..f651b99f 100644 --- a/src/storage/traits.rs +++ b/src/storage/traits.rs @@ -7,7 +7,7 @@ use crate::core::LalResult; /// /// Any other implementations should be imported and listed here. /// Currently only artifactory is supported. -#[derive(Serialize, Deserialize, Clone)] +#[derive(Debug, Serialize, Deserialize, Clone)] pub enum BackendConfiguration { /// Config for the `ArtifactoryBackend` #[serde(rename = "artifactory")] @@ -25,7 +25,6 @@ impl Default for BackendConfiguration { } } - /// The basic definition of a component as it exists online /// /// A component may have many build artifacts from many environments. diff --git a/tests/cases/test_build.rs b/tests/cases/test_build.rs index dd44eb5e..639b8145 100644 --- a/tests/cases/test_build.rs +++ b/tests/cases/test_build.rs @@ -28,15 +28,16 @@ fn test_build_with_force(env_name: &str) { // Test basic build functionality with heylib component let component_dir = clone_component_dir("heylib", &state); + let manifest = lal::Manifest::read(&component_dir).expect("read manifest"); let r = fetch::fetch_input(&component_dir, &env_name, &state.backend); assert!(r.is_ok(), "installed heylib dependencies"); // Force build the component - let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name).expect("build options"); + let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name, &manifest).expect("build options"); build_opts.force = true; - let r = build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts); assert!(r.is_ok(), "built heylib with force"); } @@ -49,15 +50,16 @@ fn test_build_with_force_in_wrong_environment(env_name: &str) { // Test basic build functionality with heylib component let component_dir = clone_component_dir("heylib", &state); + let manifest = lal::Manifest::read(&component_dir).expect("read manifest"); let r = fetch::fetch_input(&component_dir, &env_name, &state.backend); assert!(r.is_ok(), "installed heylib dependencies"); // Force build the component - let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name).expect("build options"); + let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name, &manifest).expect("build options"); build_opts.force = true; - let r = build::build_with_options(&component_dir, "nonexistant", &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, "nonexistant", &state.tempdir.path(), &build_opts); assert!(r.is_ok(), "built heylib with force in nonexistant environment"); } @@ -70,11 +72,13 @@ fn test_build_with_printonly(env_name: &str) { // Test basic build functionality with heylib component let component_dir = clone_component_dir("heylib", &state); + let manifest = lal::Manifest::read(&component_dir).expect("read manifest"); + let r = fetch::fetch_input(&component_dir, &env_name, &state.backend); assert!(r.is_ok(), "installed heylib dependencies"); // Default build options - let build_opts = build::options(Some(&state.tempdir.path()), &env_name).expect("build options"); + let build_opts = build::options(Some(&state.tempdir.path()), &env_name, &manifest).expect("build options"); // Print commands, don't execute let mut modes = lal::ShellModes::default(); diff --git a/tests/cases/test_envs.rs b/tests/cases/test_envs.rs index 4ebc2098..c176287c 100644 --- a/tests/cases/test_envs.rs +++ b/tests/cases/test_envs.rs @@ -13,7 +13,7 @@ fn test_change_envs(env_name: &str) { fs::create_dir(&component_dir).expect("create new_component dir"); let r = init::init(&component_dir, &env_name, &state.tempdir.path()); - assert!(r.is_ok(), "new component created"); + assert!(r.is_ok(), "new component created: {:?}", r); // Read sticky options let sticky = lal::StickyOptions::read(&component_dir).expect("read sticky options"); @@ -22,8 +22,9 @@ fn test_change_envs(env_name: &str) { assert_eq!(sticky.env, None); // Change env (even works with unsupported envs) + configure_test_environment(&state.tempdir.path(), "xenial"); let r = envs::set_environment(&component_dir, &state.tempdir.path(), &sticky, "xenial"); - assert!(r.is_ok(), "environment set to xenial"); + assert!(r.is_ok(), "environment set to xenial: {:?}", r); // Reread sticky options let sticky = lal::StickyOptions::read(&component_dir).expect("reread sticky options"); diff --git a/tests/cases/test_publish.rs b/tests/cases/test_publish.rs index a1c91500..1e980d82 100644 --- a/tests/cases/test_publish.rs +++ b/tests/cases/test_publish.rs @@ -46,15 +46,16 @@ fn test_publish_without_release(env_name: &str) { // publish heylib, a component without a dependency let component_dir = clone_component_dir("heylib", &state); + let manifest = lal::Manifest::read(&component_dir).expect("read manifest"); let r = fetch::fetch_input(&component_dir, &env_name, &state.backend); assert!(r.is_ok(), "installed heylib dependencies: {:?}", r); - let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name).expect("build options"); + let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name, &manifest).expect("build options"); build_opts.version = Some("1".into()); build_opts.release = false; - let r = build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts); assert!(r.is_ok(), "built heylib without release: {:?}", r); let r = publish::publish_release(&component_dir, &state.backend, &state.tempdir.path()); @@ -70,15 +71,16 @@ fn test_publish_without_version(env_name: &str) { // publish heylib, a component without a dependency let component_dir = clone_component_dir("heylib", &state); + let manifest = lal::Manifest::read(&component_dir).expect("read manifest"); let r = fetch::fetch_input(&component_dir, &env_name, &state.backend); assert!(r.is_ok(), "installed heylib dependencies"); - let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name).expect("build options"); + let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name, &manifest).expect("build options"); build_opts.version = None; build_opts.release = true; - let r = build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts); assert!(r.is_ok(), "built heylib without version: {:?}", r); let r = publish::publish_release(&component_dir, &state.backend, &state.tempdir.path()); diff --git a/tests/cases/test_shell.rs b/tests/cases/test_shell.rs index 3caaeb46..281ded70 100644 --- a/tests/cases/test_shell.rs +++ b/tests/cases/test_shell.rs @@ -11,11 +11,13 @@ pub fn test_heylib_echo(env_name: &str) { // Test basic build functionality with heylib component let component_dir = clone_component_dir("heylib", &state); - let r = shell::run(&env_name, &state.tempdir.path(), &component_dir, vec![ - "echo", - "# echo from docker", - ]); - assert!(r.is_ok(), "shell echoed"); + let r = shell::run( + &env_name, + &state.tempdir.path(), + &component_dir, + vec!["echo", "# echo from docker"], + ); + assert!(r.is_ok(), "shell echoed: {:?}", r); } #[parameterized(env_name = {"default", "alpine"})] @@ -28,10 +30,12 @@ pub fn test_shell_permissions(env_name: &str) { // Test basic build functionality with heylib component let component_dir = clone_component_dir("heylib", &state); - let r = shell::run(&env_name, &state.tempdir.path(), &component_dir, vec![ - "touch", - "README.md", - ]); + let r = shell::run( + &env_name, + &state.tempdir.path(), + &component_dir, + vec!["touch", "README.md"], + ); assert!(r.is_ok(), "could touch files in container"); } diff --git a/tests/cases/test_stash.rs b/tests/cases/test_stash.rs index 4b84d74e..23f9a7f6 100644 --- a/tests/cases/test_stash.rs +++ b/tests/cases/test_stash.rs @@ -30,15 +30,16 @@ fn test_build_stashed_self_with_simple_verify(env_name: &str) { // Test basic build functionality with heylib component let component_dir = clone_component_dir("heylib", &state); + let manifest = lal::Manifest::read(&component_dir).expect("read manifest"); - let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name).expect("build options"); + let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name, &manifest).expect("build options"); build_opts.name = Some("heylib".to_string()); build_opts.version = None; // Initial build to generate a stashed component let r = fetch::fetch_input(&component_dir, &env_name, &state.backend); assert!(r.is_ok(), "installed heylib dependencies"); - let r = build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts); assert!(r.is_ok(), "built heylib for stashing"); let r = stash::stash(&component_dir, &state.backend, "blah"); assert!(r.is_ok(), "stashed heylib=blah artifact"); @@ -51,7 +52,7 @@ fn test_build_stashed_self_with_simple_verify(env_name: &str) { // Build with the stashed dependency in INPUT // This will fail, since stashed dependencies are not available to anyone besides // yourself locally. A stashed dependency is never published. - let r = build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts); match r { Err(lal::CliError::NonGlobalDependencies(nonglobal)) => { assert_eq!(nonglobal, "heylib"); @@ -65,7 +66,7 @@ fn test_build_stashed_self_with_simple_verify(env_name: &str) { // The build can succeed if using the `simple_verify` algorithm. build_opts.force = false; build_opts.simple_verify = true; - let r = build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts); assert!( r.is_ok(), "built heylib using stashed dependencies (simple_verify = true)" @@ -81,15 +82,16 @@ fn test_build_stashed_self_with_force(env_name: &str) { // Test basic build functionality with heylib component let component_dir = clone_component_dir("heylib", &state); + let manifest = lal::Manifest::read(&component_dir).expect("read manifest"); - let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name).expect("build options"); + let mut build_opts = build::options(Some(&state.tempdir.path()), &env_name, &manifest).expect("build options"); build_opts.name = Some("heylib".into()); build_opts.version = None; // Initial build to generate a stashed component let r = fetch::fetch_input(&component_dir, &env_name, &state.backend); assert!(r.is_ok(), "installed heylib dependencies"); - let r = build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts); assert!(r.is_ok(), "built heylib for stashing"); let r = stash::stash(&component_dir, &state.backend, "blah"); assert!(r.is_ok(), "stashed heylib=blah artifact"); @@ -103,7 +105,7 @@ fn test_build_stashed_self_with_force(env_name: &str) { // The build can succeed if using `force`. build_opts.force = true; build_opts.simple_verify = false; - let r = build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts); + let r = build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts); assert!( r.is_ok(), "built heylib using stashed dependencies (force = true)" diff --git a/tests/common/build.rs b/tests/common/build.rs index dc4e2ee7..81fcf638 100644 --- a/tests/common/build.rs +++ b/tests/common/build.rs @@ -1,8 +1,12 @@ use std::path::Path; -pub fn options(home: Option<&Path>, env_name: &str) -> lal::LalResult { +pub fn options(home: Option<&Path>, env_name: &str, manifest: &lal::Manifest) -> lal::LalResult { let config = lal::Config::read(home)?; - let environment = config.get_environment(env_name.to_string())?; + debug!("options: config: {:#?}", config); + + let environment = manifest.get_environment(env_name) + .or(config.get_environment(env_name))?; + debug!("options: environment: {}", environment); Ok(lal::BuildOptions { name: None, @@ -22,20 +26,21 @@ pub fn build_for_release( home: &Path, version: &str, ) -> lal::LalResult<()> { - let mut build_opts = options(Some(&home), &env_name)?; + let manifest = lal::Manifest::read(&component_dir)?; + let mut build_opts = options(Some(&home), &env_name, &manifest)?; build_opts.version = Some(version.to_string()); - build_with_options(&component_dir, &env_name, &home, &build_opts) + build_with_options(&component_dir, &manifest, &env_name, &home, &build_opts) } pub fn build_with_options( component_dir: &Path, + manifest: &lal::Manifest, env_name: &str, home: &Path, build_opts: &lal::BuildOptions, ) -> lal::LalResult<()> { let config = lal::Config::read(Some(&home))?; - let manifest = lal::Manifest::read(&component_dir)?; let modes = lal::ShellModes::default(); lal::build( diff --git a/tests/common/envs.rs b/tests/common/envs.rs index 8812af45..0e2b6cf4 100644 --- a/tests/common/envs.rs +++ b/tests/common/envs.rs @@ -7,7 +7,8 @@ pub fn set_environment( env_name: &str, ) -> lal::LalResult<()> { let config = lal::Config::read(Some(&home))?; - lal::env::set(&component_dir, &sticky, &config, &env_name) + let manifest = lal::Manifest::read(&component_dir)?; + lal::env::set(&component_dir, &sticky, &config, &manifest, &env_name) } pub fn clear_environment(component_dir: &Path) -> lal::LalResult<()> { diff --git a/tests/common/fetch.rs b/tests/common/fetch.rs index 1d4db4a6..767f8146 100644 --- a/tests/common/fetch.rs +++ b/tests/common/fetch.rs @@ -6,6 +6,7 @@ pub fn fetch_input( backend: &dyn lal::CachedBackend, ) -> lal::LalResult<()> { let manifest = lal::Manifest::read(&component_dir)?; + debug!("Component manifest: {:?}", manifest); lal::fetch(&component_dir, &manifest, backend, true, &env_name) } diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 24e220f8..b8cec54e 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -1,13 +1,12 @@ use fs_extra; use lal; use loggerv; -use tempdir; - +use tempfile; use crate::common::{ fs_extra::dir::{copy, CopyOptions}, loggerv::init_with_verbosity, - tempdir::TempDir, + tempfile::TempDir, }; use std::{ @@ -50,13 +49,14 @@ pub fn setup() -> TestState { init_with_verbosity(2).expect("Setting up test logging"); }); - let demo_config = PathBuf::from("./configs/demo.json"); let testdir = PathBuf::from("./tests"); // Do all lal tests in a tempdir as it messes with the manifest - let tempdir = TempDir::new("laltest").unwrap(); + let tempdir = TempDir::new().unwrap(); - let backend = configure_local_backend(&demo_config, &tempdir.path()); + let backend = configure_local_backend(&tempdir.path()); + configure_test_environment(&tempdir.path(), "default"); + configure_test_environment(&tempdir.path(), "alpine"); TestState { backend, @@ -65,14 +65,13 @@ pub fn setup() -> TestState { } } -fn configure_local_backend(demo_config: &PathBuf, home: &Path) -> LocalBackend { +fn configure_local_backend(home: &Path) -> LocalBackend { let config = Config::read(Some(&home)); assert!(config.is_err(), "no config at this point"); let r = lal::configure( true, false, - demo_config.as_os_str().to_str().unwrap(), Some(&home), ); assert!(r.is_ok(), "configure succeeded"); @@ -88,6 +87,31 @@ fn configure_local_backend(demo_config: &PathBuf, home: &Path) -> LocalBackend { } } +pub fn configure_test_environment(home: &Path, env_name: &str) +{ + let mut config = Config::read(Some(&home)).expect("no configuration file"); + + let environment = match env_name { + "default" => lal::Environment::None, + "alpine" => lal::Environment::Container( + lal::Container{ + name: "clux/lal-alpine".to_string(), + tag: "3.6".to_string(), + } + ), + "xenial" => lal::Environment::Container( + lal::Container{ + name: "clux/lal-xenial".to_string(), + tag: "latest".to_string(), + } + ), + _ => panic!("Unknown environment"), + }; + + config.environments.insert(env_name.to_string(), environment); + config.write(false, Some(&home)).expect("wrote testing config"); +} + // Copies the component to a temporary location for this test // and sets the working directory to that location pub fn clone_component_dir(component: &str, state: &TestState) -> PathBuf { @@ -167,10 +191,11 @@ pub fn stash_component( stash_name: &str, ) -> lal::LalResult { let component_dir = clone_component_dir(component, &state); - let build_opts = build::options(Some(&state.tempdir.path()), &env_name)?; + let manifest = lal::Manifest::read(&component_dir)?; + let build_opts = build::options(Some(&state.tempdir.path()), &env_name, &manifest)?; fetch::fetch_input(&component_dir, &env_name, &state.backend)?; - build::build_with_options(&component_dir, &env_name, &state.tempdir.path(), &build_opts)?; + build::build_with_options(&component_dir, &manifest, &env_name, &state.tempdir.path(), &build_opts)?; stash::stash(&component_dir, &state.backend, stash_name)?; Ok(component_dir) diff --git a/tests/common/shell.rs b/tests/common/shell.rs index 7e50eaeb..f3a0468e 100644 --- a/tests/common/shell.rs +++ b/tests/common/shell.rs @@ -2,7 +2,7 @@ use std::path::Path; pub fn run(env_name: &str, home: &Path, component_dir: &Path, command_args: Vec<&str>) -> lal::LalResult<()> { let cfg = lal::Config::read(Some(&home))?; - let environment = cfg.get_environment(env_name.into())?; + let environment = cfg.get_environment(env_name)?; let modes = lal::ShellModes::default(); let mut args = Vec::::new(); @@ -28,7 +28,7 @@ pub fn run_script( script_args: Vec<&str>, ) -> lal::LalResult<()> { let cfg = lal::Config::read(Some(&home))?; - let environment = cfg.get_environment(env_name.into())?; + let environment = cfg.get_environment(env_name)?; let modes = lal::ShellModes::default(); lal::script( diff --git a/tests/helloworld/manifest.json b/tests/helloworld/manifest.json index f3aba978..75e48a51 100644 --- a/tests/helloworld/manifest.json +++ b/tests/helloworld/manifest.json @@ -1,6 +1,13 @@ { "name": "hello", "environment": "default", + "environments": { + "default": null, + "alpine": { + "name": "clux/lal-alpine", + "tag": "3.6" + } + }, "supportedEnvironments": [ "default" ], diff --git a/tests/heylib/manifest.json b/tests/heylib/manifest.json index 39a3f778..a10852dc 100644 --- a/tests/heylib/manifest.json +++ b/tests/heylib/manifest.json @@ -1,6 +1,13 @@ { "name": "heylib", "environment": "default", + "environments": { + "default": null, + "alpine": { + "name": "clux/lal-alpine", + "tag": "3.6" + } + }, "supportedEnvironments": [ "default", "alpine" ], diff --git a/tests/prop-base/manifest.json b/tests/prop-base/manifest.json index 6d74b5f8..525c430d 100644 --- a/tests/prop-base/manifest.json +++ b/tests/prop-base/manifest.json @@ -1,6 +1,7 @@ { "name": "prop-base", "environment": "alpine", + "environments": {}, "supportedEnvironments": [ "alpine" ], diff --git a/tests/prop-leaf/manifest.json b/tests/prop-leaf/manifest.json index 697c2a2b..11992fa2 100644 --- a/tests/prop-leaf/manifest.json +++ b/tests/prop-leaf/manifest.json @@ -1,6 +1,7 @@ { "name": "prop-leaf", "environment": "alpine", + "environments": {}, "supportedEnvironments": [ "default", "alpine" ], diff --git a/tests/prop-mid-1/manifest.json b/tests/prop-mid-1/manifest.json index c3ad2adf..c2605be7 100644 --- a/tests/prop-mid-1/manifest.json +++ b/tests/prop-mid-1/manifest.json @@ -1,6 +1,7 @@ { "name": "prop-mid-1", "environment": "alpine", + "environments": {}, "supportedEnvironments": [ "alpine" ], diff --git a/tests/prop-mid-2/manifest.json b/tests/prop-mid-2/manifest.json index 4ebd93c8..b68dfd65 100644 --- a/tests/prop-mid-2/manifest.json +++ b/tests/prop-mid-2/manifest.json @@ -1,6 +1,7 @@ { "name": "prop-mid-2", "environment": "alpine", + "environments": {}, "supportedEnvironments": [ "alpine" ], From bc61a4e090cfe36206d428a6ecb94a0d461c4f6a Mon Sep 17 00:00:00 2001 From: Ben Cordero Date: Sun, 20 Jun 2021 18:54:51 +0100 Subject: [PATCH 2/2] Cargo Test: Only needs to login to docker hub for full test suite --- .github/workflows/pull_request.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 5e33319d..d9f36afc 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,12 +18,6 @@ jobs: target: 'x86_64-unknown-linux-musl' profile: 'minimal' - - name: 'Login to Docker Hub' - uses: 'docker/login-action@v1' - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: 'Cache Rust Targets' uses: 'actions/cache@v2' with: @@ -65,6 +59,12 @@ jobs: runs-on: 'ubuntu-latest' needs: 'build' steps: + - name: 'Login to Docker Hub' + uses: 'docker/login-action@v1' + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - uses: 'actions/checkout@v2' - name: 'Cache Rust Targets' uses: 'actions/cache@v2'