Skip to content

Commit

Permalink
CR-5778-2 (#41)
Browse files Browse the repository at this point in the history
* final

* update

* update

* update

* update

* update

* update

* update
  • Loading branch information
elad-codefresh authored Aug 3, 2021
1 parent 417340c commit df9632e
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 12 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.45
VERSION=v0.0.46
OUT_DIR=dist
YEAR?=$(shell date +"%Y")

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The new Codefresh CLI tool.

```bash
# get the latest version or change to a specific version
VERSION=$(curl --silent "https://api.github.com/repos/codefresh-io/cli-v2/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
VERSION=$(curl --silent "https://api.github.com/repos/codefresh-io/cli-v2/releases/latest" | jq -r ".tag_name")

# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/$VERSION/cf-darwin-amd64.tar.gz | tar zx
Expand All @@ -30,7 +30,7 @@ cf version
### Linux
```bash
# get the latest version or change to a specific version
VERSION=$(curl --silent "https://api.github.com/repos/codefresh-io/cli-v2/releases/latest" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/')
VERSION=$(curl --silent "https://api.github.com/repos/codefresh-io/cli-v2/releases/latest" | jq -r ".tag_name")

# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/$VERSION/cf-linux-amd64.tar.gz | tar zx
Expand Down
7 changes: 6 additions & 1 deletion cmd/commands/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,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)
server, err := util.CurrentServer()
if err != nil {
return fmt.Errorf("failed to get current server address: %w", err)
}

runtimeCreationResponse, err := cfConfig.NewClient().ArgoRuntime().Create(opts.RuntimeName, server, rt.Spec.Version.String())
if err != nil {
return fmt.Errorf("failed to create a new runtime: %w", err)
}
Expand Down
8 changes: 4 additions & 4 deletions docs/releases/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
* Argo CD [v2.1.0-rc1](https://github.com/codefresh-io/argo-cd/releases/tag/v2.1.0-rc1)
* Argo CD ApplicationSet Controller [2c62537a8e5a](https://github.com/argoproj-labs/applicationset/commit/2c62537a8e5a3d5aecad87b843870789b74bdf89)
* Argo Events [v1.4.0](https://github.com/argoproj/argo-events/releases/tag/v1.4.0)
* Argo Rollouts [v1.0.2](https://github.com/argoproj/argo-rollouts/releases/tag/v1.0.2)
* Argo Workflows [v3.1.2](https://github.com/argoproj/argo-workflows/releases/tag/v3.1.2)
* Argo Rollouts [v1.0.4](https://github.com/argoproj/argo-rollouts/releases/tag/v1.0.4)
* Argo Workflows [v3.1.3](https://github.com/argoproj/argo-workflows/releases/tag/v3.1.3)

### Linux
```bash
# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.45/cf-linux-amd64.tar.gz | tar zx
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.46/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.45/cf-darwin-amd64.tar.gz | tar zx
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.0.46/cf-darwin-amd64.tar.gz | tar zx

# move the binary to your $PATH
mv ./cf-darwin-amd64 /usr/local/bin/cf
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/argoproj/argo-workflows/v3 v3.1.0
github.com/argoproj/gitops-engine v0.3.3 // indirect
github.com/briandowns/spinner v1.13.0
github.com/codefresh-io/go-sdk v0.30.1
github.com/codefresh-io/go-sdk v0.30.2
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 All @@ -25,6 +25,7 @@ require (
github.com/stretchr/testify v1.7.0
k8s.io/api v0.21.1
k8s.io/apimachinery v0.21.1
k8s.io/client-go v11.0.1-0.20190816222228-6d55c1b1f1ca+incompatible
sigs.k8s.io/kustomize/api v0.8.8
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGX
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/codefresh-io/go-sdk v0.30.1 h1:NmXSodeyqjbh+75e7jpfhum/9F44Fn+j44RgQazqSrs=
github.com/codefresh-io/go-sdk v0.30.1/go.mod h1:CcoVmTFWHGkbrSW8LyOGB/vJe5Vzr3iC/pNE2QIBTyg=
github.com/codefresh-io/go-sdk v0.30.2 h1:NbWph0RUsE9R6Iesm+pvB+5ODuFCGyofbSTrbfx3w4o=
github.com/codefresh-io/go-sdk v0.30.2/go.mod h1:CcoVmTFWHGkbrSW8LyOGB/vJe5Vzr3iC/pNE2QIBTyg=
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.45
version: 0.0.46
bootstrapSpecifier: github.com/codefresh-io/cli-v2/manifests/argo-cd
components:
- name: events
Expand Down
12 changes: 12 additions & 0 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/codefresh-io/cli-v2/pkg/store"

"github.com/briandowns/spinner"
"k8s.io/client-go/tools/clientcmd"
)

const (
Expand Down Expand Up @@ -155,3 +156,14 @@ func (ar *AsyncRunner) Wait() error {
func EscapeAppsetFieldName(field string) string {
return appsetFieldRegexp.ReplaceAllString(field, "_")
}

func CurrentServer() (string, error) {
configAccess := clientcmd.NewDefaultPathOptions()
conf, err := configAccess.GetStartingConfig()
if err != nil {
return "", err
}

server := conf.Clusters[conf.Contexts[conf.CurrentContext].Cluster].Server
return server, nil
}

0 comments on commit df9632e

Please sign in to comment.