Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CR-5279 - As a user I'll be able to upgrade runtime to a specific version #19

Merged
merged 13 commits into from
Jul 15, 2021
23 changes: 6 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
VERSION=v0.0.24
VERSION=v0.0.25
OUT_DIR=dist
YEAR?=$(shell date +"%Y")

CLI_NAME?=cf
IMAGE_REPOSITORY?=quay.io
IMAGE_NAMESPACE?=codefresh

ARGOCD_INSTALLATION_MANIFESTS_URL="github.com/codefresh-io/cli-v2/manifests/argo-cd?ref=$(VERSION)"
EVENTS_INSTALLATION_MANIFESTS_URL="github.com/codefresh-io/cli-v2/manifests/argo-events?ref=$(VERSION)"
ROLLOUTS_INSTALLATION_MANIFESTS_URL="github.com/codefresh-io/cli-v2/manifests/argo-rollouts?ref=$(VERSION)"
WORKFLOWS_INSTALLATION_MANIFESTS_URL="github.com/codefresh-io/cli-v2/manifests/argo-workflows?ref=$(VERSION)"
RUNTIME_DEF_URL="https://github.com/codefresh-io/cli-v2/manifests/runtime.yaml"

DEV_ARGOCD_INSTALLATION_MANIFESTS_URL="manifests/argo-cd"
DEV_EVENTS_INSTALLATION_MANIFESTS_URL="manifests/argo-events"
DEV_ROLLOUTS_INSTALLATION_MANIFESTS_URL="manifests/argo-rollouts"
DEV_WORKFLOWS_INSTALLATION_MANIFESTS_URL="manifests/argo-workflows"
DEV_RUNTIME_DEF_URL="manifests/runtime.yaml"

CLI_SRCS := $(shell find . -name '*.go')

Expand All @@ -26,10 +20,7 @@ BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
DEV_MODE?=true

ifeq (${DEV_MODE},true)
ARGOCD_INSTALLATION_MANIFESTS_URL=${DEV_ARGOCD_INSTALLATION_MANIFESTS_URL}
EVENTS_INSTALLATION_MANIFESTS_URL=${DEV_EVENTS_INSTALLATION_MANIFESTS_URL}
ROLLOUTS_INSTALLATION_MANIFESTS_URL=${DEV_ROLLOUTS_INSTALLATION_MANIFESTS_URL}
WORKFLOWS_INSTALLATION_MANIFESTS_URL=${DEV_WORKFLOWS_INSTALLATION_MANIFESTS_URL}
RUNTIME_DEF_URL=${DEV_RUNTIME_DEF_URL}
endif

ifndef GOBIN
Expand Down Expand Up @@ -94,10 +85,7 @@ $(OUT_DIR)/$(CLI_NAME)-%: $(CLI_SRCS)
VERSION=$(VERSION) \
GIT_COMMIT=$(GIT_COMMIT) \
OUT_FILE=$(OUT_DIR)/$(CLI_NAME)-$* \
ARGOCD_INSTALLATION_MANIFESTS_URL=$(ARGOCD_INSTALLATION_MANIFESTS_URL) \
EVENTS_INSTALLATION_MANIFESTS_URL=$(EVENTS_INSTALLATION_MANIFESTS_URL) \
ROLLOUTS_INSTALLATION_MANIFESTS_URL=$(ROLLOUTS_INSTALLATION_MANIFESTS_URL) \
WORKFLOWS_INSTALLATION_MANIFESTS_URL=$(WORKFLOWS_INSTALLATION_MANIFESTS_URL) \
RUNTIME_DEF_URL=$(RUNTIME_DEF_URL) \
MAIN=./cmd \
./hack/build.sh

Expand All @@ -120,6 +108,7 @@ test:

.PHONY: codegen
codegen: $(GOBIN)/mockery
rm -f ./docs/commands/*
go generate ./...
go run ./hack/license.go --license ./hack/boilerplate.txt --year $(YEAR) .

Expand Down
8 changes: 5 additions & 3 deletions cmd/commands/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ func NewConfigCurrentContextCommand() *cobra.Command {
func RunConfigCurrentContext(ctx context.Context) error {
cur := cfConfig.GetCurrentContext()
if cur.Name == "" {
log.G().Fatal(util.Doc("no currently selected context, use '<BIN> config use-context' to select a context"))
log.G(ctx).Fatal(util.Doc("no currently selected context, use '<BIN> config use-context' to select a context"))
}
log.G().Info(cur.Name)

log.G(ctx).Info(cur.Name)
return nil
}

Expand Down Expand Up @@ -188,6 +189,7 @@ func RunConfigDeleteContext(ctx context.Context, context string) error {
if err := cfConfig.DeleteContext(context); err != nil {
return err
}
log.G().Infof("delete context: %s", context)

log.G(ctx).Infof("delete context: %s", context)
return nil
}
Loading