Skip to content

Commit bf6e679

Browse files
feat: remove release version from runner name template (#32)
2 parents f3ab9e8 + e46ab5a commit bf6e679

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

examples/tarter-standalone-config.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ runners:
1010
restartOnFailure: false
1111
noGraphics: true # optional
1212
cacheVolumePath: "" # optional
13-
releaseVersion: 1.0.0
1413
runnerGroup: group0
1514
startupProbe: # optional
1615
githubRunnerGet: {}
@@ -37,7 +36,6 @@ runners:
3736
restartOnFailure: false # optional
3837
noGraphics: true # optional
3938
cacheVolumePath: "" # optional
40-
releaseVersion: 1.0.0
4139
runnerGroup: group0
4240
startupProbe: # optional
4341
githubRunnerGet: {}

pkg/clients/tart/client.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"os/exec"
2626
"path"
2727
"strings"
28-
"time"
2928

3029
"github.com/tomtom-international/macos-actions-runner-controller/pkg/core/types"
3130
"github.com/tomtom-international/macos-actions-runner-controller/pkg/logger"
@@ -176,7 +175,7 @@ func (c *Client) SetupRunnerConfiguration(
176175
if err != nil {
177176
return "", fmt.Errorf("failed to set runner hosts: %s", err.Error())
178177
}
179-
err = c.setRunnerHostname(runnerConfigFolder, config.RunnerHostname, runnerID, config.ReleaseVersion)
178+
err = c.setRunnerHostname(runnerConfigFolder, config.RunnerHostname, runnerID)
180179
if err != nil {
181180
return "", fmt.Errorf("failed to set runner hostname: %s", err.Error())
182181
}
@@ -202,7 +201,7 @@ func (c *Client) SetupRunnerConfiguration(
202201
if err != nil {
203202
return "", fmt.Errorf("failed to set runner github registration token: %s", err.Error())
204203
}
205-
ghaRunnerName, err = c.setGhaRunnerName(nodeName, runnerConfigFolder, runnerID, config.ReleaseVersion)
204+
ghaRunnerName, err = c.setGhaRunnerName(nodeName, runnerConfigFolder, runnerID)
206205
if err != nil {
207206
return "", fmt.Errorf("failed to set github action runner name: %s", err.Error())
208207
}
@@ -296,11 +295,9 @@ func (c *Client) setRunnerHosts(runnerConfigFolder string, runnerHosts []types.R
296295
return nil
297296
}
298297

299-
func (c *Client) setRunnerHostname(runnerConfigFolder string, hostname string, runnerID string, runnerVersion string) error {
298+
func (c *Client) setRunnerHostname(runnerConfigFolder string, hostname string, runnerID string) error {
300299
if hostname == "" {
301-
timestamp := time.Now().Unix()
302-
version := strings.ReplaceAll(runnerVersion, ".", "-")
303-
hostname = fmt.Sprintf("runner-%v-%v-v%v.local", runnerID, timestamp, version)
300+
hostname = fmt.Sprintf("runner-%v", runnerID)
304301
}
305302
return writeToFile(path.Join(runnerConfigFolder, runnerHostname), hostname)
306303
}
@@ -320,13 +317,12 @@ func (c *Client) setRegistrationToken(runnerConfigFolder string, token string) e
320317
return writeToFile(path.Join(runnerConfigFolder, runnerRegistrationTokenFile), token)
321318
}
322319

323-
func (c *Client) setGhaRunnerName(nodeName string, runnerConfigFolder string, runnerID string, runnerVersion string) (string, error) {
324-
timestamp := time.Now().Unix()
320+
func (c *Client) setGhaRunnerName(nodeName string, runnerConfigFolder string, runnerID string) (string, error) {
325321
if strings.IndexByte(nodeName, '.') != -1 {
326322
nodeName = nodeName[:strings.IndexByte(nodeName, '.')]
327323
}
328324

329-
ghaRunnerName := fmt.Sprintf("%v-%v-%v-v%v", nodeName, runnerID, timestamp, runnerVersion)
325+
ghaRunnerName := fmt.Sprintf("%v-%v", nodeName, runnerID)
330326

331327
err := writeToFile(path.Join(runnerConfigFolder, runnerNameFile), ghaRunnerName)
332328
if err != nil {

pkg/core/types/runner.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,11 @@ type RunnerCondition struct {
5757
}
5858

5959
type RunnerConfig struct {
60-
StartupProbe *t.Probe `json:"startupProbe,omitempty" yaml:"startupProbe,omitempty"`
61-
LivenessProbe *t.Probe `json:"livenessProbe,omitempty" yaml:"livenessProbe,omitempty"`
62-
ReleaseVersion string `json:"releaseVersion" yaml:"releaseVersion"`
63-
RunnerGroup string `json:"runnerGroup" yaml:"runnerGroup"`
64-
Name string `json:"name" yaml:"name"`
65-
BaseImage string `json:"baseImage" yaml:"baseImage"`
60+
StartupProbe *t.Probe `json:"startupProbe,omitempty" yaml:"startupProbe,omitempty"`
61+
LivenessProbe *t.Probe `json:"livenessProbe,omitempty" yaml:"livenessProbe,omitempty"`
62+
RunnerGroup string `json:"runnerGroup" yaml:"runnerGroup"`
63+
Name string `json:"name" yaml:"name"`
64+
BaseImage string `json:"baseImage" yaml:"baseImage"`
6665
// JitConfig is ACTIONS_RUNNER_INPUT_JITCONFIG environment variable passed by Actions Runner Controller.
6766
// Temporary solution before Runners Listener is implemented.
6867
JitConfig string `json:"jitConfig,omitempty" yaml:"jitConfig,omitempty"`

pkg/tarter/runner/worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (w *worker) startRunner() error {
149149
// It uses short Runner ID due to the limitation of the GHA runner name length.
150150
ghaRunnerName, err := w.runnerManager.tartClient.SetupRunnerConfiguration(
151151
w.runnerManager.nodeName,
152-
string(w.runner.ID.Short()),
152+
string(w.runner.ID),
153153
w.runner.TartVMName,
154154
w.runner.Config,
155155
registrationToken.GetToken())

0 commit comments

Comments
 (0)