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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
138 additions
and
60 deletions.
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' |