mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-28 08:59:34 -05:00
ef6f63dc48
* bootstrapper: remove obsolete log statement * ci: simplify variable usage Co-authored-by: Daniel Weiße <daniel-weisse@users.noreply.github.com> * cli: add missing formatting directive * helm: fix rm invocation * ci: document reproducible-builds workflow * constants: use variables for measurement files * constants: use variables for CDN distribution ID * ci: make Helm version explicit * api: prettify versionsapi-list output * ci: remove obsolete docstring --------- Co-authored-by: Daniel Weiße <daniel-weisse@users.noreply.github.com>
67 lines
1.7 KiB
Go
67 lines
1.7 KiB
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
// cli-k8s-compatibility generates JSON output for a CLI version and its supported Kubernetes versions.
|
|
package main
|
|
|
|
import (
|
|
"context"
|
|
"flag"
|
|
|
|
"github.com/edgelesssys/constellation/v2/internal/api/versionsapi"
|
|
"github.com/edgelesssys/constellation/v2/internal/constants"
|
|
"github.com/edgelesssys/constellation/v2/internal/logger"
|
|
"github.com/edgelesssys/constellation/v2/internal/versions"
|
|
"go.uber.org/zap/zapcore"
|
|
)
|
|
|
|
var (
|
|
refFlag = flag.String("ref", "", "the reference name of the image")
|
|
streamFlag = flag.String("stream", "", "the stream name of the image")
|
|
versionFlag = flag.String("version", "", "the version of the image")
|
|
)
|
|
|
|
func main() {
|
|
log := logger.New(logger.PlainLog, zapcore.DebugLevel)
|
|
ctx := context.Background()
|
|
|
|
flag.Parse()
|
|
if *refFlag == "" {
|
|
log.Fatalf("ref must be set")
|
|
}
|
|
if *streamFlag == "" {
|
|
log.Fatalf("stream must be set")
|
|
}
|
|
if *versionFlag == "" {
|
|
log.Fatalf("version must be set")
|
|
}
|
|
|
|
cliInfo := versionsapi.CLIInfo{
|
|
Ref: *refFlag,
|
|
Stream: *streamFlag,
|
|
Version: *versionFlag,
|
|
Kubernetes: []string{},
|
|
}
|
|
|
|
for _, v := range versions.VersionConfigs {
|
|
cliInfo.Kubernetes = append(cliInfo.Kubernetes, v.ClusterVersion)
|
|
}
|
|
|
|
c, cclose, err := versionsapi.NewClient(ctx, "eu-central-1", "cdn-constellation-backend", constants.CDNDefaultDistributionID, false, log)
|
|
if err != nil {
|
|
log.Fatalf("creating s3 client: %w", err)
|
|
}
|
|
defer func() {
|
|
if err := cclose(ctx); err != nil {
|
|
log.Fatalf("invalidating cache: %w", err)
|
|
}
|
|
}()
|
|
|
|
if err := c.UpdateCLIInfo(ctx, cliInfo); err != nil {
|
|
log.Fatalf("updating cli info: %w", err)
|
|
}
|
|
}
|