You've already forked jenkins-lib
mirror of
https://github.com/firstBitMarksistskaya/jenkins-lib.git
synced 2025-08-25 20:09:25 +02:00
add file rm if exists
This commit is contained in:
@@ -10,6 +10,7 @@ import org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
|
||||
import ru.pulsar.jenkins.library.configuration.JobConfiguration
|
||||
import ru.pulsar.jenkins.library.configuration.StepCoverageOptions
|
||||
import ru.pulsar.jenkins.library.steps.Coverable
|
||||
import sp.sd.fileoperations.FileOperation
|
||||
|
||||
interface IStepExecutor {
|
||||
|
||||
@@ -34,6 +35,10 @@ interface IStepExecutor {
|
||||
|
||||
boolean fileExists(String file)
|
||||
|
||||
void fileOperations(List<FileOperation> fileOperations)
|
||||
|
||||
void fileDeleteOperation(String includes)
|
||||
|
||||
void echo(message)
|
||||
|
||||
def cmd(String script, boolean returnStatus, boolean returnStdout)
|
||||
@@ -122,4 +127,5 @@ interface IStepExecutor {
|
||||
def brokenTestsSuspects()
|
||||
|
||||
RunWrapper currentBuild()
|
||||
|
||||
}
|
@@ -11,6 +11,7 @@ import ru.pulsar.jenkins.library.configuration.JobConfiguration
|
||||
import ru.pulsar.jenkins.library.configuration.StepCoverageOptions
|
||||
import ru.pulsar.jenkins.library.steps.Coverable
|
||||
import ru.yandex.qatools.allure.jenkins.config.ResultsConfig
|
||||
import sp.sd.fileoperations.FileOperation
|
||||
|
||||
class StepExecutor implements IStepExecutor {
|
||||
|
||||
@@ -55,6 +56,16 @@ class StepExecutor implements IStepExecutor {
|
||||
steps.fileExists file
|
||||
}
|
||||
|
||||
@Override
|
||||
void fileOperations(List<FileOperation> fileOperations) {
|
||||
steps.fileOperations fileOperations
|
||||
}
|
||||
|
||||
@Override
|
||||
void fileDeleteOperation(String includes) {
|
||||
steps.fileDeleteOperation includes: includes, excludes: '', useDefaultExcludes: true
|
||||
}
|
||||
|
||||
@Override
|
||||
FileWrapper[] findFiles(String glob, String excludes = '') {
|
||||
steps.findFiles glob: glob, excludes: excludes
|
||||
|
@@ -43,6 +43,9 @@ class ZipInfobase implements Serializable {
|
||||
archiveInfobase = true
|
||||
}
|
||||
|
||||
if (steps.fileExists(archiveName)) {
|
||||
steps.fileOperations([steps.fileDeleteOperation(archiveName)])
|
||||
}
|
||||
steps.zip('build/ib', archiveName, '1Cv8.1CD', archiveInfobase)
|
||||
steps.stash(archiveName, archiveName, false)
|
||||
}
|
||||
|
Reference in New Issue
Block a user