Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion venonactl/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
1 change: 1 addition & 0 deletions venonactl/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
21 changes: 9 additions & 12 deletions venonactl/pkg/plugins/runtime-attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -243,9 +242,7 @@ func (u *runtimeAttachPlugin) Delete(deleteOpt *DeleteOptions, v Values) error {

}



if shouldDelete {
if shouldDelete {
opt := &deleteOptions{
templates: templates.TemplatesMap(),
templateValues: v,
Expand All @@ -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) {
Expand Down