diff --git a/echo-core/src/main/java/com/netflix/spinnaker/echo/build/BuildInfoService.java b/echo-core/src/main/java/com/netflix/spinnaker/echo/build/BuildInfoService.java index 608d0a640..e8e5ec967 100644 --- a/echo-core/src/main/java/com/netflix/spinnaker/echo/build/BuildInfoService.java +++ b/echo-core/src/main/java/com/netflix/spinnaker/echo/build/BuildInfoService.java @@ -48,7 +48,7 @@ public class BuildInfoService { // to pass a trigger and // an event as with other triggers, but for now we'll see whether we can extract a build event // from the trigger. - public BuildEvent getBuildEvent(String master, String job, int buildNumber) { + public BuildEvent getBuildEvent(String master, String job, String buildNumber) { Map rawBuild = retry(() -> igorService.getBuild(buildNumber, master, job)); BuildEvent.Build build = objectMapper.convertValue(rawBuild, BuildEvent.Build.class); BuildEvent.Project project = new BuildEvent.Project(job, build); @@ -61,7 +61,7 @@ public BuildEvent getBuildEvent(String master, String job, int buildNumber) { public Map getBuildInfo(BuildEvent event) { String master = event.getContent().getMaster(); String job = event.getContent().getProject().getName(); - int buildNumber = event.getBuildNumber(); + String buildNumber = event.getBuildNumber(); if (StringUtils.isNoneEmpty(master, job)) { return retry(() -> igorService.getBuild(buildNumber, master, job)); @@ -72,7 +72,7 @@ public Map getBuildInfo(BuildEvent event) { public Map getProperties(BuildEvent event, String propertyFile) { String master = event.getContent().getMaster(); String job = event.getContent().getProject().getName(); - int buildNumber = event.getBuildNumber(); + String buildNumber = event.getBuildNumber(); if (StringUtils.isEmpty(propertyFile) && master.contains("travis")) { propertyFile = "travis"; @@ -87,7 +87,7 @@ public Map getProperties(BuildEvent event, String propertyFile) private List getArtifactsFromPropertyFile(BuildEvent event, String propertyFile) { String master = event.getContent().getMaster(); String job = event.getContent().getProject().getName(); - int buildNumber = event.getBuildNumber(); + String buildNumber = event.getBuildNumber(); if (StringUtils.isNoneEmpty(master, job, propertyFile)) { return retry(() -> igorService.getArtifacts(buildNumber, propertyFile, master, job)); } diff --git a/echo-core/src/main/java/com/netflix/spinnaker/echo/services/IgorService.java b/echo-core/src/main/java/com/netflix/spinnaker/echo/services/IgorService.java index b5939075e..6837b5c2d 100644 --- a/echo-core/src/main/java/com/netflix/spinnaker/echo/services/IgorService.java +++ b/echo-core/src/main/java/com/netflix/spinnaker/echo/services/IgorService.java @@ -26,20 +26,20 @@ public interface IgorService { @GET("/builds/status/{buildNumber}/{master}/{job}") Map getBuild( - @Path("buildNumber") Integer buildNumber, + @Path("buildNumber") String buildNumber, @Path("master") String master, @Path(value = "job", encode = false) String job); @GET("/builds/properties/{buildNumber}/{fileName}/{master}/{job}") Map getPropertyFile( - @Path("buildNumber") Integer buildNumber, + @Path("buildNumber") String buildNumber, @Path("fileName") String fileName, @Path("master") String master, @Path(value = "job", encode = false) String job); @GET("/builds/artifacts/{buildNumber}/{master}/{job}") List getArtifacts( - @Path("buildNumber") Integer buildNumber, + @Path("buildNumber") String buildNumber, @Query("propertyFile") String propertyFile, @Path("master") String master, @Path(value = "job", encode = false) String job); diff --git a/echo-model/src/main/java/com/netflix/spinnaker/echo/model/Trigger.java b/echo-model/src/main/java/com/netflix/spinnaker/echo/model/Trigger.java index 051e1fdb6..d4f1a38be 100644 --- a/echo-model/src/main/java/com/netflix/spinnaker/echo/model/Trigger.java +++ b/echo-model/src/main/java/com/netflix/spinnaker/echo/model/Trigger.java @@ -178,7 +178,7 @@ public String toString() { String artifactName; /** Properties that are bound at run-time */ - Integer buildNumber; + String buildNumber; String hash; Map buildInfo; @@ -217,7 +217,7 @@ public String generateFallbackId() { return UUID.nameUUIDFromBytes(this.toString().getBytes()).toString(); } - public Trigger atBuildNumber(final int buildNumber) { + public Trigger atBuildNumber(final String buildNumber) { return this.toBuilder().buildNumber(buildNumber).hash(null).tag(null).build(); } diff --git a/echo-model/src/main/java/com/netflix/spinnaker/echo/model/trigger/BuildEvent.java b/echo-model/src/main/java/com/netflix/spinnaker/echo/model/trigger/BuildEvent.java index 139226b80..c1e2f076a 100644 --- a/echo-model/src/main/java/com/netflix/spinnaker/echo/model/trigger/BuildEvent.java +++ b/echo-model/src/main/java/com/netflix/spinnaker/echo/model/trigger/BuildEvent.java @@ -57,7 +57,7 @@ public static class Project { @JsonIgnoreProperties(ignoreUnknown = true) public static class Build { private boolean building; - private int number; + private String number; private Result result; private String url; private List artifacts; @@ -73,7 +73,7 @@ public enum Result { } @JsonIgnore - public int getBuildNumber() { + public String getBuildNumber() { return content.getProject().getLastBuild().getNumber(); } } diff --git a/echo-pipelinetriggers/src/main/java/com/netflix/spinnaker/echo/pipelinetriggers/eventhandlers/ManualEventHandler.java b/echo-pipelinetriggers/src/main/java/com/netflix/spinnaker/echo/pipelinetriggers/eventhandlers/ManualEventHandler.java index c6521a760..d5c23c409 100644 --- a/echo-pipelinetriggers/src/main/java/com/netflix/spinnaker/echo/pipelinetriggers/eventhandlers/ManualEventHandler.java +++ b/echo-pipelinetriggers/src/main/java/com/netflix/spinnaker/echo/pipelinetriggers/eventhandlers/ManualEventHandler.java @@ -129,7 +129,7 @@ protected Pipeline buildTrigger(Pipeline pipeline, Trigger manualTrigger) { List artifacts = new ArrayList<>(); String master = manualTrigger.getMaster(); String job = manualTrigger.getJob(); - Integer buildNumber = manualTrigger.getBuildNumber(); + String buildNumber = manualTrigger.getBuildNumber(); ArrayList pipelineErrors = new ArrayList<>(); diff --git a/echo-pipelinetriggers/src/test/groovy/com/netflix/spinnaker/echo/pipelinetriggers/eventhandlers/BuildEventHandlerSpec.groovy b/echo-pipelinetriggers/src/test/groovy/com/netflix/spinnaker/echo/pipelinetriggers/eventhandlers/BuildEventHandlerSpec.groovy index 7f04a071f..3cfc19c3e 100644 --- a/echo-pipelinetriggers/src/test/groovy/com/netflix/spinnaker/echo/pipelinetriggers/eventhandlers/BuildEventHandlerSpec.groovy +++ b/echo-pipelinetriggers/src/test/groovy/com/netflix/spinnaker/echo/pipelinetriggers/eventhandlers/BuildEventHandlerSpec.groovy @@ -26,7 +26,7 @@ class BuildEventHandlerSpec extends Specification implements RetrofitStubs { String MASTER_NAME = "jenkins-server" String JOB_NAME = "my-job" - int BUILD_NUMBER = 7 + String BUILD_NUMBER = "7" def PROPERTY_FILE = "property-file" static Map BUILD_INFO = [ abc: 123 diff --git a/echo-pipelinetriggers/src/test/groovy/com/netflix/spinnaker/echo/pipelinetriggers/postprocessors/ExpectedArtifactExpressionEvaluationPostProcessorSpec.groovy b/echo-pipelinetriggers/src/test/groovy/com/netflix/spinnaker/echo/pipelinetriggers/postprocessors/ExpectedArtifactExpressionEvaluationPostProcessorSpec.groovy index d7b5b017e..08a4c6b60 100644 --- a/echo-pipelinetriggers/src/test/groovy/com/netflix/spinnaker/echo/pipelinetriggers/postprocessors/ExpectedArtifactExpressionEvaluationPostProcessorSpec.groovy +++ b/echo-pipelinetriggers/src/test/groovy/com/netflix/spinnaker/echo/pipelinetriggers/postprocessors/ExpectedArtifactExpressionEvaluationPostProcessorSpec.groovy @@ -19,7 +19,7 @@ class ExpectedArtifactExpressionEvaluationPostProcessorSpec extends Specificatio .enabled(true).type('jenkins') .master('master') .job('job') - .buildNumber(100) + .buildNumber('100') .build() def 'evaluates expressions in expected artifacts'() { diff --git a/echo-test/src/main/groovy/com/netflix/spinnaker/echo/test/RetrofitStubs.groovy b/echo-test/src/main/groovy/com/netflix/spinnaker/echo/test/RetrofitStubs.groovy index 4fadd634f..47f52b948 100644 --- a/echo-test/src/main/groovy/com/netflix/spinnaker/echo/test/RetrofitStubs.groovy +++ b/echo-test/src/main/groovy/com/netflix/spinnaker/echo/test/RetrofitStubs.groovy @@ -64,7 +64,7 @@ trait RetrofitStubs { } BuildEvent createBuildEventWith(BuildEvent.Result result) { - def build = result ? new BuildEvent.Build(result == BUILDING, 1, result, null, []) : null + def build = result ? new BuildEvent.Build(result == BUILDING, '1', result, null, []) : null def res = new BuildEvent() res.content = new BuildEvent.Content(new BuildEvent.Project("job", build), "master") res.details = new Metadata([type: BuildEvent.TYPE])