Skip to content

Commit b5a95fa

Browse files
committed
https://veertu.atlassian.net/browse/CLOUD-1516: version wasn't being set + fix for SSH retries
1 parent 8c9129c commit b5a95fa

File tree

3 files changed

+18
-17
lines changed

3 files changed

+18
-17
lines changed

.goreleaser.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ before:
88
builds:
99
- main: cmd/anka-cloud-gitlab-executor/main.go
1010
ldflags: >
11-
-X github.com/veertuinc/anka-cloud-gitlab-executor/internal/version.Version={{.Version}}
12-
-X github.com/veertuinc/anka-cloud-gitlab-executor/internal/version.Commit={{.ShortCommit}}
11+
-X github.com/veertuinc/anka-cloud-gitlab-executor/internal/version.version={{.Version}}
12+
-X github.com/veertuinc/anka-cloud-gitlab-executor/internal/version.commit={{.ShortCommit}}
1313
env:
1414
- CGO_ENABLED=0
1515
goos:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ Accepted values for booleans are: "1", "t", "T", "true", "TRUE", "True", "0", "f
6060
| ANKA_CLOUD_VM_VRAM_MB | ❌ | Number | Set RAM in MiB for the VM. Only works on `stopped` templates. Minimum value of 1 |
6161
| ANKA_CLOUD_BUILDS_DIR | ❌ | String | Absolute path to a directory where builds are stored in the VM. If not supplied, "/tmp/builds" is used. |
6262
| ANKA_CLOUD_CACHE_DIR | ❌ | String | Absolute path to a directory where build caches are stored in the VM. If not supplied, "/tmp/cache" is used. |
63-
| ANKA_SSH_CONNECTION_ATTEMPTS | ❌ | Number | The attempts to make when sshing to the VM. Useful when VMs take a long time to start under stressful situations or slow disks (like EBS). Defaults to `4` -- Minimum value of 1 |
64-
| ANKA_SSH_CONNECTION_ATTEMPT_DELAY | ❌ | Number | The delay between ssh connection attempts in seconds. Defaults to `5` |
63+
| ANKA_CLOUD_SSH_CONNECTION_ATTEMPTS | ❌ | Number | The attempts to make when sshing to the VM. Useful when VMs take a long time to start under stressful situations or slow disks (like EBS). Defaults to `4` -- Minimum value of 1 |
64+
| ANKA_CLOUD_SSH_CONNECTION_ATTEMPT_DELAY | ❌ | Number | The delay between ssh connection attempts in seconds. Defaults to `5` |
6565
| ANKA_CLOUD_SSH_USER_NAME | ❌ | String | SSH user name to use inside VM. Defaults to "anka". This can also be set via a command line flags to prevent this value from being exposed to the job. See example below. |
6666
| ANKA_CLOUD_SSH_PASSWORD | ❌ | String | SSH password to use inside VM. Defaults to "admin". This can also be set via a command line flags to prevent this value from being exposed to the job. See example below. |
6767

internal/gitlab/vars.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,19 +114,6 @@ func InitEnv() (Environment, error) {
114114
e.SSHPassword = os.Getenv(varSshPassword)
115115
}
116116

117-
if sshAttempts, ok, err := GetIntEnvVar(varSshAttempts); ok {
118-
if err != nil {
119-
return e, fmt.Errorf("%w %q: %w", ErrInvalidVar, varSshAttempts, err)
120-
}
121-
e.SSHAttempts = sshAttempts
122-
}
123-
if sshConnectionAttemptDelay, ok, err := GetIntEnvVar(varSshConnectionAttemptDelay); ok {
124-
if err != nil {
125-
return e, fmt.Errorf("%w %q: %w", ErrInvalidVar, varSshConnectionAttemptDelay, err)
126-
}
127-
e.SSHConnectionAttemptDelay = sshConnectionAttemptDelay
128-
}
129-
130117
e.TemplateId = os.Getenv(varTemplateId)
131118
e.TemplateName = os.Getenv(varTemplateName)
132119
e.TemplateTag = os.Getenv(varTemplateTag)
@@ -194,6 +181,20 @@ func InitEnv() (Environment, error) {
194181
e.VmVcpu = vcpu
195182
}
196183

184+
if sshAttempts, ok, err := GetIntEnvVar(varSshAttempts); ok {
185+
if err != nil {
186+
return e, fmt.Errorf("%w %q: %w", ErrInvalidVar, varSshAttempts, err)
187+
}
188+
e.SSHAttempts = sshAttempts
189+
}
190+
191+
if sshConnectionAttemptDelay, ok, err := GetIntEnvVar(varSshConnectionAttemptDelay); ok {
192+
if err != nil {
193+
return e, fmt.Errorf("%w %q: %w", ErrInvalidVar, varSshConnectionAttemptDelay, err)
194+
}
195+
e.SSHConnectionAttemptDelay = sshConnectionAttemptDelay
196+
}
197+
197198
return e, nil
198199
}
199200

0 commit comments

Comments
 (0)