diff --git a/package.json b/package.json index ec43a6cd..c3b9c5c6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "venona", - "version": "1.0.0", + "version": "1.0.1", "description": "Codefresh agent to run on Codefresh's runtime environment and execute pipeline", "main": "index.js", "scripts": { diff --git a/venonactl/VERSION b/venonactl/VERSION index afaf360d..7dea76ed 100644 --- a/venonactl/VERSION +++ b/venonactl/VERSION @@ -1 +1 @@ -1.0.0 \ No newline at end of file +1.0.1 diff --git a/venonactl/go.sum b/venonactl/go.sum index 18b9ca8b..fac40908 100644 --- a/venonactl/go.sum +++ b/venonactl/go.sum @@ -27,6 +27,7 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/codefresh-io/go-sdk v0.17.0 h1:0fwE4K0QeqM2VfyjiALzkH2se4HbLh9BiQCuzQnJH/U= github.com/codefresh-io/go-sdk v0.17.0/go.mod h1:b6hK9euSW+MDXUDHU1+YgP8vzcij749I31ZIZSXed+I= github.com/codefresh-io/venona v0.30.2 h1:FgLNURnChYvamwBVdfQDthIRdfaOb0Zyvc2EdnajaPQ= +github.com/codefresh-io/venona v1.0.0 h1:w8fxc2+kKiTPYpHH5AFAyyDtefcnNKtlW8sHAP9Gvvo= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= diff --git a/venonactl/pkg/plugins/runtime-attach.go b/venonactl/pkg/plugins/runtime-attach.go index 3a514c22..6cee25e7 100644 --- a/venonactl/pkg/plugins/runtime-attach.go +++ b/venonactl/pkg/plugins/runtime-attach.go @@ -117,6 +117,7 @@ func (u *runtimeAttachPlugin) Install(opt *InstallOptions, v Values) (Values, er } // normalize the key in the secret to make sure we are not violating kube naming conventions name := strings.ReplaceAll(opt.RuntimeEnvironment, "/", ".") + name = strings.ReplaceAll(name, "@", ".") currentVenonaConf.Runtimes[fmt.Sprintf("%s.runtime.yaml", name)] = rc runtimes := map[string]string{} for name, runtime := range currentVenonaConf.Runtimes { @@ -201,17 +202,16 @@ func (u *runtimeAttachPlugin) Delete(deleteOpt *DeleteOptions, v Values) error { u.logger.Error(fmt.Sprintf("Cannot read venonaconf: %v ", err)) return err } - name := strings.ReplaceAll(deleteOpt.RuntimeEnvironment , "/", ".") + name := strings.ReplaceAll(deleteOpt.RuntimeEnvironment, "/", ".") name = fmt.Sprintf("%s.runtime.yaml", name) if _, ok := currentVenonaConf.Runtimes[name]; ok { - delete(currentVenonaConf.Runtimes, name) + delete(currentVenonaConf.Runtimes, name) } - - // If only one runtime is defined, remove the secret , otherwise remove the entry and persist + // If only one runtime is defined, remove the secret , otherwise remove the entry and persist shouldDelete := true if len(currentVenonaConf.Runtimes) > 0 { - + runtimes := map[string]string{} for name, runtime := range currentVenonaConf.Runtimes { // marshel prior persist @@ -220,15 +220,14 @@ func (u *runtimeAttachPlugin) Delete(deleteOpt *DeleteOptions, v Values) error { u.logger.Error(fmt.Sprintf("Cannot marshal merged venonaconf: %v ", err)) return err } - + runtimes[name] = base64.StdEncoding.EncodeToString([]byte(d)) } - shouldDelete = false v["venonaConf"] = runtimes - cs.CoreV1().Secrets(deleteOpt.AgentNamespace).Delete(runtimeSecretName, &metav1.DeleteOptions{}) + cs.CoreV1().Secrets(deleteOpt.AgentNamespace).Delete(runtimeSecretName, &metav1.DeleteOptions{}) err = install(&installOptions{ logger: u.logger, @@ -243,9 +242,7 @@ func (u *runtimeAttachPlugin) Delete(deleteOpt *DeleteOptions, v Values) error { } - - - if shouldDelete { + if shouldDelete { opt := &deleteOptions{ templates: templates.TemplatesMap(), templateValues: v, @@ -258,7 +255,7 @@ func (u *runtimeAttachPlugin) Delete(deleteOpt *DeleteOptions, v Values) error { return uninstall(opt) } return nil - + } func (u *runtimeAttachPlugin) Upgrade(_ *UpgradeOptions, v Values) (Values, error) {