Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 37 additions & 44 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.19.1
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization/v3 v3.0.0-beta.2
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.2.1
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v5 v5.7.0
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dns/armdns v1.2.0
Expand All @@ -37,6 +38,19 @@ require (
github.com/IBM/vpc-go-sdk v0.71.1
github.com/apparentlymart/go-cidr v1.1.0
github.com/awalterschulze/gographviz v0.0.0-20190522210029-fa59802746ab
github.com/aws/aws-sdk-go-v2 v1.41.2
github.com/aws/aws-sdk-go-v2/config v1.32.10
github.com/aws/aws-sdk-go-v2/credentials v1.19.10
github.com/aws/aws-sdk-go-v2/service/ec2 v1.292.0
github.com/aws/aws-sdk-go-v2/service/efs v1.41.11
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.54.7
github.com/aws/aws-sdk-go-v2/service/iam v1.53.3
github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.31.7
github.com/aws/aws-sdk-go-v2/service/route53 v1.62.2
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.1
github.com/aws/aws-sdk-go-v2/service/servicequotas v1.34.2
github.com/aws/aws-sdk-go-v2/service/sts v1.41.7
github.com/aws/smithy-go v1.24.1
github.com/cavaliercoder/go-cpio v0.0.0-20180626203310-925f9528c45e
github.com/clarketm/json v1.14.1
github.com/containers/image/v5 v5.31.0
Expand Down Expand Up @@ -65,7 +79,9 @@ require (
github.com/hashicorp/go-version v1.7.0
github.com/jarcoal/httpmock v1.3.1
github.com/jongio/azidext/go/azidext v0.5.0
github.com/k-orc/openstack-resource-controller/v2 v2.3.0
github.com/kdomanski/iso9660 v0.2.1
github.com/klauspost/compress v1.18.4
github.com/metal3-io/baremetal-operator/apis v0.4.0
github.com/metal3-io/baremetal-operator/pkg/hardwareutils v0.4.0
github.com/microsoft/kiota-authentication-azure-go v1.3.0
Expand Down Expand Up @@ -139,52 +155,8 @@ require (
sigs.k8s.io/yaml v1.6.0
)

require (
github.com/aws/aws-sdk-go-v2 v1.41.2
github.com/aws/aws-sdk-go-v2/config v1.32.10
github.com/aws/aws-sdk-go-v2/credentials v1.19.10
github.com/aws/aws-sdk-go-v2/service/ec2 v1.292.0
github.com/aws/aws-sdk-go-v2/service/efs v1.41.11
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.54.7
github.com/aws/aws-sdk-go-v2/service/iam v1.53.3
github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.31.7
github.com/aws/aws-sdk-go-v2/service/route53 v1.62.2
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.1
github.com/aws/aws-sdk-go-v2/service/servicequotas v1.34.2
github.com/aws/aws-sdk-go-v2/service/sts v1.41.7
github.com/aws/smithy-go v1.24.1
)

require github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0

require github.com/k-orc/openstack-resource-controller/v2 v2.3.0

require (
cel.dev/expr v0.24.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.40.4 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/go-jose/go-jose/v4 v4.1.2 // indirect
github.com/golangci/plugin-module-register v0.1.2 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
github.com/std-uritemplate/std-uritemplate/go/v2 v2.0.5 // indirect
github.com/zeebo/errs v1.4.0 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.37.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/tools/godoc v0.1.0-deprecated // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
)

require (
cloud.google.com/go v0.121.6 // indirect
cloud.google.com/go/auth v0.17.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
Expand All @@ -201,6 +173,9 @@ require (
github.com/Azure/go-autorest/tracing v0.6.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.5.0 // indirect
github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.29.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.53.0 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.53.0 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/PaesslerAG/gval v1.0.0 // indirect
github.com/PaesslerAG/jsonpath v0.1.1 // indirect
Expand All @@ -212,18 +187,21 @@ require (
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.18 // indirect
github.com/aws/aws-sdk-go-v2/service/cloudfront v1.40.4 // indirect
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.32.0
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.9 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.18 // indirect
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chai2010/gettext-go v1.0.2 // indirect
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
github.com/containers/storage v1.54.0 // indirect
github.com/coreos/go-json v0.0.0-20230131223807-18775e0fb4fb // indirect
github.com/coreos/go-semver v0.3.1 // indirect
Expand All @@ -233,13 +211,16 @@ require (
github.com/docker/go-units v0.5.0 // indirect
github.com/elliotwutingfeng/asciiset v0.0.0-20230602022725-51bbb787efab // indirect
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
github.com/exponent-io/jsonpath v0.0.0-20210407135951-1de76d718b3f // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-jose/go-jose/v4 v4.1.2 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/go-openapi/analysis v0.23.0 // indirect
Expand All @@ -255,6 +236,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/golang/mock v1.7.0-rc.1 // indirect
github.com/golangci/plugin-module-register v0.1.2 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/gnostic-models v0.7.0 // indirect
github.com/google/s2a-go v0.1.9 // indirect
Expand Down Expand Up @@ -311,29 +293,39 @@ require (
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/xattr v0.4.9 // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_model v0.6.2 // indirect
github.com/prometheus/procfs v0.19.2 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
github.com/std-uritemplate/std-uritemplate/go/v2 v2.0.5 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xlab/treeprint v1.2.0 // indirect
github.com/zeebo/errs v1.4.0 // indirect
go.mongodb.org/mongo-driver v1.17.4 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.37.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.62.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
go.opentelemetry.io/otel v1.38.0 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
go.opentelemetry.io/otel/trace v1.38.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/mod v0.30.0
golang.org/x/net v0.48.0 // indirect
golang.org/x/time v0.14.0 // indirect
golang.org/x/tools v0.39.0 // indirect
golang.org/x/tools/godoc v0.1.0-deprecated // indirect
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
google.golang.org/genproto v0.0.0-20250707201910-8d1bb00bc6a7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20251029180050-ab9386a59fda // indirect
Expand All @@ -355,6 +347,7 @@ require (
sigs.k8s.io/kustomize/api v0.20.1 // indirect
sigs.k8s.io/kustomize/kyaml v0.20.1 // indirect
sigs.k8s.io/randfill v1.0.0 // indirect
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
)

// OpenShift Forks
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o
github.com/kkHAIKE/contextcheck v1.1.6 h1:7HIyRcnyzxL9Lz06NGhiKvenXq7Zw6Q0UQu/ttjfJCE=
github.com/kkHAIKE/contextcheck v1.1.6/go.mod h1:3dDbMRNBFaq8HFXWC1JyvDSPm43CmE6IuHam8Wr0rkg=
github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c=
github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8=
Expand Down
18 changes: 14 additions & 4 deletions pkg/rhcos/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"time"

"github.com/h2non/filetype/matchers"
"github.com/klauspost/compress/zstd"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/thedevsaddam/retry"
Expand Down Expand Up @@ -82,7 +83,7 @@ func GetCacheDir(dataType, applicationName string) (string, error) {
}

// cacheFile puts data in the cache.
func cacheFile(reader io.Reader, filePath string, sha256Checksum string) (err error) {
func cacheFile(reader io.Reader, filePath string, sha256Checksum string, sourceName string) (err error) {
logrus.Debugf("Unpacking file into %q...", filePath)

flockPath := fmt.Sprintf("%s.lock", filePath)
Expand Down Expand Up @@ -140,10 +141,11 @@ func cacheFile(reader io.Reader, filePath string, sha256Checksum string) (err er
// Detect whether we know how to decompress the file
// See http://golang.org/pkg/net/http/#DetectContentType for why we use 512
buf := make([]byte, 512)
_, err = reader.Read(buf)
n, err := io.ReadAtLeast(reader, buf, 1)
if err != nil {
return err
}
buf = buf[:n]

reader = io.MultiReader(bytes.NewReader(buf), reader)
switch {
Expand All @@ -162,6 +164,14 @@ func cacheFile(reader io.Reader, filePath string, sha256Checksum string) (err er
return err
}
reader = uncompressor
case strings.HasSuffix(sourceName, ".zst"):
logrus.Debug("decompressing the image archive as zstd")
uncompressor, err := zstd.NewReader(reader)
if err != nil {
return err
}
defer uncompressor.Close()
reader = uncompressor.IOReadCloser()
default:
// No need for an interposer otherwise
logrus.Debug("no known archive format detected for image, assuming no decompression necessary")
Expand Down Expand Up @@ -212,7 +222,7 @@ type urlWithIntegrity struct {

func (u *urlWithIntegrity) uncompressedName() string {
n := filepath.Base(u.location.Path)
return strings.TrimSuffix(strings.TrimSuffix(n, ".gz"), ".xz")
return strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(n, ".gz"), ".xz"), ".zst")
}

// download obtains a file from a given URL, puts it in the cache folder, defined by dataType parameter,
Expand Down Expand Up @@ -251,7 +261,7 @@ func (u *urlWithIntegrity) download(dataType, applicationName string) (string, e
}

filePath = filepath.Join(cacheDir, fileName)
return cacheFile(resp.Body, filePath, u.uncompressedSHA256)
return cacheFile(resp.Body, filePath, u.uncompressedSHA256, filepath.Base(u.location.Path))
})
if err != nil {
return "", err
Expand Down
Loading