Skip to content

Commit 91cecb7

Browse files
authored
release/v1.4.1 (#37)
* updates to go mods * go releaser version bump + quick fix for failing test * show cleanup logs in runner logs
1 parent aeba20d commit 91cecb7

File tree

6 files changed

+20
-16
lines changed

6 files changed

+20
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
anka-gle
44
dist/
55
vendor/
6+
.DS_Store

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: 1
1+
version: 2
22

33
before:
44
hooks:

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module github.com/veertuinc/anka-cloud-gitlab-executor
22

3-
go 1.20
3+
go 1.24
44

55
require (
66
github.com/spf13/cobra v1.7.0
77
github.com/spf13/pflag v1.0.5
8-
golang.org/x/crypto v0.21.0
8+
golang.org/x/crypto v0.31.0
99
)
1010

1111
require (
1212
github.com/inconshreveable/mousetrap v1.1.0 // indirect
13-
golang.org/x/sys v0.18.0 // indirect
13+
golang.org/x/sys v0.28.0 // indirect
1414
)

go.sum

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
66
github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
77
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
88
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
9-
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
10-
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
11-
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
12-
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
13-
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
9+
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
10+
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
11+
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
12+
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
13+
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
14+
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
1415
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
1516
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/ankacloud/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (c *APIClient) parse(body []byte) (response, error) {
3333
}
3434

3535
if r.Status != statusOK {
36-
return r, fmt.Errorf(r.Message)
36+
return r, fmt.Errorf("%s", r.Message)
3737
}
3838

3939
return r, nil

internal/command/cleanup.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package command
33
import (
44
"context"
55
"fmt"
6-
"os"
76

87
"github.com/spf13/cobra"
98
"github.com/veertuinc/anka-cloud-gitlab-executor/internal/ankacloud"
@@ -24,9 +23,9 @@ var cleanupCommand = &cobra.Command{
2423
}
2524

2625
func executeCleanup(ctx context.Context, env gitlab.Environment) error {
27-
log.SetOutput(os.Stdout)
26+
// log.SetOutput(os.Stdout) // prevents us from logging Println, etc
2827

29-
log.Debugln("running cleanup stage")
28+
log.Println("cleanup stage started for job: ", env.GitlabJobUrl)
3029

3130
if env.KeepAliveOnError && env.GitlabJobStatus == gitlab.JobStatusFailed {
3231
log.Colorln("keeping VM alive on error")
@@ -36,22 +35,25 @@ func executeCleanup(ctx context.Context, env gitlab.Environment) error {
3635
apiClientConfig := getAPIClientConfig(env)
3736
apiClient, err := ankacloud.NewAPIClient(apiClientConfig)
3837
if err != nil {
39-
return fmt.Errorf("failed to initialize API client with config +%v: %w", apiClientConfig, err)
38+
log.Errorf("cleanup: failed to initialize API client with config +%v: %v", apiClientConfig, err)
39+
return fmt.Errorf("cleanup: failed to initialize API client with config +%v: %v", apiClientConfig, err)
4040
}
4141

4242
controller := ankacloud.NewController(apiClient)
4343

4444
instance, err := controller.GetInstanceByExternalId(ctx, env.GitlabJobUrl)
4545
if err != nil {
46-
return fmt.Errorf("failed to get instance by external id %q: %w", env.GitlabJobUrl, err)
46+
log.Errorf("cleanup: failed to get instance by external id %q: %v", env.GitlabJobUrl, err)
47+
return fmt.Errorf("cleanup: failed to get instance by external id %q: %v", env.GitlabJobUrl, err)
4748
}
4849
log.Debugf("instance id: %s\n", instance.Id)
4950

5051
err = controller.TerminateInstance(ctx, ankacloud.TerminateInstanceRequest{
5152
Id: instance.Id,
5253
})
5354
if err != nil {
54-
return fmt.Errorf("failed to terminate instance %q: %w", instance.Id, err)
55+
log.Errorf("cleanup: failed to terminate instance %q: %v", instance.Id, err)
56+
return fmt.Errorf("cleanup: failed to terminate instance %q: %v", instance.Id, err)
5557
}
5658
log.Debugf("Issuing termination request for instance %s\n", instance.Id)
5759

0 commit comments

Comments
 (0)