Skip to content

Commit

Permalink
CR-4771 (#30)
Browse files Browse the repository at this point in the history
* interpolated mutation

* removed replace local in go.mod

* bump

* go-sdk bump

* ci

* bump
  • Loading branch information
elad-codefresh authored Jul 28, 2021
1 parent 88246ce commit 4b666b9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=v0.0.35
VERSION=v0.0.36
OUT_DIR=dist
YEAR?=$(shell date +"%Y")

Expand Down
12 changes: 9 additions & 3 deletions cmd/commands/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import (
type (
RuntimeInstallOptions struct {
RuntimeName string
RuntimeToken string
Version *semver.Version
gsCloneOpts *git.CloneOptions
insCloneOpts *git.CloneOptions
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions docs/releases/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion manifests/runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4b666b9

Please sign in to comment.