feat(runners): add token to runner config

This commit is contained in:
Denis Gukov 2024-09-28 23:43:45 +05:00
parent 8a1af9082c
commit 0a92e7c571
3 changed files with 8 additions and 9 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@ web/public/fonts/*.*
web/.nyc_output
api/public/**/*
/config.json
/config-runner.json
/.dredd/config.json
/database.boltdb
/database.boltdb.lock

View File

@ -1,8 +0,0 @@
{
"tmp_path": "/var/folders/x1/d7p_yr4j7g57_r2r8s0ll_1r0000gn/T/semaphore",
"runner": {
"registration_token": "test123",
"config_file": "/tmp/semaphore-runner.json",
"api_url": "http://localhost:3000/internal"
}
}

View File

@ -91,6 +91,7 @@ const (
//
// */
// Deprecated
type RunnerConfig struct {
RunnerID int `json:"runner_id" env:"SEMAPHORE_RUNNER_ID"`
Token string `json:"token" env:"SEMAPHORE_RUNNER_TOKEN"`
@ -99,7 +100,12 @@ type RunnerConfig struct {
type RunnerSettings struct {
ApiURL string `json:"api_url" env:"SEMAPHORE_RUNNER_API_URL"`
RegistrationToken string `json:"registration_token" env:"SEMAPHORE_RUNNER_REGISTRATION_TOKEN"`
ConfigFile string `json:"config_file" env:"SEMAPHORE_RUNNER_CONFIG_FILE"`
// Deprecated
ConfigFile string `json:"config_file" env:"SEMAPHORE_RUNNER_CONFIG_FILE"`
Token string `json:"token" env:"SEMAPHORE_RUNNER_TOKEN"`
TokenFile string `json:"token_file" env:"SEMAPHORE_RUNNER_TOKEN_FILE"`
// OneOff indicates than runner runs only one job and exit. It is very useful for dynamic runners.
// How it works?