mirror of
https://github.com/imjasonh/krust
synced 2026-07-08 23:05:41 +00:00
implement auth
Signed-off-by: Jason Hall <jason@chainguard.dev>
This commit is contained in:
parent
9d788792ca
commit
5d730a36da
8 changed files with 410 additions and 27 deletions
36
tests/testdata/auth_docker_config_basic.txt
vendored
Normal file
36
tests/testdata/auth_docker_config_basic.txt
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# Test basic auth from Docker config
|
||||
|
||||
# Create a test project
|
||||
-- Cargo.toml --
|
||||
[package]
|
||||
name = "auth-basic-test"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
-- src/main.rs --
|
||||
fn main() {
|
||||
println!("Testing basic auth");
|
||||
}
|
||||
|
||||
# Create Docker config with username/password
|
||||
mkdir .docker
|
||||
-- .docker/config.json --
|
||||
{
|
||||
"auths": {
|
||||
"test.example.com": {
|
||||
"username": "myuser",
|
||||
"password": "mypass"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Set HOME to use our config
|
||||
env HOME=$WORK
|
||||
env RUST_LOG=debug
|
||||
|
||||
# Try to build and push (will fail at registry level, but auth should be resolved)
|
||||
# We can verify auth was read from config in debug logs
|
||||
! exec ./krust build --platform linux/amd64 --image test.example.com/app:latest .
|
||||
stderr 'Resolving auth'
|
||||
stderr 'test.example.com'
|
||||
Loading…
Add table
Add a link
Reference in a new issue