diff --git a/Makefile b/Makefile index 86e45c17d..952aa6fb2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=v0.0.35 +VERSION=v0.0.36 OUT_DIR=dist YEAR?=$(shell date +"%Y") diff --git a/cmd/commands/runtime.go b/cmd/commands/runtime.go index 8f49c97c7..041839bd2 100644 --- a/cmd/commands/runtime.go +++ b/cmd/commands/runtime.go @@ -51,6 +51,7 @@ import ( type ( RuntimeInstallOptions struct { RuntimeName string + RuntimeToken string Version *semver.Version gsCloneOpts *git.CloneOptions insCloneOpts *git.CloneOptions @@ -177,6 +178,12 @@ func RunRuntimeInstall(ctx context.Context, opts *RuntimeInstallOptions) error { return fmt.Errorf("failed to download runtime definition: %w", err) } + runtimeCreationResponse, err := cfConfig.NewClient().ArgoRuntime().Create(opts.RuntimeName) + if err != nil { + return fmt.Errorf("failed to get a runtime creation response: %w", err) + } + opts.RuntimeToken = runtimeCreationResponse.NewAccessToken + log.G(ctx).WithField("version", rt.Spec.Version).Infof("installing runtime '%s'", opts.RuntimeName) err = apcmd.RunRepoBootstrap(ctx, &apcmd.RepoBootstrapOptions{ AppSpecifier: rt.Spec.FullSpecifier(), @@ -473,7 +480,7 @@ func persistRuntime(ctx context.Context, cloneOpts *git.CloneOptions, rt *runtim } func createComponentsReporter(ctx context.Context, cloneOpts *git.CloneOptions, opts *RuntimeInstallOptions) error { - tokenSecret, err := getTokenSecret(opts.RuntimeName) + tokenSecret, err := getTokenSecret(opts.RuntimeName, opts.RuntimeToken) if err != nil { return fmt.Errorf("failed to create codefresh token secret: %w", err) } @@ -552,8 +559,7 @@ var getProjectInfoFromFile = func(repofs fs.FS, name string) (*argocdv1alpha1.Ap return proj, appSet, nil } -func getTokenSecret(namespace string) ([]byte, error) { - token := cfConfig.GetCurrentContext().Token +func getTokenSecret(namespace string, token string) ([]byte, error) { return yaml.Marshal(&v1.Secret{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", diff --git a/docs/releases/release_notes.md b/docs/releases/release_notes.md index badbb8c5b..279e15593 100644 --- a/docs/releases/release_notes.md +++ b/docs/releases/release_notes.md @@ -8,7 +8,7 @@ ### Linux ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.35/cf-linux-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.36/cf-linux-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-linux-amd64 /usr/local/bin/cf @@ -20,7 +20,7 @@ cf version ### Mac ```bash # download and extract the binary -curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.35/cf-darwin-amd64.tar.gz | tar zx +curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.36/cf-darwin-amd64.tar.gz | tar zx # move the binary to your $PATH mv ./cf-darwin-amd64 /usr/local/bin/cf diff --git a/go.mod b/go.mod index 092febdec..5e36fed7e 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/argoproj/argo-events v1.3.1 github.com/argoproj/argo-workflows/v3 v3.1.0 github.com/briandowns/spinner v1.13.0 - github.com/codefresh-io/go-sdk v0.27.1 + github.com/codefresh-io/go-sdk v0.28.0 github.com/fatih/color v1.12.0 github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/go-git/go-billy/v5 v5.3.1 diff --git a/go.sum b/go.sum index 2b61efe9b..46d5250bd 100644 --- a/go.sum +++ b/go.sum @@ -265,8 +265,8 @@ github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:z github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/codefresh-io/argo-platform v1.35.0 h1:9rboz3DYnfdH9UdQhDQ6dkVLJWhnR5eHqH7mM+kyQcc= github.com/codefresh-io/argo-platform v1.35.0/go.mod h1:rNms+r6lqY5QPEkHROmh5jXKA8VrasuN6CfleuX2xFY= -github.com/codefresh-io/go-sdk v0.27.1 h1:lN4VJhHxQKrMDth8yphl2kGRmxA4WWmJZA0YvTqxUtg= -github.com/codefresh-io/go-sdk v0.27.1/go.mod h1:lm2qPmSJfqUBc+xUOB14/34paYLd1tIePMLMcdSxecs= +github.com/codefresh-io/go-sdk v0.28.0 h1:yKL1EECpXsc7FauutwEh+mQcUDLf48tRkT4GcSQ+RAA= +github.com/codefresh-io/go-sdk v0.28.0/go.mod h1:lm2qPmSJfqUBc+xUOB14/34paYLd1tIePMLMcdSxecs= github.com/colinmarc/hdfs v1.1.4-0.20180802165501-48eb8d6c34a9/go.mod h1:0DumPviB681UcSuJErAbDIOx6SIaJWj463TymfZG02I= github.com/colinmarc/hdfs v1.1.4-0.20180805212432-9746310a4d31/go.mod h1:vSBumefK4HA5uiRSwNP+3ofgrEoScpCS2MMWcWXEuQ4= github.com/container-storage-interface/spec v1.3.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4= diff --git a/manifests/runtime.yaml b/manifests/runtime.yaml index 3664d65b2..e81a4274f 100644 --- a/manifests/runtime.yaml +++ b/manifests/runtime.yaml @@ -5,7 +5,7 @@ metadata: namespace: "{{ namespace }}" spec: defVersion: 1.0.0 - version: 0.0.35 + version: 0.0.36 bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd components: - name: events