Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Web - Open
Gitlab Runner
Commits
b7405bc0
Unverified
Commit
b7405bc0
authored
Oct 15, 2020
by
Suzanne Selhorn
Committed by
Pedro Pombeiro
Oct 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed please and changed e.g. to example
parent
b897a7f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
16 deletions
+20
-16
commands/register.go
commands/register.go
+20
-16
No files found.
commands/register.go
View file @
b7405bc0
...
@@ -148,7 +148,7 @@ func (s *RegisterCommand) askExecutor() {
...
@@ -148,7 +148,7 @@ func (s *RegisterCommand) askExecutor() {
for
{
for
{
names
:=
common
.
GetExecutorNames
()
names
:=
common
.
GetExecutorNames
()
executors
:=
strings
.
Join
(
names
,
", "
)
executors
:=
strings
.
Join
(
names
,
", "
)
s
.
Executor
=
s
.
ask
(
"executor"
,
"
Please e
nter
the
executor: "
+
executors
+
":"
,
true
)
s
.
Executor
=
s
.
ask
(
"executor"
,
"
E
nter
an
executor: "
+
executors
+
":"
,
true
)
if
common
.
GetExecutorProvider
(
s
.
Executor
)
!=
nil
{
if
common
.
GetExecutorProvider
(
s
.
Executor
)
!=
nil
{
return
return
}
}
...
@@ -196,33 +196,33 @@ func (s *RegisterCommand) askBasicDocker(exampleHelperImage string) {
...
@@ -196,33 +196,33 @@ func (s *RegisterCommand) askBasicDocker(exampleHelperImage string) {
s
.
Docker
.
Image
=
s
.
ask
(
s
.
Docker
.
Image
=
s
.
ask
(
"docker-image"
,
"docker-image"
,
fmt
.
Sprintf
(
"
Please e
nter the default Docker image (
e.g.
%s):"
,
exampleHelperImage
),
fmt
.
Sprintf
(
"
E
nter the default Docker image (
for example,
%s):"
,
exampleHelperImage
),
)
)
}
}
func
(
s
*
RegisterCommand
)
askParallels
()
{
func
(
s
*
RegisterCommand
)
askParallels
()
{
s
.
Parallels
.
BaseName
=
s
.
ask
(
"parallels-base-name"
,
"
Please e
nter the Parallels VM (
e.g.
my-vm):"
)
s
.
Parallels
.
BaseName
=
s
.
ask
(
"parallels-base-name"
,
"
E
nter the Parallels VM (
for example,
my-vm):"
)
}
}
func
(
s
*
RegisterCommand
)
askVirtualBox
()
{
func
(
s
*
RegisterCommand
)
askVirtualBox
()
{
s
.
VirtualBox
.
BaseName
=
s
.
ask
(
"virtualbox-base-name"
,
"
Please e
nter the VirtualBox VM (
e.g.
my-vm):"
)
s
.
VirtualBox
.
BaseName
=
s
.
ask
(
"virtualbox-base-name"
,
"
E
nter the VirtualBox VM (
for example,
my-vm):"
)
}
}
func
(
s
*
RegisterCommand
)
askSSHServer
()
{
func
(
s
*
RegisterCommand
)
askSSHServer
()
{
s
.
SSH
.
Host
=
s
.
ask
(
"ssh-host"
,
"
Please e
nter the SSH server address (
e.g.
my.server.com):"
)
s
.
SSH
.
Host
=
s
.
ask
(
"ssh-host"
,
"
E
nter the SSH server address (
for example,
my.server.com):"
)
s
.
SSH
.
Port
=
s
.
ask
(
"ssh-port"
,
"
Please e
nter the SSH server port (
e.g.
22):"
,
true
)
s
.
SSH
.
Port
=
s
.
ask
(
"ssh-port"
,
"
E
nter the SSH server port (
for example,
22):"
,
true
)
}
}
func
(
s
*
RegisterCommand
)
askSSHLogin
()
{
func
(
s
*
RegisterCommand
)
askSSHLogin
()
{
s
.
SSH
.
User
=
s
.
ask
(
"ssh-user"
,
"
Please e
nter the SSH user (
e.g.
root):"
)
s
.
SSH
.
User
=
s
.
ask
(
"ssh-user"
,
"
E
nter the SSH user (
for example,
root):"
)
s
.
SSH
.
Password
=
s
.
ask
(
s
.
SSH
.
Password
=
s
.
ask
(
"ssh-password"
,
"ssh-password"
,
"
Please e
nter the SSH password (
e.g.
docker.io):"
,
"
E
nter the SSH password (
for example,
docker.io):"
,
true
,
true
,
)
)
s
.
SSH
.
IdentityFile
=
s
.
ask
(
s
.
SSH
.
IdentityFile
=
s
.
ask
(
"ssh-identity-file"
,
"ssh-identity-file"
,
"
Please e
nter path to SSH identity file (
e.g.
/home/user/.ssh/id_rsa):"
,
"
E
nter
the
path to
the
SSH identity file (
for example,
/home/user/.ssh/id_rsa):"
,
true
,
true
,
)
)
}
}
...
@@ -232,21 +232,25 @@ func (s *RegisterCommand) addRunner(runner *common.RunnerConfig) {
...
@@ -232,21 +232,25 @@ func (s *RegisterCommand) addRunner(runner *common.RunnerConfig) {
}
}
func
(
s
*
RegisterCommand
)
askRunner
()
{
func
(
s
*
RegisterCommand
)
askRunner
()
{
s
.
URL
=
s
.
ask
(
"url"
,
"Enter your GitLab instance URL (the gitlab-ci coordinator URL), like https://gitlab.com/:"
)
s
.
URL
=
s
.
ask
(
"url"
,
"Enter the GitLab instance URL [https://gitlab.com/]:"
,
true
)
if
s
.
URL
==
""
{
s
.
URL
=
"https://gitlab.com/"
}
if
s
.
Token
!=
""
{
if
s
.
Token
!=
""
{
logrus
.
Infoln
(
"Token specified trying to verify runner..."
)
logrus
.
Infoln
(
"Token specified trying to verify runner..."
)
logrus
.
Warningln
(
"If you want to register use the '-r' instead of '-t'."
)
logrus
.
Warningln
(
"If you want to register use the '-r' instead of '-t'."
)
if
!
s
.
network
.
VerifyRunner
(
s
.
RunnerCredentials
)
{
if
!
s
.
network
.
VerifyRunner
(
s
.
RunnerCredentials
)
{
logrus
.
Panicln
(
"Failed to verify th
is
runner.
Perhaps you ar
e having network problems"
)
logrus
.
Panicln
(
"Failed to verify th
e
runner.
You may b
e having network problems
.
"
)
}
}
return
return
}
}
// we store registration token as token, since we pass that to RunnerCredentials
// we store registration token as token, since we pass that to RunnerCredentials
s
.
Token
=
s
.
ask
(
"registration-token"
,
"
Please e
nter the
gitlab-ci token for this runner
:"
)
s
.
Token
=
s
.
ask
(
"registration-token"
,
"
E
nter the
registration token
:"
)
s
.
Name
=
s
.
ask
(
"name"
,
"
Please enter the gitlab-ci
description for th
is
runner:"
)
s
.
Name
=
s
.
ask
(
"name"
,
"
Enter a
description for th
r
runner:"
)
s
.
TagList
=
s
.
ask
(
"tag-list"
,
"
Please enter the gitlab-ci
tags for th
is
runner (comma
separated):"
,
true
)
s
.
TagList
=
s
.
ask
(
"tag-list"
,
"
Enter
tags for th
e
runner (comma
-
separated):"
,
true
)
if
s
.
TagList
==
""
{
if
s
.
TagList
==
""
{
s
.
RunUntagged
=
true
s
.
RunUntagged
=
true
...
@@ -264,7 +268,7 @@ func (s *RegisterCommand) askRunner() {
...
@@ -264,7 +268,7 @@ func (s *RegisterCommand) askRunner() {
result
:=
s
.
network
.
RegisterRunner
(
s
.
RunnerCredentials
,
parameters
)
result
:=
s
.
network
.
RegisterRunner
(
s
.
RunnerCredentials
,
parameters
)
if
result
==
nil
{
if
result
==
nil
{
logrus
.
Panicln
(
"Failed to register th
is
runner.
Perhaps you ar
e having network problems"
)
logrus
.
Panicln
(
"Failed to register th
e
runner.
You may b
e having network problems
.
"
)
}
}
s
.
Token
=
result
.
Token
s
.
Token
=
result
.
Token
...
@@ -367,7 +371,7 @@ func (s *RegisterCommand) Execute(context *cli.Context) {
...
@@ -367,7 +371,7 @@ func (s *RegisterCommand) Execute(context *cli.Context) {
validAccessLevels
:=
[]
AccessLevel
{
NotProtected
,
RefProtected
}
validAccessLevels
:=
[]
AccessLevel
{
NotProtected
,
RefProtected
}
if
!
accessLevelValid
(
validAccessLevels
,
AccessLevel
(
s
.
AccessLevel
))
{
if
!
accessLevelValid
(
validAccessLevels
,
AccessLevel
(
s
.
AccessLevel
))
{
logrus
.
Panicln
(
"Given access-level is not valid. "
+
logrus
.
Panicln
(
"Given access-level is not valid. "
+
"
Please r
efer to gitlab-runner register -h for the correct options."
)
"
R
efer to gitlab-runner register -h for the correct options."
)
}
}
s
.
askRunner
()
s
.
askRunner
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment