mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 06:16:08 -04:00
ci: add cli k8s compatibility table artifact upload to ci (#1218)
* add cli k8s compatibility api to ci * extend versionsapi package * rework cli info upload via ci * join errors natively * fix semver * upload from hack file * fix ci checks * add distributionid * setup go before running hack file * setup go after repo checkout * use logger instead of panic, invalidate cache * use provided ctx Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --------- Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
ed2e6fe233
commit
a274ac8a7c
10 changed files with 558 additions and 21 deletions
66
hack/cli-k8s-compatibility/main.go
Normal file
66
hack/cli-k8s-compatibility/main.go
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
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/logger"
|
||||
"github.com/edgelesssys/constellation/v2/internal/versions"
|
||||
"github.com/edgelesssys/constellation/v2/internal/versionsapi"
|
||||
"github.com/edgelesssys/constellation/v2/internal/versionsapi/client"
|
||||
"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, err := client.NewClient(ctx, "eu-central-1", "cdn-constellation-backend", "E1H77EZTHC3NE4", false, log)
|
||||
if err != nil {
|
||||
log.Fatalf("creating s3 client: %w", err)
|
||||
}
|
||||
defer func() {
|
||||
if err := c.InvalidateCache(ctx); err != nil {
|
||||
log.Fatalf("invalidating cache: %w", err)
|
||||
}
|
||||
}()
|
||||
|
||||
if err := c.UpdateCLIInfo(ctx, cliInfo); err != nil {
|
||||
log.Fatalf("updating cli info: %w", err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue