-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Сохранение ИБ в виде артефакта после выполнения всех шагов инциализации #149
Open
ovcharenko-di
wants to merge
16
commits into
firstBitMarksistskaya:develop
Choose a base branch
from
ovcharenko-di:feature/save-dt
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5660e0c
add archiveInfobase
ovcharenko-di ca6b1b4
rename yaxunit allure file for consistency
ovcharenko-di b92c12e
пgeneralize archive infobase
ovcharenko-di 35110ea
fix merge configuration, add test
ovcharenko-di 34dca07
fix options
ovcharenko-di 738a38e
fix case
ovcharenko-di 412a4c9
fix params
ovcharenko-di 7a9ccaf
fix default param
ovcharenko-di f77ac27
fix conditions, add bdd
ovcharenko-di f5384e8
fix schema, rm commented code
ovcharenko-di 5b09027
upd README.md
ovcharenko-di 2469669
add file rm if exists
ovcharenko-di 845e70f
fix defaults
ovcharenko-di 1eafa08
improve exceptions
ovcharenko-di 296660e
fix defaults
ovcharenko-di 385bf6a
upd README.md
ovcharenko-di 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
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
31 changes: 31 additions & 0 deletions
31
src/ru/pulsar/jenkins/library/configuration/ArchiveInfobaseOptions.groovy
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,31 @@ | ||
package ru.pulsar.jenkins.library.configuration | ||
|
||
import com.cloudbees.groovy.cps.NonCPS | ||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonPropertyDescription | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
class ArchiveInfobaseOptions implements Serializable { | ||
|
||
@JsonPropertyDescription("Сохранять всегда") | ||
Boolean onAlways = false | ||
@JsonPropertyDescription("Сохранять при успешной сборке") | ||
Boolean onSuccess = false | ||
@JsonPropertyDescription("Сохранять при падении сборки") | ||
Boolean onFailure = false | ||
@JsonPropertyDescription("Сохранять при нестабильной сборке") | ||
Boolean onUnstable = false | ||
|
||
@Override | ||
@NonCPS | ||
String toString() { | ||
return "ArchiveInfobaseOptions{" + | ||
"onAlways=" + onAlways + | ||
", onSuccess=" + onSuccess + | ||
", onFailure=" + onFailure + | ||
", onUnstable=" + onUnstable + | ||
'}'; | ||
} | ||
} | ||
|
||
|
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,68 @@ | ||
package ru.pulsar.jenkins.library.steps | ||
|
||
import hudson.model.Result | ||
import ru.pulsar.jenkins.library.IStepExecutor | ||
import ru.pulsar.jenkins.library.configuration.ArchiveInfobaseOptions | ||
import ru.pulsar.jenkins.library.configuration.JobConfiguration | ||
import ru.pulsar.jenkins.library.ioc.ContextRegistry | ||
import ru.pulsar.jenkins.library.utils.Logger | ||
|
||
class ZipInfobase implements Serializable { | ||
|
||
private final JobConfiguration config | ||
private final String stage | ||
|
||
ZipInfobase(JobConfiguration config, String stage) { | ||
this.config = config | ||
this.stage = stage | ||
} | ||
|
||
def run() { | ||
IStepExecutor steps = ContextRegistry.getContext().getStepExecutor() | ||
|
||
Logger.printLocation() | ||
|
||
def currentBuild = steps.currentBuild() | ||
def currentResult = Result.fromString(currentBuild.getCurrentResult()) | ||
|
||
def archiveInfobaseOptions = getArchiveInfobaseOptionsForStage(config, stage) | ||
|
||
def archiveName | ||
if (stage == 'initInfoBase') { | ||
archiveName = "1Cv8.1CD.zip" | ||
} else { | ||
archiveName = "1Cv8.1CD.${stage}.zip" | ||
} | ||
|
||
// опция отвечает только за то, будет ли файл сохранен в виде артефакта | ||
def archiveInfobase = false | ||
if (archiveInfobaseOptions.onAlways | ||
|| (archiveInfobaseOptions.onFailure && (currentResult == Result.FAILURE || currentResult == Result.ABORTED)) | ||
|| (archiveInfobaseOptions.onUnstable && currentResult == Result.UNSTABLE) | ||
|| (archiveInfobaseOptions.onSuccess && currentResult == Result.SUCCESS)) { | ||
archiveInfobase = true | ||
} | ||
|
||
if (steps.fileExists(archiveName)) { | ||
steps.fileOperations([steps.fileDeleteOperation(archiveName)]) | ||
} | ||
steps.zip('build/ib', archiveName, '1Cv8.1CD', archiveInfobase) | ||
steps.stash(archiveName, archiveName, false) | ||
} | ||
|
||
private static ArchiveInfobaseOptions getArchiveInfobaseOptionsForStage(JobConfiguration config, String stageName) { | ||
|
||
def defaultOptions = new ArchiveInfobaseOptions() | ||
if (!stageName) { | ||
return defaultOptions | ||
} | ||
|
||
try { | ||
return config."${stageName}Options".archiveInfobase | ||
} catch(MissingPropertyException | NullPointerException e) { | ||
Logger.println("Ошибка при получении настроек архивации для этапа ${stageName}: ${e.message}") | ||
Logger.println(e.toString()) | ||
return defaultOptions | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
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.
тут возможно имеет смысл выставить в true, т.к. при падении тестов стейдж помечается как UNSTABLE, а не FAILED. ну или по крайней мере расписать это в документации.
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.
согласен, выставил true тут и в initInfobase
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.
я вот думаю, мы мастер не положим такими приколами, кстати? :)
может вырубить все по дефолту?
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.
вырубил
<поднятьворотачутьчуть.jpg>