Skip to content

Commit

Permalink
Try #1201:
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Feb 3, 2023
2 parents 4645d93 + 692f8dd commit 96c88b2
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changes/962.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"description": "fix SELinux labels to allow use in multiple containers and/or the host filesystem.",
"type": "fixed",
"issues": [961]
}
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased] - ReleaseDate

## [v0.2.5] - 2023-02-03

## Fixed

- #962 - fix SELinux labels to allow use in multiple containers and/or the host filesystem.

## [v0.2.4] - 2022-07-10

## Fixed
Expand Down Expand Up @@ -364,7 +370,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
<!-- prettier-ignore-start -->
<!-- next-url -->

[Unreleased]: https://github.com/cross-rs/cross/compare/v0.2.4...HEAD
[Unreleased]: https://github.com/cross-rs/cross/compare/v0.2.5...HEAD

[v0.2.5]: https://github.com/cross-rs/cross/compare/v0.2.4...v0.2.5

[v0.2.4]: https://github.com/cross-rs/cross/compare/v0.2.3...v0.2.4

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords = ["cross", "compilation", "testing", "tool"]
license = "MIT OR Apache-2.0"
name = "cross"
repository = "https://github.com/cross-rs/cross"
version = "0.2.4"
version = "0.2.5"
edition = "2021"
include = [
"src/**/*",
Expand Down Expand Up @@ -66,7 +66,6 @@ once_cell = "1"
walkdir = "2"

[package.metadata.release]
dev-version = false
push = false
publish = false
tag = false
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.hack
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARG CROSS_IMAGE
FROM $CROSS_IMAGE
2 changes: 1 addition & 1 deletion deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ vulnerability = "deny"
unmaintained = "deny"
notice = "deny"
unsound = "deny"
ignore = []
ignore = ["RUSTSEC-2021-0145"]

[bans]
multiple-versions = "deny"
Expand Down
14 changes: 7 additions & 7 deletions src/docker/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,29 @@ pub(crate) fn run(
docker_user_id(&mut docker, engine.kind);

docker
.args(&["-v", &format!("{}:/xargo:Z", dirs.xargo.to_utf8()?)])
.args(&["-v", &format!("{}:/cargo:Z", dirs.cargo.to_utf8()?)])
.args(&["-v", &format!("{}:/xargo:z", dirs.xargo.to_utf8()?)])
.args(&["-v", &format!("{}:/cargo:z", dirs.cargo.to_utf8()?)])
// Prevent `bin` from being mounted inside the Docker container.
.args(&["-v", "/cargo/bin"]);
if mount_volumes {
docker.args(&[
"-v",
&format!("{}:{}:Z", dirs.host_root.to_utf8()?, dirs.mount_root),
&format!("{}:{}:z", dirs.host_root.to_utf8()?, dirs.mount_root),
]);
} else {
docker.args(&["-v", &format!("{}:/project:Z", dirs.host_root.to_utf8()?)]);
docker.args(&["-v", &format!("{}:/project:z", dirs.host_root.to_utf8()?)]);
}
docker
.args(&["-v", &format!("{}:/rust:Z,ro", dirs.sysroot.to_utf8()?)])
.args(&["-v", &format!("{}:/target:Z", dirs.target.to_utf8()?)]);
.args(&["-v", &format!("{}:/rust:z,ro", dirs.sysroot.to_utf8()?)])
.args(&["-v", &format!("{}:/target:z", dirs.target.to_utf8()?)]);
docker_cwd(&mut docker, &paths, mount_volumes)?;

// When running inside NixOS or using Nix packaging we need to add the Nix
// Store to the running container so it can load the needed binaries.
if let Some(ref nix_store) = dirs.nix_store {
docker.args(&[
"-v",
&format!("{}:{}:Z", nix_store.to_utf8()?, nix_store.as_posix()?),
&format!("{}:{}:z", nix_store.to_utf8()?, nix_store.as_posix()?),
]);
}

Expand Down
12 changes: 10 additions & 2 deletions xtask/src/build_docker_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,17 @@ fn locate_dockerfile(
cross_toolchain_root: &Path,
) -> cross::Result<(crate::ImageTarget, String)> {
let dockerfile_name = format!("Dockerfile.{target}");
let dockerfile_root = if cross_toolchain_root.join(&dockerfile_name).exists() {
let _dockerfile_root = if cross_toolchain_root.join(&dockerfile_name).exists() {
&cross_toolchain_root
} else if docker_root.join(&dockerfile_name).exists() {
&docker_root
} else {
eyre::bail!("unable to find dockerfile for target \"{target}\"");
};
let dockerfile = dockerfile_root.join(dockerfile_name).to_utf8()?.to_string();
let dockerfile = super::util::project_dir(&mut MessageInfo::default())?
.join("Dockerfile.hack")
.to_utf8()?
.to_string();
Ok((target, dockerfile))
}

Expand Down Expand Up @@ -243,6 +246,11 @@ pub fn build_docker_image(
docker_build.args(&["--build-arg", "VERBOSE=1"]);
}

docker_build.args([
"--build-arg",
&format!("CROSS_IMAGE={}", target.image_name(&repository, "0.2.4")),
]);

if target.needs_workspace_root_context() {
docker_build.arg(&root);
} else {
Expand Down

0 comments on commit 96c88b2

Please sign in to comment.