Skip to content

Commit cb93f62

Browse files
pimlockdrew
andauthored
fix(e2e): support distroless supervisor fixture (#3431)
* fix(e2e): support distroless supervisor fixture Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com> * test(e2e): preserve provider fixture trust bundle Signed-off-by: Drew Newberry <anewberry@nvidia.com> --------- Signed-off-by: Piotr Mlocek <pmlocek@nvidia.com> Signed-off-by: Drew Newberry <anewberry@nvidia.com> Co-authored-by: Drew Newberry <anewberry@nvidia.com>
1 parent faa7969 commit cb93f62

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

e2e/rust/tests/provider_readiness.rs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ impl FixtureImage {
186186
&self.tag
187187
}
188188

189-
async fn build(&self, dockerfile: &Path, context: &Path) -> Result<(), String> {
189+
async fn build(&self, dockerfile: &Path, context: &Path, label: &str) -> Result<(), String> {
190190
let mut command = Command::from(self.engine.command());
191191
command
192192
.args(["build", "--file"])
193193
.arg(dockerfile)
194194
.args(["--tag", &self.tag])
195195
.arg(context);
196-
checked_command_with_timeout(&mut command, "build fixture image", IMAGE_BUILD_TIMEOUT)
196+
checked_command_with_timeout(&mut command, label, IMAGE_BUILD_TIMEOUT)
197197
.await
198198
.map(|_| ())
199199
}
@@ -1369,16 +1369,26 @@ async fn acknowledged_provider_changes_apply_to_fresh_clients_and_revoke_retaine
13691369
"FROM {base}\nUSER root\nCOPY client.py /opt/provider-readiness-client.py\nUSER sandbox\n"
13701370
)).map_err(|_| "could not write fixture Dockerfile")?;
13711371
let supervisor_dockerfile = context.join("Dockerfile.supervisor");
1372-
// Outbound TLS belongs to the separate supervisor. Its combined public
1373-
// trust bundle is delivered to the workload through the sandbox protocol.
1374-
// Preserve the base image's user setting: Docker's archive upload applies
1375-
// an explicit image user to the supervisor's private bootstrap files.
1372+
// Outbound TLS belongs to the separate supervisor. Assemble its combined
1373+
// public trust bundle in the shell-capable workload image because the
1374+
// final supervisor image is intentionally distroless. Preserve the final
1375+
// image's user setting: Docker's archive upload applies an explicit image
1376+
// user to the supervisor's private bootstrap files.
13761377
std::fs::write(&supervisor_dockerfile, format!(
1377-
"FROM {}\nCOPY fixture-ca.crt /tmp/readiness-fixture-ca.crt\nRUN cat /tmp/readiness-fixture-ca.crt >> /etc/ssl/certs/ca-certificates.crt && rm /tmp/readiness-fixture-ca.crt\n",
1378-
gateway_config.supervisor_image
1378+
"FROM {} AS supervisor\nFROM {base} AS trust-bundle\nUSER 0\nCOPY --from=supervisor /etc/ssl/certs/ca-certificates.crt /tmp/ca-certificates.crt\nCOPY fixture-ca.crt /tmp/readiness-fixture-ca.crt\nRUN [\"/usr/bin/python3\", \"-c\", \"from pathlib import Path; bundle = Path('/tmp/ca-certificates.crt'); bundle.write_bytes(bundle.read_bytes() + Path('/tmp/readiness-fixture-ca.crt').read_bytes())\"]\nFROM {}\nCOPY --from=trust-bundle /tmp/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt\n",
1379+
gateway_config.supervisor_image,
1380+
gateway_config.supervisor_image,
13791381
)).map_err(|_| "could not write fixture supervisor Dockerfile")?;
1380-
image.build(&dockerfile, &context).await?;
1381-
supervisor_image.build(&supervisor_dockerfile, &context).await?;
1382+
image
1383+
.build(&dockerfile, &context, "build workload fixture image")
1384+
.await?;
1385+
supervisor_image
1386+
.build(
1387+
&supervisor_dockerfile,
1388+
&context,
1389+
"build supervisor fixture image",
1390+
)
1391+
.await?;
13821392
gateway_config.apply(supervisor_image.tag()).await?;
13831393
let profile = directory.path().join("profile.json");
13841394
let policy = directory.path().join("policy.json");

0 commit comments

Comments
 (0)