Commit 2dd76126 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Optimize setup

parent 751719f5
v 0.1.3
- Optimize setup
- Optimize multi-runner setup - making it more concurrent
- Send description instead of hostname during registration
- Don't ask for tags
v 0.1.2
- Make it work on Windows
v 0.1.1
- Added Docker services
v 0.1.0
- Initial public release
......@@ -60,10 +60,8 @@ This project was made as Go learning opportunity. The initial release was create
Please enter the gitlab-ci token for this runner
Please enter the gitlab-ci hostname for this runner
Please enter the gitlab-ci description for this runner
Please enter the tag list separated by comma or leave it empty
linux, lab, worker, ruby
INFO[0034] fcf5c619 Registering runner... succeeded
Please enter the executor: shell, docker, docker-ssh, ssh?
......@@ -15,7 +15,7 @@ var (
Name: "url",
Value: "",
Usage: "Runner URL",
flToken = cli.StringFlag{
Name: "token",
......@@ -29,17 +29,23 @@ var (
Usage: "Runner's registration token",
flHostname = cli.StringFlag{
Name: "hostname",
flDescription = cli.StringFlag{
Name: "description",
Value: "",
Usage: "Runner's registration hostname",
Usage: "Runner's registration description",
flTags = cli.StringFlag{
Name: "tag-list",
Value: "",
Usage: "Runner's tag list separated by comma",
flExecutor = cli.StringFlag{
Name: "executor",
Value: "",
Usage: "Select executor, eg. shell, docker, etc.",
flDockerHost = cli.StringFlag{
Name: "docker-host",
......@@ -58,14 +58,14 @@ func Main() {
Name: "setup",
ShortName: "s",
Usage: "setup a new runner",
Flags: []cli.Flag{flRegistrationToken, flURL, flHostname, flConfigFile, flTags},
Flags: []cli.Flag{flRegistrationToken, flURL, flDescription, flConfigFile, flTags, flExecutor},
Action: setup,
Name: "run",
ShortName: "r",
Usage: "run multi runner",
Flags: []cli.Flag{flConfigFile},
Flags: []cli.Flag{flDockerHost, flConfigFile},
Action: runMulti,
......@@ -37,9 +37,9 @@ type GetBuildResponse struct {
type RegisterRunnerRequest struct {
Token string `json:"token,omitempty"`
Hostname string `json:"hostname,omitempty"`
Tags string `json:"tag_list,omitempty"`
Token string `json:"token,omitempty"`
Description string `json:"description,omitempty"`
Tags string `json:"tag_list,omitempty"`
type RegisterRunnerResponse struct {
......@@ -149,11 +149,11 @@ func GetBuild(config RunnerConfig) (*GetBuildResponse, bool) {
func RegisterRunner(url, token, hostname, tags string) *RegisterRunnerResponse {
func RegisterRunner(url, token, description, tags string) *RegisterRunnerResponse {
request := RegisterRunnerRequest{
Token: token,
Hostname: hostname,
Tags: tags,
Token: token,
Description: description,
Tags: tags,
var response RegisterRunnerResponse
......@@ -64,24 +64,25 @@ func setup(c *cli.Context) {
url := c.String("url")
registrationToken := c.String("registration-token")
hostName := c.String("hostname")
description := c.String("description")
tags := c.String("tag-list")
bio := bufio.NewReader(os.Stdin)
ask(bio, "Please enter the gitlab-ci coordinator URL (e.g. )", &url)
ask(bio, "Please enter the gitlab-ci token for this runner", &registrationToken)
ask(bio, "Please enter the gitlab-ci hostname for this runner", &hostName)
ask(bio, "Please enter the tag list separated by comma or leave it empty", &tags, true)
ask(bio, "Please enter the gitlab-ci description for this runner", &description)
// ask(bio, "Please enter the tag list separated by comma or leave it empty", &tags, true)
result := RegisterRunner(url, registrationToken, hostName, tags)
result := RegisterRunner(url, registrationToken, description, tags)
if result == nil {
log.Fatalf("Failed to register this runner. Perhaps your SSH key is invalid or you are having network problems")
runner_config := RunnerConfig{
URL: url,
Name: hostName,
Token: result.Token,
URL: url,
Name: description,
Token: result.Token,
Executor: c.String("executor"),
askExecutor(bio, &runner_config.Executor)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment