Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-runner
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Seipel
gitlab-runner
Commits
9eec92c8
Commit
9eec92c8
authored
7 years ago
by
Paul B
Browse files
Options
Downloads
Patches
Plain Diff
fix: read error from upload artifacts execution. Fixes #2584.
parent
7514fd2e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/build.go
+16
-19
16 additions, 19 deletions
common/build.go
common/network.go
+12
-0
12 additions, 0 deletions
common/network.go
with
28 additions
and
19 deletions
common/build.go
+
16
−
19
View file @
9eec92c8
...
...
@@ -173,27 +173,17 @@ func (b *Build) executeStage(ctx context.Context, buildStage BuildStage, executo
}
func
(
b
*
Build
)
executeUploadArtifacts
(
ctx
context
.
Context
,
state
error
,
executor
Executor
)
(
err
error
)
{
jobState
:=
state
for
_
,
artifacts
:=
range
b
.
Artifacts
{
when
:=
artifacts
.
When
if
state
==
nil
{
// Previous stages were successful
if
when
==
""
||
when
==
ArtifactWhenOnSuccess
||
when
==
ArtifactWhenAlways
{
state
=
b
.
executeStage
(
ctx
,
BuildStageUploadArtifacts
,
executor
)
}
}
else
{
// Previous stage did fail
if
when
==
ArtifactWhenOnFailure
||
when
==
ArtifactWhenAlways
{
err
=
b
.
executeStage
(
ctx
,
BuildStageUploadArtifacts
,
executor
)
}
var
uploadError
error
for
_
,
artifact
:=
range
b
.
JobResponse
.
Artifacts
{
if
artifact
.
ShouldUpload
(
state
)
{
uploadError
=
b
.
executeStage
(
ctx
,
BuildStageUploadArtifacts
,
executor
)
}
if
uploadError
!=
nil
{
err
=
uploadError
}
}
// Use job's error if set
if
jobState
!=
nil
{
err
=
jobState
}
return
}
...
...
@@ -226,7 +216,14 @@ func (b *Build) executeScript(ctx context.Context, executor Executor) error {
if
err
==
nil
{
err
=
b
.
executeStage
(
ctx
,
BuildStageArchiveCache
,
executor
)
}
err
=
b
.
executeUploadArtifacts
(
ctx
,
err
,
executor
)
jobState
:=
err
err
=
b
.
executeUploadArtifacts
(
ctx
,
jobState
,
executor
)
// Use job's error if set
if
jobState
!=
nil
{
err
=
jobState
}
return
err
}
...
...
This diff is collapsed.
Click to expand it.
common/network.go
+
12
−
0
View file @
9eec92c8
...
...
@@ -168,6 +168,14 @@ const (
ArtifactWhenAlways
ArtifactWhen
=
"always"
)
func
(
when
ArtifactWhen
)
OnSuccess
()
bool
{
return
when
==
""
||
when
==
ArtifactWhenOnSuccess
||
when
==
ArtifactWhenAlways
}
func
(
when
ArtifactWhen
)
OnFailure
()
bool
{
return
when
==
ArtifactWhenOnFailure
||
when
==
ArtifactWhenAlways
}
type
Artifact
struct
{
Name
string
`json:"name"`
Untracked
bool
`json:"untracked"`
...
...
@@ -176,6 +184,10 @@ type Artifact struct {
ExpireIn
string
`json:"expire_in"`
}
func
(
a
Artifact
)
ShouldUpload
(
state
error
)
bool
{
return
(
state
==
nil
&&
a
.
When
.
OnSuccess
())
||
(
state
!=
nil
&&
a
.
When
.
OnFailure
())
}
type
Artifacts
[]
Artifact
type
Cache
struct
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment