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
ee7a0010
Commit
ee7a0010
authored
9 years ago
by
Kamil Trzcinski
Browse files
Options
Downloads
Patches
Plain Diff
Fix caching support
- Fix broken tar unpack command - Suppress tar verbose output
parent
9736cc55
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.md
+4
-0
4 additions, 0 deletions
CHANGELOG.md
VERSION
+1
-1
1 addition, 1 deletion
VERSION
commands/archive.go
+8
-6
8 additions, 6 deletions
commands/archive.go
shells/bash.go
+6
-5
6 additions, 5 deletions
shells/bash.go
with
19 additions
and
12 deletions
CHANGELOG.md
+
4
−
0
View file @
ee7a0010
v 0.7.1
-
Fix caching support
-
Suppress tar verbose output
v 0.7.0
-
Refactor code structure
-
Refactor bash script adding pre-build and post-build steps
...
...
This diff is collapsed.
Click to expand it.
VERSION
+
1
−
1
View file @
ee7a0010
0.7.
0
0.7.
1
This diff is collapsed.
Click to expand it.
commands/archive.go
+
8
−
6
View file @
ee7a0010
...
...
@@ -109,6 +109,7 @@ func (c *ArchiveCommand) processUntracked() {
cmd
.
Env
=
os
.
Environ
()
cmd
.
Stdout
=
&
output
cmd
.
Stderr
=
os
.
Stderr
logrus
.
Debugln
(
"Executing command:"
,
strings
.
Join
(
cmd
.
Args
,
" "
))
err
:=
cmd
.
Run
()
if
err
==
nil
{
reader
:=
bufio
.
NewReader
(
&
output
)
...
...
@@ -133,7 +134,7 @@ func (c *ArchiveCommand) archive() {
return
}
logrus
.
Infoln
(
"Creating archive"
,
c
.
Output
,
"..."
)
logrus
.
Infoln
(
"Creating archive"
,
filepath
.
Base
(
c
.
Output
)
,
"..."
)
var
files
bytes
.
Buffer
for
_
,
file
:=
range
c
.
sortedFiles
()
{
files
.
WriteString
(
string
(
file
)
+
"
\n
"
)
...
...
@@ -149,7 +150,7 @@ func (c *ArchiveCommand) archive() {
tempFile
.
Close
()
defer
os
.
Remove
(
tempFile
.
Name
())
logrus
.
Debugln
(
"Temporary file"
,
tempFile
.
Name
())
logrus
.
Debugln
(
"Temporary file
:
"
,
tempFile
.
Name
())
flags
:=
"-zcPv"
if
c
.
Silent
{
...
...
@@ -161,14 +162,15 @@ func (c *ArchiveCommand) archive() {
cmd
.
Stdin
=
&
files
cmd
.
Stdout
=
os
.
Stdout
cmd
.
Stderr
=
os
.
Stderr
logrus
.
Debugln
(
"Executing command:"
,
strings
.
Join
(
cmd
.
Args
,
" "
))
err
=
cmd
.
Run
()
if
err
!=
nil
{
logrus
.
Fatalln
(
"Failed to create archive"
,
err
)
logrus
.
Fatalln
(
"Failed to create archive
:
"
,
err
)
}
err
=
os
.
Rename
(
tempFile
.
Name
(),
c
.
Output
)
if
err
!=
nil
{
logrus
.
Warningln
(
"Failed to rename archive"
,
err
)
logrus
.
Warningln
(
"Failed to rename archive
:
"
,
err
)
}
logrus
.
Infoln
(
"Done!"
)
...
...
@@ -184,7 +186,7 @@ func (c *ArchiveCommand) Execute(context *cli.Context) {
wd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
logrus
.
Fatalln
(
"Failed to get current working directory"
,
err
)
logrus
.
Fatalln
(
"Failed to get current working directory
:
"
,
err
)
}
if
c
.
Output
==
""
{
logrus
.
Fatalln
(
"Missing archive file name!"
)
...
...
@@ -198,7 +200,7 @@ func (c *ArchiveCommand) Execute(context *cli.Context) {
ai
,
err
:=
os
.
Stat
(
c
.
Output
)
if
err
!=
nil
&&
!
os
.
IsNotExist
(
err
)
{
logrus
.
Fatalln
(
"Failed to verify archive"
,
c
.
Output
,
err
)
logrus
.
Fatalln
(
"Failed to verify archive
:
"
,
c
.
Output
,
err
)
}
if
ai
!=
nil
{
if
!
c
.
isChanged
(
ai
.
ModTime
())
{
...
...
This diff is collapsed.
Click to expand it.
shells/bash.go
+
6
−
5
View file @
ee7a0010
...
...
@@ -153,14 +153,14 @@ func (b *BashShell) generatePreBuildScript(info common.ShellScriptInfo) string {
// If we have cache, restore it
b
.
writeIfFile
(
w
,
cacheFile
)
b
.
echoColored
(
w
,
"Restoring cache..."
)
b
.
executeCommand
(
w
,
"tar"
,
"-zxf
v"
,
"-f
"
,
cacheFile
)
b
.
executeCommand
(
w
,
"tar"
,
"-zxf"
,
cacheFile
)
if
cacheFile2
!=
""
{
b
.
writeElse
(
w
)
// If we have cache, restore it
b
.
writeIfFile
(
w
,
cacheFile2
)
b
.
echoColored
(
w
,
"Restoring cache..."
)
b
.
executeCommand
(
w
,
"tar"
,
"-zxf
v"
,
"-f
"
,
cacheFile2
)
b
.
executeCommand
(
w
,
"tar"
,
"-zxf"
,
cacheFile2
)
b
.
writeEndIf
(
w
)
}
b
.
writeEndIf
(
w
)
...
...
@@ -205,7 +205,8 @@ func (b *BashShell) archiveFiles(w io.Writer, list interface{}, archiveType, arc
args
:=
[]
string
{
"archive"
,
"-output"
,
"--silent"
,
"--output"
,
archivePath
,
}
...
...
@@ -213,14 +214,14 @@ func (b *BashShell) archiveFiles(w io.Writer, list interface{}, archiveType, arc
if
paths
,
ok
:=
hash
[
"paths"
]
.
([]
interface
{});
ok
{
for
_
,
artifactPath
:=
range
paths
{
if
file
,
ok
:=
artifactPath
.
(
string
);
ok
{
args
=
append
(
args
,
"-path"
,
file
)
args
=
append
(
args
,
"-
-
path"
,
file
)
}
}
}
// Archive also untracked files
if
untracked
,
ok
:=
hash
[
"untracked"
]
.
(
bool
);
ok
&&
untracked
{
args
=
append
(
args
,
"-untracked"
)
args
=
append
(
args
,
"-
-
untracked"
)
}
// Skip creating archive
...
...
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