Skip to content
GitLab
Next
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
gitlab-runner
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1,985
Issues
1,985
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
213
Merge Requests
213
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GitLab.org
gitlab-runner
Commits
2f745163
Commit
2f745163
authored
Aug 21, 2015
by
Kamil Trzciński
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the service startup more readable in case of failure: print a nice warning message
parent
602e576b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
6 deletions
+52
-6
CHANGELOG.md
CHANGELOG.md
+1
-0
executors/docker/executor_docker.go
executors/docker/executor_docker.go
+51
-6
No files found.
CHANGELOG.md
View file @
2f745163
v 0.6.0 (unreleased)
-
Fetch docker auth from ~/.docker/config.json or ~/.dockercfg
-
Added support for NTFSSecurity PowerShell module to address problems with long paths on Windows
-
Make the service startup more readable in case of failure: print a nice warning message
v 0.5.2
-
Fixed CentOS6 service script
...
...
executors/docker/executor_docker.go
View file @
2f745163
...
...
@@ -17,6 +17,7 @@ import (
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/common"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/executors"
"gitlab.com/gitlab-org/gitlab-ci-multi-runner/helpers"
"bytes"
)
type
DockerExecutor
struct
{
...
...
@@ -390,7 +391,13 @@ func (s *DockerExecutor) createServices() ([]string, error) {
var
links
[]
string
for
linkName
,
container
:=
range
linksMap
{
links
=
append
(
links
,
container
.
ID
+
":"
+
linkName
)
newContainer
,
err
:=
s
.
client
.
InspectContainer
(
container
.
ID
)
if
err
!=
nil
{
continue
}
if
newContainer
.
State
.
Running
{
links
=
append
(
links
,
container
.
ID
+
":"
+
linkName
)
}
}
return
links
,
nil
...
...
@@ -598,13 +605,14 @@ func (s *DockerExecutor) Cleanup() {
s
.
AbstractExecutor
.
Cleanup
()
}
func
(
s
*
DockerExecutor
)
waitForService
Container
(
container
*
docker
.
Container
,
timeout
time
.
Duration
)
error
{
func
(
s
*
DockerExecutor
)
runServiceHealthCheck
Container
(
container
*
docker
.
Container
,
timeout
time
.
Duration
)
error
{
waitImage
,
err
:=
s
.
getDockerImage
(
"gitlab/gitlab-runner:service"
)
if
err
!=
nil
{
return
err
}
waitContainerOpts
:=
docker
.
CreateContainerOptions
{
Name
:
container
.
Name
+
"-wait-for-service"
,
Config
:
&
docker
.
Config
{
Image
:
waitImage
.
ID
,
},
...
...
@@ -636,11 +644,48 @@ func (s *DockerExecutor) waitForServiceContainer(container *docker.Container, ti
// these are warnings and they don't make the build fail
select
{
case
err
:=
<-
waitResult
:
if
err
!=
nil
{
s
.
Println
(
"Service"
,
container
.
Name
,
"probably didn't start properly"
,
err
)
}
return
err
case
<-
time
.
After
(
timeout
)
:
s
.
Println
(
"Service"
,
container
.
Name
,
"didn't respond in timely maner:"
,
timeout
,
"Consider modifying wait_for_services_timeout."
)
return
fmt
.
Errorf
(
"didn't respond in timely maner: %v (consider modifying wait_for_services_timeout)."
,
container
.
Name
,
timeout
)
}
return
nil
}
func
(
s
*
DockerExecutor
)
waitForServiceContainer
(
container
*
docker
.
Container
,
timeout
time
.
Duration
)
error
{
err
:=
s
.
runServiceHealthCheckContainer
(
container
,
timeout
)
if
err
==
nil
{
return
nil
}
var
buffer
bytes
.
Buffer
buffer
.
WriteString
(
"
\n
"
)
buffer
.
WriteString
(
helpers
.
ANSI_BOLD_YELLOW
+
"*** WARNING:"
+
helpers
.
ANSI_RESET
+
" Service "
+
container
.
Name
+
" probably didn't start properly.
\n
"
)
buffer
.
WriteString
(
"
\n
"
)
buffer
.
WriteString
(
strings
.
TrimSpace
(
err
.
Error
())
+
"
\n
"
)
var
containerBuffer
bytes
.
Buffer
err
=
s
.
client
.
Logs
(
docker
.
LogsOptions
{
Container
:
container
.
ID
,
OutputStream
:
&
containerBuffer
,
ErrorStream
:
&
containerBuffer
,
Stdout
:
true
,
Stderr
:
true
,
Timestamps
:
true
,
})
if
err
==
nil
{
if
containerLog
:=
containerBuffer
.
String
();
containerLog
!=
""
{
buffer
.
WriteString
(
"
\n
"
)
buffer
.
WriteString
(
strings
.
TrimSpace
(
containerLog
))
buffer
.
WriteString
(
"
\n
"
)
}
}
else
{
buffer
.
WriteString
(
strings
.
TrimSpace
(
err
.
Error
())
+
"
\n
"
)
}
buffer
.
WriteString
(
"
\n
"
)
buffer
.
WriteString
(
helpers
.
ANSI_BOLD_YELLOW
+
"*********"
+
helpers
.
ANSI_RESET
+
"
\n
"
)
buffer
.
WriteString
(
"
\n
"
)
s
.
Build
.
WriteString
(
buffer
.
String
())
return
err
}
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