From fe21f9d4971dbb140c9a346f37aeb34da8a2ced2 Mon Sep 17 00:00:00 2001 From: Adnan Abdulhussein Date: Wed, 6 Dec 2017 15:26:22 +0000 Subject: [PATCH 1/2] fixes error message check for release not existing This is a quick fix for now, a better fix would be to use the ReleaseHistory GRPC method to check if the release exists or not, similar to how `helm upgrade` does this (https://github.com/kubernetes/helm/blob/master/cmd/helm/upgrade.go#L154) Also locks Helm library dependency to v2.7.2. --- cmd/controller/controller.go | 2 +- .../helm/pkg/helm/environment/environment.go | 4 - vendor/k8s.io/helm/pkg/helm/option.go | 3 +- .../helm/pkg/proto/hapi/chart/metadata.pb.go | 64 ++++------ vendor/k8s.io/helm/pkg/tlsutil/tls.go | 2 +- vendor/vendor.json | 116 ++++++++++++------ 6 files changed, 106 insertions(+), 85 deletions(-) diff --git a/cmd/controller/controller.go b/cmd/controller/controller.go index 087d793..ce7cbe2 100644 --- a/cmd/controller/controller.go +++ b/cmd/controller/controller.go @@ -162,7 +162,7 @@ func releaseName(ns, name string) string { func isNotFound(err error) bool { // Ideally this would be `grpc.Code(err) == codes.NotFound`, // but it seems helm doesn't return grpc codes - return strings.Contains(grpc.ErrorDesc(err), "not found") + return strings.Contains(grpc.ErrorDesc(err), "has no deployed releases") } func (c *Controller) updateRelease(key string) error { diff --git a/vendor/k8s.io/helm/pkg/helm/environment/environment.go b/vendor/k8s.io/helm/pkg/helm/environment/environment.go index b8bcf0d..49d424b 100644 --- a/vendor/k8s.io/helm/pkg/helm/environment/environment.go +++ b/vendor/k8s.io/helm/pkg/helm/environment/environment.go @@ -47,8 +47,6 @@ type EnvSettings struct { Debug bool // KubeContext is the name of the kubeconfig context. KubeContext string - // KubeConfig is the name of the kubeconfig file. - KubeConfig string } // AddFlags binds flags to the given flagset. @@ -56,7 +54,6 @@ func (s *EnvSettings) AddFlags(fs *pflag.FlagSet) { fs.StringVar((*string)(&s.Home), "home", DefaultHelmHome, "location of your Helm config. Overrides $HELM_HOME") fs.StringVar(&s.TillerHost, "host", "", "address of Tiller. Overrides $HELM_HOST") fs.StringVar(&s.KubeContext, "kube-context", "", "name of the kubeconfig context to use") - fs.StringVar(&s.KubeConfig, "kubeconfig", "", "path to kubeconfig file. Overrides $KUBECONFIG") fs.BoolVar(&s.Debug, "debug", false, "enable verbose output") fs.StringVar(&s.TillerNamespace, "tiller-namespace", "kube-system", "namespace of Tiller") } @@ -81,7 +78,6 @@ var envMap = map[string]string{ "debug": "HELM_DEBUG", "home": "HELM_HOME", "host": "HELM_HOST", - "kubeconfig": "KUBECONFIG", "tiller-namespace": "TILLER_NAMESPACE", } diff --git a/vendor/k8s.io/helm/pkg/helm/option.go b/vendor/k8s.io/helm/pkg/helm/option.go index 387247b..2b30cd3 100644 --- a/vendor/k8s.io/helm/pkg/helm/option.go +++ b/vendor/k8s.io/helm/pkg/helm/option.go @@ -348,8 +348,7 @@ func ResetValues(reset bool) UpdateOption { } } -// ReuseValues will cause Tiller to reuse the values from the last release. -// This is ignored if ResetValues is true. +// ReuseValues will (if true) trigger resetting the values to their original state. func ReuseValues(reuse bool) UpdateOption { return func(opts *options) { opts.reuseValues = reuse diff --git a/vendor/k8s.io/helm/pkg/proto/hapi/chart/metadata.pb.go b/vendor/k8s.io/helm/pkg/proto/hapi/chart/metadata.pb.go index c9034ff..af9f581 100644 --- a/vendor/k8s.io/helm/pkg/proto/hapi/chart/metadata.pb.go +++ b/vendor/k8s.io/helm/pkg/proto/hapi/chart/metadata.pb.go @@ -39,8 +39,6 @@ type Maintainer struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` // Email is an optional email address to contact the named maintainer Email string `protobuf:"bytes,2,opt,name=email" json:"email,omitempty"` - // Url is an optional URL to an address for the named maintainer - Url string `protobuf:"bytes,3,opt,name=url" json:"url,omitempty"` } func (m *Maintainer) Reset() { *m = Maintainer{} } @@ -62,13 +60,6 @@ func (m *Maintainer) GetEmail() string { return "" } -func (m *Maintainer) GetUrl() string { - if m != nil { - return m.Url - } - return "" -} - // Metadata for a Chart file. This models the structure of a Chart.yaml file. // // Spec: https://k8s.io/helm/blob/master/docs/design/chart_format.md#the-chart-file @@ -235,32 +226,31 @@ func init() { func init() { proto.RegisterFile("hapi/chart/metadata.proto", fileDescriptor2) } var fileDescriptor2 = []byte{ - // 420 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x5b, 0x6b, 0xd4, 0x40, - 0x14, 0x36, 0xcd, 0xde, 0x72, 0x62, 0x35, 0x1c, 0xa4, 0x8c, 0x45, 0x24, 0x2c, 0x0a, 0xfb, 0xb4, - 0x05, 0x7d, 0x29, 0x3e, 0x08, 0x0a, 0xa5, 0x82, 0x76, 0x2b, 0xc1, 0x0b, 0xf8, 0x36, 0x26, 0x87, - 0xee, 0xd0, 0x64, 0x26, 0x4c, 0x66, 0x2b, 0xfb, 0xa3, 0xfd, 0x0f, 0x32, 0x27, 0x49, 0x93, 0x95, - 0xbe, 0x7d, 0x97, 0x99, 0x6f, 0xe6, 0x1c, 0x3e, 0x78, 0xbe, 0x95, 0xb5, 0x3a, 0xcb, 0xb7, 0xd2, - 0xba, 0xb3, 0x8a, 0x9c, 0x2c, 0xa4, 0x93, 0xeb, 0xda, 0x1a, 0x67, 0x10, 0xbc, 0xb5, 0x66, 0x6b, - 0xf9, 0x09, 0xe0, 0x4a, 0x2a, 0xed, 0xa4, 0xd2, 0x64, 0x11, 0x61, 0xa2, 0x65, 0x45, 0x22, 0x48, - 0x83, 0x55, 0x94, 0x31, 0xc6, 0x67, 0x30, 0xa5, 0x4a, 0xaa, 0x52, 0x1c, 0xb1, 0xd8, 0x12, 0x4c, - 0x20, 0xdc, 0xd9, 0x52, 0x84, 0xac, 0x79, 0xb8, 0xfc, 0x3b, 0x81, 0xc5, 0x55, 0xf7, 0xd0, 0x83, - 0x41, 0x08, 0x93, 0xad, 0xa9, 0xa8, 0xcb, 0x61, 0x8c, 0x02, 0xe6, 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xce, - 0x5d, 0x68, 0x67, 0xf7, 0xd9, 0xf8, 0xe6, 0xe9, 0x7b, 0x48, 0xfe, 0x3f, 0xe0, 0x3b, 0x73, 0x4b, - 0xfb, 0xae, 0x13, 0x1e, 0xfa, 0x6e, 0xdd, 0xc9, 0x72, 0xd7, 0x77, 0xa2, 0x25, 0xef, 0x8e, 0xce, - 0x83, 0x65, 0x0a, 0xb3, 0x8b, 0x76, 0xbd, 0x31, 0xcc, 0xbf, 0x6f, 0x3e, 0x6f, 0xae, 0x7f, 0x6e, - 0x92, 0x47, 0x18, 0xc1, 0xf4, 0xf2, 0xfa, 0xdb, 0xd7, 0x2f, 0x49, 0xf0, 0x71, 0xfe, 0x6b, 0xca, - 0x3f, 0xfa, 0x3d, 0xe3, 0x56, 0xbf, 0xfd, 0x17, 0x00, 0x00, 0xff, 0xff, 0x40, 0x4c, 0x34, 0x92, - 0xf2, 0x02, 0x00, 0x00, + // 412 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0x5d, 0x6b, 0xd5, 0x40, + 0x10, 0x35, 0xbd, 0x9f, 0x99, 0x58, 0x0d, 0x83, 0x94, 0xb5, 0x88, 0x84, 0x8b, 0x42, 0x9e, 0x52, + 0x50, 0x90, 0xe2, 0x83, 0xa0, 0x50, 0xfa, 0xa0, 0xbd, 0x95, 0xe0, 0x07, 0xf8, 0xb6, 0x26, 0x43, + 0xef, 0xd2, 0x64, 0x37, 0xec, 0x6e, 0x2b, 0xf7, 0x47, 0xfb, 0x1f, 0x64, 0x37, 0xd9, 0x26, 0x95, + 0xbe, 0xcd, 0x39, 0x67, 0xe6, 0xec, 0x9e, 0x61, 0xe0, 0xf9, 0x8e, 0x77, 0xe2, 0xa4, 0xda, 0x71, + 0x6d, 0x4f, 0x5a, 0xb2, 0xbc, 0xe6, 0x96, 0x17, 0x9d, 0x56, 0x56, 0x21, 0x38, 0xa9, 0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0x9c, 0x5e, 0x53, 0xa7, 0xa9, 0xe2, 0x96, 0x6a, 0xf6, 0x24, 0x8b, + 0xf2, 0x75, 0x39, 0x61, 0xf0, 0x15, 0x1c, 0x5a, 0xd1, 0x34, 0xa4, 0x83, 0xc5, 0x53, 0x6f, 0x71, + 0x9f, 0xc4, 0x73, 0x48, 0xb8, 0x94, 0xca, 0x72, 0xf7, 0x0f, 0xc3, 0x52, 0xbf, 0x9d, 0xd7, 0xf7, + 0xb6, 0x13, 0x2e, 0xe7, 0xe3, 0xd8, 0x77, 0x26, 0xad, 0xde, 0x97, 0xd3, 0xc9, 0xe3, 0x0f, 0x90, + 0xfe, 0xdf, 0x80, 0x29, 0xcc, 0xae, 0x69, 0x3f, 0xdc, 0x84, 0x2b, 0xdd, 0x25, 0xdd, 0xf2, 0xe6, + 0x26, 0xdc, 0x44, 0x0f, 0xde, 0x1f, 0x9c, 0x46, 0x9b, 0x0c, 0x96, 0x67, 0xfd, 0x7a, 0x13, 0x58, + 0x7d, 0xdf, 0x7e, 0xde, 0x5e, 0xfe, 0xdc, 0xa6, 0x8f, 0x30, 0x86, 0xc5, 0xf9, 0xe5, 0xb7, 0xaf, + 0x5f, 0xd2, 0xe8, 0xd3, 0xea, 0xd7, 0xc2, 0xff, 0xe8, 0xf7, 0xd2, 0xdf, 0xf0, 0xdb, 0x7f, 0x01, + 0x00, 0x00, 0xff, 0xff, 0xd7, 0x2b, 0xf5, 0x83, 0xe0, 0x02, 0x00, 0x00, } diff --git a/vendor/k8s.io/helm/pkg/tlsutil/tls.go b/vendor/k8s.io/helm/pkg/tlsutil/tls.go index 422bdda..df698fd 100644 --- a/vendor/k8s.io/helm/pkg/tlsutil/tls.go +++ b/vendor/k8s.io/helm/pkg/tlsutil/tls.go @@ -65,7 +65,7 @@ func CertPoolFromFile(filename string) (*x509.CertPool, error) { func CertFromFilePair(certFile, keyFile string) (*tls.Certificate, error) { cert, err := tls.LoadX509KeyPair(certFile, keyFile) if err != nil { - return nil, fmt.Errorf("can't load key pair from cert %s and key %s", certFile, keyFile) + return nil, fmt.Errorf("can't load key pair from cert %s and key %s: %s", certFile, keyFile, err) } return &cert, err } diff --git a/vendor/vendor.json b/vendor/vendor.json index e437986..aa10f41 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1263,110 +1263,146 @@ { "checksumSHA1": "Hj1JqeAeCHMtJH+UvzYRov3VrUI=", "path": "k8s.io/helm/pkg/chartutil", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "AWVeraZB+QyL9XxbZrbM1WG36Dw=", "path": "k8s.io/helm/pkg/downloader", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "ppoTcnAkjqADMOTUR1VZGlafQZI=", "path": "k8s.io/helm/pkg/getter", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { - "checksumSHA1": "ahkgOA+sjOtQ/JrAp6y52pITqwQ=", + "checksumSHA1": "Qrl29vmvGVL9qHXZlkWwxZvXc3U=", "path": "k8s.io/helm/pkg/helm", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { - "checksumSHA1": "GlfL7N7BoISIjLwMd8LcEYwZssk=", + "checksumSHA1": "YXvdSwnWO+UwgQmYatERKDaJhYw=", "path": "k8s.io/helm/pkg/helm/environment", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "ykoNZxKs8kWb8bNaxkr5+qRszv8=", "path": "k8s.io/helm/pkg/helm/helmpath", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "DMwBqTHLy2b207GQkqd4yGLvUoU=", "path": "k8s.io/helm/pkg/ignore", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "hz98VjP4zPi93KS2JjtcpxFFv1U=", "path": "k8s.io/helm/pkg/plugin", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { - "checksumSHA1": "kOgR2wx12hPfzpIdA8yNyrunc4w=", + "checksumSHA1": "US0t9LvBi8IKrMCUtMylxACEA/8=", "path": "k8s.io/helm/pkg/proto/hapi/chart", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "xWLGiOgOu0R6oZ8qQAyD627XXn8=", "path": "k8s.io/helm/pkg/proto/hapi/release", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "uKZ76eG1R185ar4pwL04Ko2squU=", "path": "k8s.io/helm/pkg/proto/hapi/services", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "DRRbjNBG1IUbDmMnAd+D+Q7xs3A=", "path": "k8s.io/helm/pkg/proto/hapi/version", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "a9TdezPle3pbFiuFA6iynS63bbI=", "path": "k8s.io/helm/pkg/provenance", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "J+7xqIjTi5+133p4k2Xno+fuQDc=", "path": "k8s.io/helm/pkg/repo", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "+Gjxek69e2LPlCUoRXWzB75LpD8=", "path": "k8s.io/helm/pkg/resolver", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { - "checksumSHA1": "U8o0zE0hDZLb5jtPFve8D4/U9ik=", + "checksumSHA1": "T8AePsVCWkqqlD1hD3D9nWqnUDo=", "path": "k8s.io/helm/pkg/tlsutil", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "p02rTOPtQnRvtRDkIA31dfKRZuc=", "path": "k8s.io/helm/pkg/urlutil", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "x9IXFUVWRDpopLQ6eVj0YUCbR4o=", "path": "k8s.io/helm/pkg/version", - "revision": "f6bff5da94cb5b75ca629c2733f4c2db942f9bb4", - "revisionTime": "2017-11-09T04:12:35Z" + "revision": "8478fb4fc723885b155c924d1c8c410b7a9444e6", + "revisionTime": "2017-11-16T01:04:27Z", + "version": "v2.7.2", + "versionExact": "v2.7.2" }, { "checksumSHA1": "/zjulDhlMogVSOhPGM9UlDWyFuo=", From 4da569b2d98a6a4985640666eda764967a9be411 Mon Sep 17 00:00:00 2001 From: Adnan Abdulhussein Date: Wed, 6 Dec 2017 17:40:05 +0000 Subject: [PATCH 2/2] use ReleaseHistory Tiller GRPC call to check state Switches to using the ReleaseHistory GRPC call to see if the chart release exists or not. If it doesn't exist, install the chart, otherwise upgrade it. --- cmd/controller/controller.go | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/cmd/controller/controller.go b/cmd/controller/controller.go index ce7cbe2..a03b6d2 100644 --- a/cmd/controller/controller.go +++ b/cmd/controller/controller.go @@ -162,7 +162,7 @@ func releaseName(ns, name string) string { func isNotFound(err error) bool { // Ideally this would be `grpc.Code(err) == codes.NotFound`, // but it seems helm doesn't return grpc codes - return strings.Contains(grpc.ErrorDesc(err), "has no deployed releases") + return strings.Contains(grpc.ErrorDesc(err), "not found") } func (c *Controller) updateRelease(key string) error { @@ -230,19 +230,12 @@ func (c *Controller) updateRelease(key string) error { var rel *release.Release - log.Printf("Updating release %s", rlsName) - res, err := c.helmClient.UpdateReleaseFromChart( - rlsName, - chartRequested, - helm.UpdateValueOverrides([]byte(helmObj.Spec.Values)), - //helm.UpgradeForce(true), ? - ) + _, err = c.helmClient.ReleaseHistory(rlsName, helm.WithMaxHistory(1)) if err != nil { if !isNotFound(err) { return err } - - log.Printf("Existing release %s not found -> installing into namespace %s", rlsName, helmObj.Namespace) + log.Printf("Installing release %s into namespace %s", rlsName, helmObj.Namespace) res, err := c.helmClient.InstallReleaseFromChart( chartRequested, helmObj.Namespace, @@ -254,6 +247,16 @@ func (c *Controller) updateRelease(key string) error { } rel = res.GetRelease() } else { + log.Printf("Updating release %s", rlsName) + res, err := c.helmClient.UpdateReleaseFromChart( + rlsName, + chartRequested, + helm.UpdateValueOverrides([]byte(helmObj.Spec.Values)), + //helm.UpgradeForce(true), ? + ) + if err != nil { + return err + } rel = res.GetRelease() }