Skip to content

Commit

Permalink
Merge pull request #430 from cbgbt/golang-updates
Browse files Browse the repository at this point in the history
krane-static: update golang dependencies
  • Loading branch information
cbgbt authored Jan 3, 2025
2 parents a9323d8 + add11f2 commit f4c2498
Show file tree
Hide file tree
Showing 8 changed files with 166 additions and 199 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ bottlerocket-types = { version = "0.0.14", git = "https://github.com/bottlerocke
bottlerocket-variant = { version = "0.1", path = "tools/bottlerocket-variant" }
buildsys = { version = "0.1", path = "tools/buildsys", lib = true, artifact = [ "bin:buildsys" ] }
buildsys-config = { version = "0.1", path = "tools/buildsys-config" }
krane-static = { version = "0.1", path = "tools/krane" }
krane-static = { version = "0.1", path = "tools/krane", artifact = [ "bin:krane-static" ], lib = true }
oci-cli-wrapper = { version = "0.1", path = "tools/oci-cli-wrapper" }
parse-datetime = { version = "0.1", path = "tools/parse-datetime" }
path-absolutize = "3.1"
Expand Down
5 changes: 2 additions & 3 deletions tests/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ edition = "2021"
license = "MIT OR Apache-2.0"

[dev-dependencies]
libc.workspace = true
krane-static.workspace = true
tempfile.workspace = true
tokio = { workspace = true, features = ["fs", "process", "rt-multi-thread"] }
toml.workspace = true
twoliter = { workspace = true }
twoliter.workspace = true
78 changes: 17 additions & 61 deletions tests/integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod twoliter_build;
mod twoliter_update;

pub const TWOLITER_PATH: &'static str = env!("CARGO_BIN_FILE_TWOLITER");
pub const KRANE_STATIC_PATH: &'static str = env!("CARGO_BIN_FILE_KRANE_STATIC");

pub fn test_projects_dir() -> PathBuf {
let mut p = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
Expand Down Expand Up @@ -45,80 +46,35 @@ where
}

struct KitRegistry {
temp_dir: TempDir,
container_id: String,
_temp_dir: TempDir,
child: std::process::Child,
}

impl KitRegistry {
fn new() -> Self {
let temp_dir = TempDir::new().expect("failed to create path for oci registry spinup");

let cert_dir = temp_dir.path().join("certs");
let cert_file = cert_dir.join("registry.crt");
std::fs::create_dir_all(&cert_dir).expect("failed to create nginx dir");
let output = run_command(
"openssl",
[
"req",
"-x509",
"-nodes",
"-days",
"365",
"-newkey",
"rsa:2048",
"-keyout",
cert_dir.join("registry.key").to_str().unwrap(),
"-out",
cert_file.to_str().unwrap(),
"-batch",
"-addext",
"subjectAltName=DNS:localhost",
],
[],
);
assert!(
output.status.success(),
"generate openssl self-signed certificates"
);

let output = run_command(
"docker",
[
"run",
"-d",
"--rm",
"--volume",
"./certs:/auth/certs",
"-e REGISTRY_HTTP_RELATIVEURLS=true",
"-e REGISTRY_HTTP_ADDR=0.0.0.0:5000",
"-e REGISTRY_HTTP_TLS_CERTIFICATE=/auth/certs/registry.crt",
"-e REGISTRY_HTTP_TLS_KEY=/auth/certs/registry.key",
"-p",
"5000:5000",
"public.ecr.aws/docker/library/registry:2.8.3",
],
[],
);
assert!(output.status.success(), "failed to start oci registry");
let container_id = String::from_utf8(output.stdout).unwrap().trim().to_string();
let child = Command::new(KRANE_STATIC_PATH)
.args(&[
"registry",
"serve",
"--address",
"127.0.0.1:5000",
"--disk",
temp_dir.path().to_str().unwrap(),
])
.spawn()
.expect("Failed to spawn registry process");

Self {
temp_dir,
container_id,
_temp_dir: temp_dir,
child,
}
}

fn cert_file(&self) -> PathBuf {
self.temp_dir
.path()
.join("certs/registry.crt")
.to_path_buf()
}
}

impl Drop for KitRegistry {
fn drop(&mut self) {
let output = run_command("docker", ["kill", &self.container_id], []);
assert!(output.status.success(), "failed to stop oci registry");
self.child.kill().ok();
}
}
9 changes: 3 additions & 6 deletions tests/integration-tests/src/twoliter_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ fn test_twoliter_build_and_update() {
"--project-path",
external_kit.join("Twoliter.toml").to_str().unwrap(),
],
[
("TWOLITER_KIT_IMAGE_TOOL", "crane"),
("SSL_CERT_FILE", registry.cert_file().to_str().unwrap()),
],
[],
);

assert!(output.status.success());
Expand Down Expand Up @@ -73,7 +70,7 @@ fn test_twoliter_build_and_update() {
struct LocalKit;

impl LocalKit {
fn build(registry: &KitRegistry) {
fn build(_registry: &KitRegistry) {
let local_kit = test_projects_dir().join("local-kit");

run_command(
Expand Down Expand Up @@ -120,7 +117,7 @@ impl LocalKit {
"bottlerocket",
"core-kit-overridden",
],
[("SSL_CERT_FILE", registry.cert_file().to_str().unwrap())],
[],
);
}
}
Expand Down
71 changes: 34 additions & 37 deletions tools/krane/go-src/go.mod
Original file line number Diff line number Diff line change
@@ -1,64 +1,61 @@
module github.com/bottlerocket-os/twoliter/tools/krane/go-src

go 1.22
go 1.22.0

toolchain go1.22.10

require (
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20240910181921-bef5bd9384b7
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20241227172826-c97b94eac159
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589
github.com/google/go-containerregistry v0.20.2
)

require (
cloud.google.com/go/compute v1.19.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Azure/azure-sdk-for-go v46.4.0+incompatible // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.28 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.5 // indirect
github.com/Azure/go-autorest/autorest v0.11.29 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.24 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.13 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.30.5 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.33 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.32 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.13 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.17 // indirect
github.com/aws/aws-sdk-go-v2 v1.32.7 // indirect
github.com/aws/aws-sdk-go-v2/config v1.28.7 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.48 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.22 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.32.4 // indirect
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.25.6 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.19 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.7 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.7 // indirect
github.com/aws/smithy-go v1.20.4 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
github.com/aws/aws-sdk-go-v2/service/ecr v1.38.0 // indirect
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.29.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.24.8 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.7 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.33.3 // indirect
github.com/aws/smithy-go v1.22.1 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.16.3 // indirect
github.com/dimchansky/utfbom v1.1.1 // indirect
github.com/docker/cli v27.1.1+incompatible // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/docker/cli v27.4.1+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker-credential-helpers v0.8.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc3 // indirect
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/cobra v1.8.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/vbatts/tar-split v0.11.3 // indirect
github.com/vbatts/tar-split v0.11.6 // indirect
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/oauth2 v0.24.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.33.0 // indirect
)
Loading

0 comments on commit f4c2498

Please sign in to comment.