Skip to content
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

fix(travis): Should not fail stage if Travis properties are not returned #4112

Merged
merged 4 commits into from
Mar 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix(travis): Should not fail stage if Travis properties are not returned
Continuation of #4089 - it should've been part of that PR really.
Orca will now always check for properties from Travis, so it shouldn't fail if none are found.
  • Loading branch information
jervi committed Mar 23, 2021
commit d48b10f6fc3a8735b93ee61357dc788f1d11ccb4
Original file line number Diff line number Diff line change
@@ -62,6 +62,9 @@ public class GetBuildPropertiesTask extends RetryableIgorTask<CIStageDefinition>
stageDefinition.getMaster(),
stageDefinition.getJob());
if (properties.size() == 0) {
jervi marked this conversation as resolved.
Show resolved Hide resolved
if (stageDefinition.getMaster().startsWith("travis-")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any chance for stageDefinition.getMaster() to be null here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is the name of the buildmaster. It needs to be defined and is fetched from igor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it was null an exception would have been thrown a few lines up as well.

return TaskResult.builder(ExecutionStatus.SUCCEEDED).build();
}
throw new ConfigurationException(
String.format(
"Expected properties file %s but it was either missing, empty or contained invalid syntax",
Original file line number Diff line number Diff line change
@@ -146,6 +146,20 @@ class GetBuildPropertiesTaskSpec extends Specification {
e.message == "Expected properties file $PROPERTY_FILE but it was either missing, empty or contained invalid syntax"
}

def "does not fail stage even if properties are not returned from travis and build passed"() {
given:
def stage = createStage(PROPERTY_FILE, "travis-$MASTER")

and:
buildService.getPropertyFile(BUILD_NUMBER, PROPERTY_FILE, MASTER, JOB) >> [:]
jervi marked this conversation as resolved.
Show resolved Hide resolved

when:
TaskResult result = task.execute(stage)

then:
result.status == ExecutionStatus.SUCCEEDED
}

def "does not fetch properties if the property file is empty"() {
given:
def stage = createStage("")
@@ -168,9 +182,9 @@ class GetBuildPropertiesTaskSpec extends Specification {
0 * buildService.getPropertyFile(*_)
}

def createStage(String propertyFile) {
def createStage(String propertyFile, String ciMaster = MASTER) {
return new StageExecutionImpl(Stub(PipelineExecutionImpl), "jenkins", [
master: MASTER,
master: ciMaster,
job: JOB,
buildNumber: BUILD_NUMBER,
propertyFile: propertyFile