1
0
Fork 0
mirror of https://github.com/imjasonh/krust synced 2026-07-18 06:56:13 +00:00

implement auth

Signed-off-by: Jason Hall <jason@chainguard.dev>
This commit is contained in:
Jason Hall 2025-10-15 08:51:46 -04:00
parent 9d788792ca
commit 5d730a36da
8 changed files with 410 additions and 27 deletions

34
tests/testdata/auth_base64.txt vendored Normal file
View file

@ -0,0 +1,34 @@
# Test base64 encoded auth from Docker config
# Create a test project
-- Cargo.toml --
[package]
name = "auth-b64-test"
version = "0.1.0"
edition = "2021"
[dependencies]
-- src/main.rs --
fn main() {
println!("Testing base64 auth");
}
# Create Docker config with base64 auth (testuser:testpass = dGVzdHVzZXI6dGVzdHBhc3M=)
mkdir .docker
-- .docker/config.json --
{
"auths": {
"ghcr.io": {
"auth": "dGVzdHVzZXI6dGVzdHBhc3M="
}
}
}
# Set HOME to use our config
env HOME=$WORK
env RUST_LOG=debug
# Try to build (will fail at registry, but auth should be resolved)
! exec ./krust build --platform linux/amd64 --image ghcr.io/user/app:latest .
stderr 'Resolving auth'
stderr 'ghcr.io'