From c35769869c199f3eee5fd97d514bb40c3f7bb82f Mon Sep 17 00:00:00 2001 From: Suleyman Akbas Date: Tue, 11 Jun 2019 13:28:22 +0200 Subject: [PATCH] Add kyma version env var (#118) --- .goreleaser.yml | 3 +- Gopkg.lock | 95 ++------------------------------- Gopkg.toml | 4 -- Makefile | 4 +- internal/installer/installer.go | 24 --------- pkg/kyma/cmd/install/cmd.go | 2 +- pkg/kyma/cmd/install/opts.go | 3 ++ 7 files changed, 12 insertions(+), 123 deletions(-) delete mode 100644 internal/installer/installer.go diff --git a/.goreleaser.yml b/.goreleaser.yml index aaf521383..e14298e25 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -12,7 +12,8 @@ before: builds: - env: - CGO_ENABLED=0 - ldflags: -X github.com/kyma-project/cli/pkg/kyma/cmd.Version={{.Version}} + - KYMA_VERSION=1.2.0-rc1 + ldflags: -X github.com/kyma-project/cli/pkg/kyma/cmd.Version={{.Version}} -X github.com/kyma-project/cli/pkg/kyma/cmd/install.DefaultKymaVersion={{.Env.KYMA_VERSION}} main: ./cmd/kyma/ archives: - replacements: diff --git a/Gopkg.lock b/Gopkg.lock index 672674fe8..1a180c4cd 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -161,14 +161,6 @@ revision = "342cbe0a04158f6dcb03ca0079991a51a4248c02" version = "v0.5" -[[projects]] - branch = "master" - digest = "1:1ba1d79f2810270045c328ae5d674321db34e3aae468eb4233883b473c5c0467" - name = "github.com/golang/glog" - packages = ["."] - pruneopts = "UT" - revision = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" - [[projects]] branch = "travis-1.9" digest = "1:e8f5d9c09a7209c740e769713376abda388c41b777ba8e9ed52767e21acf379f" @@ -181,27 +173,13 @@ revision = "883fe33ffc4344bad1ecd881f61afd5ec5d80e0a" [[projects]] - digest = "1:17fe264ee908afc795734e8c4e63db2accabaf57326dbf21763a7d6b86096260" + digest = "1:15042ad3498153684d09f393bbaec6b216c8eec6d61f63dff711de7d64ed8861" name = "github.com/golang/protobuf" - packages = [ - "proto", - "ptypes", - "ptypes/any", - "ptypes/duration", - "ptypes/timestamp", - ] + packages = ["proto"] pruneopts = "UT" revision = "b4deda0973fb4c70b50d226b1af49f3da59f5265" version = "v1.1.0" -[[projects]] - branch = "master" - digest = "1:0bfbe13936953a98ae3cfe8ed6670d396ad81edf069a806d2f6515d7bb6950df" - name = "github.com/google/btree" - packages = ["."] - pruneopts = "UT" - revision = "4030bb1f1f0c35b30ca7009e9ebd06849dd45306" - [[projects]] digest = "1:41bfd4219241b7f7d6e6fdb13fc712576f1337e68e6b895136283b76928fdd66" name = "github.com/google/gofuzz" @@ -209,27 +187,6 @@ pruneopts = "UT" revision = "44d81051d367757e1c7c6a5a86423ece9afcf63c" -[[projects]] - digest = "1:75eb87381d25cc75212f52358df9c3a2719584eaa9685cd510ce28699122f39d" - name = "github.com/googleapis/gnostic" - packages = [ - "OpenAPIv2", - "compiler", - "extensions", - ] - pruneopts = "UT" - revision = "0c5108395e2debce0d731cf0287ddf7242066aba" - -[[projects]] - digest = "1:878f0defa9b853f9acfaf4a162ba450a89d0050eff084f9fe7f5bd15948f172a" - name = "github.com/gregjones/httpcache" - packages = [ - ".", - "diskcache", - ] - pruneopts = "UT" - revision = "787624de3eb7bd915c329cba748687a3b22666a6" - [[projects]] branch = "master" digest = "1:33f920ba428942560c22c0e145127dc09a52c52d64eac284daea6b0926fab0d1" @@ -682,47 +639,6 @@ revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" version = "v2.2.2" -[[projects]] - digest = "1:0d299a04c6472e4458461d7034c76d014cc6f632a3262cbf21d123b19ce13e65" - name = "k8s.io/api" - packages = [ - "admissionregistration/v1alpha1", - "admissionregistration/v1beta1", - "apps/v1", - "apps/v1beta1", - "apps/v1beta2", - "auditregistration/v1alpha1", - "authentication/v1", - "authentication/v1beta1", - "authorization/v1", - "authorization/v1beta1", - "autoscaling/v1", - "autoscaling/v2beta1", - "autoscaling/v2beta2", - "batch/v1", - "batch/v1beta1", - "batch/v2alpha1", - "certificates/v1beta1", - "coordination/v1beta1", - "core/v1", - "events/v1beta1", - "extensions/v1beta1", - "networking/v1", - "policy/v1beta1", - "rbac/v1", - "rbac/v1alpha1", - "rbac/v1beta1", - "scheduling/v1alpha1", - "scheduling/v1beta1", - "settings/v1alpha1", - "storage/v1", - "storage/v1alpha1", - "storage/v1beta1", - ] - pruneopts = "UT" - revision = "89a74a8d264df0e993299876a8cde88379b940ee" - version = "kubernetes-1.13.0" - [[projects]] branch = "release-1.13" digest = "1:ca984b508e07171a344d8275ca7653763b6b13f01c4154079cd585528c1bdb04" @@ -767,11 +683,9 @@ [[projects]] branch = "release-10.0" - digest = "1:2e2e0f88db913f73c34eda478f5a3c71ca85acb588eda47f5be7fb8df59e0326" + digest = "1:7b769cf3443e4f5f6bd5e4a2a104f8ef47413d26eded069db48e4557b7ddae91" name = "k8s.io/client-go" packages = [ - "discovery", - "kubernetes/scheme", "pkg/apis/clientauthentication", "pkg/apis/clientauthentication/v1alpha1", "pkg/apis/clientauthentication/v1beta1", @@ -822,8 +736,6 @@ "github.com/fatih/color", "github.com/fsouza/go-dockerclient", "github.com/golang/lint/golint", - "github.com/kyma-project/kyma/components/installer/pkg/apis/installer/v1alpha1", - "github.com/kyma-project/kyma/components/installer/pkg/client/clientset/versioned", "github.com/mitchellh/mapstructure", "github.com/pkg/errors", "github.com/spf13/cobra", @@ -831,7 +743,6 @@ "gopkg.in/src-d/go-git.v4", "gopkg.in/src-d/go-git.v4/storage/memory", "gopkg.in/yaml.v2", - "k8s.io/apimachinery/pkg/apis/meta/v1", "k8s.io/client-go/plugin/pkg/client/auth/gcp", "k8s.io/client-go/rest", "k8s.io/client-go/tools/clientcmd", diff --git a/Gopkg.toml b/Gopkg.toml index ce90a96a0..003959113 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -14,10 +14,6 @@ required = [ name = "github.com/fsouza/go-dockerclient" version = "1.3.5" -[[constraint]] - name = "github.com/kyma-project/kyma" - version = "1.1.0" - [[constraint]] name = "github.com/pkg/errors" version = "0.8.1" diff --git a/Makefile b/Makefile index d5ff1e778..cb1cd67a9 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,12 @@ .DEFAULT_GOAL := local +KYMA_VERSION = 1.2.0-rc1 + ifndef VERSION VERSION = ${shell git describe --tags --always} endif -FLAGS = -ldflags '-X github.com/kyma-project/cli/pkg/kyma/cmd.Version=$(VERSION)' +FLAGS = -ldflags '-X github.com/kyma-project/cli/pkg/kyma/cmd.Version=$(VERSION) -X github.com/kyma-project/cli/pkg/kyma/cmd/install.DefaultKymaVersion=$(KYMA_VERSION)' .PHONY: resolve resolve: diff --git a/internal/installer/installer.go b/internal/installer/installer.go deleted file mode 100644 index c4bc6cce3..000000000 --- a/internal/installer/installer.go +++ /dev/null @@ -1,24 +0,0 @@ -package installer - -import ( - installer_api "github.com/kyma-project/kyma/components/installer/pkg/apis/installer/v1alpha1" - installer "github.com/kyma-project/kyma/components/installer/pkg/client/clientset/versioned" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/client-go/rest" -) - -func GetComponents(kubeConfig *rest.Config) ([]installer_api.KymaComponent, error) { - installerClient, err := installer.NewForConfig(kubeConfig) - if err != nil { - return nil, err - } - - installation, err := installerClient.InstallerV1alpha1().Installations("kyma-installer").Get("kyma-installation", metav1.GetOptions{}) - if err != nil { - installation, err = installerClient.InstallerV1alpha1().Installations("default").Get("kyma-installation", metav1.GetOptions{}) - if err != nil { - return nil, err - } - } - return installation.Spec.Components, nil -} diff --git a/pkg/kyma/cmd/install/cmd.go b/pkg/kyma/cmd/install/cmd.go index a501a2043..840d21123 100644 --- a/pkg/kyma/cmd/install/cmd.go +++ b/pkg/kyma/cmd/install/cmd.go @@ -83,7 +83,7 @@ The command: Aliases: []string{"i"}, } - cobraCmd.Flags().StringVarP(&o.ReleaseVersion, "release", "r", "1.1.0", "Kyma release to use") + cobraCmd.Flags().StringVarP(&o.ReleaseVersion, "release", "r", DefaultKymaVersion, "Kyma release to use") cobraCmd.Flags().StringVarP(&o.ReleaseConfig, "config", "c", "", "URL or path to the Installer configuration YAML file") cobraCmd.Flags().BoolVarP(&o.NoWait, "noWait", "n", false, "Do not wait for the Installer configuration to complete") cobraCmd.Flags().StringVarP(&o.Domain, "domain", "d", "kyma.local", "Domain used for installation") diff --git a/pkg/kyma/cmd/install/opts.go b/pkg/kyma/cmd/install/opts.go index 26d0a1a1d..c097852b1 100644 --- a/pkg/kyma/cmd/install/opts.go +++ b/pkg/kyma/cmd/install/opts.go @@ -7,6 +7,9 @@ import ( "github.com/kyma-project/cli/pkg/kyma/core" ) +//DefaultKymaVersion contains the default Kyma version to be installed in case another version is not specified +var DefaultKymaVersion string + type overrideFileList []string func (ovf *overrideFileList) String() string {