Skip to content

Commit

Permalink
wip: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgilman committed Nov 26, 2024
1 parent 7a46966 commit 5d313a2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
11 changes: 3 additions & 8 deletions cli/pkg/release/providers/timoni.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package providers
import (
"fmt"
"log/slog"
"strings"

"github.com/input-output-hk/catalyst-forge/cli/pkg/events"
"github.com/input-output-hk/catalyst-forge/cli/pkg/executor"
Expand Down Expand Up @@ -49,13 +48,9 @@ func (r *TimoniReleaser) Release() error {
container = fmt.Sprintf("%s-%s", r.project.Name, "deployment")
}

var tag string
if r.project.Tag != nil {
tag = strings.TrimPrefix(r.project.Tag.Version, "v")
} else if r.config.Tag != "" {
tag = r.config.Tag
} else {
return fmt.Errorf("no tag found")
tag := r.config.Tag
if tag == "" {
return fmt.Errorf("no tag specified")
}

for _, registry := range registries {
Expand Down
27 changes: 27 additions & 0 deletions cli/pkg/release/providers/timoni_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,33 @@ func TestTimoniReleaserRelease(t *testing.T) {
assert.Contains(t, calls, "mod push --version test --latest=false . oci://test.com/test-deployment")
},
},
{
name: "not firing",
project: newProject("test", []string{"test.com"}),
firing: false,
force: false,
failOn: "",
validate: func(t *testing.T, calls []string, err error) {
require.NoError(t, err)
assert.Len(t, calls, 0)
},
},
{
name: "forced",
project: newProject("test", []string{"test.com"}),
release: schema.Release{},
config: TimoniReleaserConfig{
Container: "test",
Tag: "test",
},
firing: false,
force: true,
failOn: "",
validate: func(t *testing.T, calls []string, err error) {
require.NoError(t, err)
assert.Contains(t, calls, "mod push --version test --latest=false . oci://test.com/test")
},
},
{
name: "push fails",
project: newProject("test", []string{"test.com"}),
Expand Down

0 comments on commit 5d313a2

Please sign in to comment.