This repository has been archived by the owner on Oct 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
tar step supports windows #612
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8317805
tar step supports windows
v1v c3d1a4f
ci: use args rather than the params that's already a declared variable
v1v ff9c99f
ci: refactor tar and stashv2
v1v 6ce34a1
ITs
v1v 742568a
support failNever flag
v1v 80d36ff
docs
v1v File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
NAME = 'it/tar' | ||
DSL = '''pipeline { | ||
agent none | ||
stages { | ||
stage('linux') { | ||
agent { label 'linux && immutable' } | ||
steps { | ||
dir('linux') { | ||
writeFile(file: 'bar.txt', text: 'bar') | ||
} | ||
tar(file: 'linux.tgz', archive: true, dir: 'linux', allowMissing: true) | ||
} | ||
} | ||
stage('linux_without_allowMissing') { | ||
agent { label 'linux && immutable' } | ||
steps { | ||
script { | ||
tar(file: 'linux.tgz', archive: true, dir: 'force_failure', allowMissing: false) | ||
if (currentBuild.result.equals('UNSTABLE')) { | ||
echo 'Assertion passed' | ||
} else { | ||
echo 'Expected to fail the tar step since force_failure folder does not exist' | ||
error('Assertion failed') | ||
} | ||
} | ||
} | ||
} | ||
stage('linux_without_failNever') { | ||
agent { label 'linux && immutable' } | ||
steps { | ||
script { | ||
try { | ||
tar(file: 'linux.tgz', archive: true, dir: 'force_failure', failNever: false) | ||
echo 'Expected to fail the tar step since force_failure folder does not exist' | ||
error('Assertion failed') | ||
} catch(e) { | ||
echo 'Assertion passed' | ||
} | ||
} | ||
} | ||
} | ||
stage('windows') { | ||
agent { label 'windows-immutable' } | ||
steps { | ||
dir('windows') { | ||
writeFile(file: 'foo.txt', text: 'foo') | ||
} | ||
tar(file: 'windows.tgz', archive: true, dir: 'windows', allowMissing: true) | ||
} | ||
} | ||
} | ||
}''' | ||
|
||
pipelineJob(NAME) { | ||
definition { | ||
cps { | ||
script(DSL.stripIndent()) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
Compress a folder into a tar file. | ||
|
||
``` | ||
tar(file: 'archive.tgz', | ||
archive: true, | ||
dir: '.' | ||
pathPrefix: '') | ||
tar(file: 'archive.tgz', archive: true, dir: '.') | ||
``` | ||
|
||
* *file*: Name of the tar file to create. | ||
* *archive*: If true the file will be archive in Jenkins (default true). | ||
* *dir*: The folder to compress (default .), it should not contain the compress file. | ||
* *pathPrefix*: Path that contains the folder to compress, the step will make a "cd pathPrefix" before to compress the folder. | ||
* *allowMissing*: whether to report UNSTABLE if tar command failed. Optional. Default 'true' | ||
* *failNever*: Never fail the build, regardless of the step result. Optional. Default 'true' |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, cool. Thanks for grabbing this!