Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Environment Variable Definitions in env.passthrough. #743

Closed
1 of 2 tasks
Alexhuszagh opened this issue Jun 2, 2022 · 1 comment · Fixed by #748
Closed
1 of 2 tasks

Allow Environment Variable Definitions in env.passthrough. #743

Alexhuszagh opened this issue Jun 2, 2022 · 1 comment · Fixed by #748
Labels

Comments

@Alexhuszagh
Copy link
Contributor

Checklist

Describe your request

Currently when we specify passthrough variables for cross, we cannot define the passthrough variable. docker run supports the --env VAR=VALUE syntax, so this should not require much work to support. In fact, removing the following lines and splitting on = to ensure that the key is not CROSS_RUNNER should fix this.

cross/src/docker.rs

Lines 118 to 124 in 1689de1

if var.contains('=') {
bail!("environment variable names must not contain the '=' character");
}
if var == "CROSS_RUNNER" {
bail!("CROSS_RUNNER environment variable name is reserved and cannot be pass through");
}

Describe why this would be a good inclusion for cross

Makes it a lot easier to use Cross.toml since you will not need wrapper scripts to define the environment variable value, or provide them every time on the command line.

Alexhuszagh added a commit to Alexhuszagh/cross that referenced this issue Jun 3, 2022
Delete unused toolchains to save ~600MB in our total image sizes. This is done by removing the toolchains for other targets in `/android-ndk/sysroot/usr/lib/`.

Closes cross-rs#743.
@bors bors bot closed this as completed in 9a23e02 Jun 3, 2022
@Alexhuszagh
Copy link
Contributor Author

FYI Multiple = signs in a variable passed through docker is ok, just like it is here:

$ docker run -it --rm -e V1='V2=V3' centos:7 bash -c 'echo $V1'
V2=V3
$ V1=V2=V3
$ echo "$V1"
V2=V3

Only the first one is the assignment.

bors bot added a commit that referenced this issue Jun 3, 2022
750: Allow key-value pairs in config volumes. r=otavio a=Alexhuszagh

Allow volumes to use the `["VOL=/path/to/volume"]' syntax as well, so additional mount points can be defined by value in the `env.volumes` section of the config file. Allows the following syntax:

```toml
[build.env]
volumes = ["VOL=/path/to/mount/"]
```

Not implementing it with the `env.passthrough` was a complete oversight on my part, related to #743 and #748.

Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant