diff --git a/orca-bakery/src/test/groovy/com/netflix/spinnaker/orca/bakery/tasks/CreateBakeTaskSpec.groovy b/orca-bakery/src/test/groovy/com/netflix/spinnaker/orca/bakery/tasks/CreateBakeTaskSpec.groovy index 1c303239751..e29c0aad341 100644 --- a/orca-bakery/src/test/groovy/com/netflix/spinnaker/orca/bakery/tasks/CreateBakeTaskSpec.groovy +++ b/orca-bakery/src/test/groovy/com/netflix/spinnaker/orca/bakery/tasks/CreateBakeTaskSpec.groovy @@ -118,7 +118,7 @@ class CreateBakeTaskSpec extends Specification { @Shared def buildInfo = new JenkinsBuildInfo( - "name", 0, "http://jenkins", "SUCCESS", + "name", null, "http://jenkins", "SUCCESS", [ new JenkinsArtifact("hodor_1.1_all.deb", "."), new JenkinsArtifact("hodor-1.1.noarch.rpm", "."), @@ -128,7 +128,7 @@ class CreateBakeTaskSpec extends Specification { @Shared def buildInfoWithUrl = new JenkinsBuildInfo( - "name", 0, "http://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-echo/69/", "SUCCESS", + "name", null, "http://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-echo/69/", "SUCCESS", [ new JenkinsArtifact("hodor_1.1_all.deb", "."), new JenkinsArtifact("hodor-1.1.noarch.rpm", "."), @@ -138,7 +138,7 @@ class CreateBakeTaskSpec extends Specification { @Shared def buildInfoWithFoldersUrl = new JenkinsBuildInfo( - "name", 0, "http://spinnaker.builds.test.netflix.net/job/folder/job/SPINNAKER-package-echo/69/", "SUCCESS", + "name", null, "http://spinnaker.builds.test.netflix.net/job/folder/job/SPINNAKER-package-echo/69/", "SUCCESS", [ new JenkinsArtifact("hodor_1.1_all.deb", "."), new JenkinsArtifact("hodor-1.1.noarch.rpm", "."), @@ -148,7 +148,7 @@ class CreateBakeTaskSpec extends Specification { @Shared def buildInfoWithUrlAndSCM = new JenkinsBuildInfo( - "name", 0, "http://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-echo/69/", "SUCCESS", + "name", null, "http://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-echo/69/", "SUCCESS", [ new JenkinsArtifact("hodor_1.1_all.deb", "."), new JenkinsArtifact("hodor-1.1.noarch.rpm", "."), @@ -159,7 +159,7 @@ class CreateBakeTaskSpec extends Specification { @Shared def buildInfoWithUrlAndTwoSCMs = new JenkinsBuildInfo( - "name", 0, "http://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-echo/69/", "SUCCESS", + "name", null, "http://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-echo/69/", "SUCCESS", [ new JenkinsArtifact("hodor_1.1_all.deb", "."), new JenkinsArtifact("hodor-1.1.noarch.rpm", "."), @@ -173,7 +173,7 @@ class CreateBakeTaskSpec extends Specification { @Shared def buildInfoWithUrlAndMasterAndDevelopSCMs = new JenkinsBuildInfo( - "name", 0, "http://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-echo/69/", "SUCCESS", + "name", null, "http://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-echo/69/", "SUCCESS", [ new JenkinsArtifact("hodor_1.1_all.deb", "."), new JenkinsArtifact("hodor-1.1.noarch.rpm", "."), @@ -187,7 +187,7 @@ class CreateBakeTaskSpec extends Specification { @Shared def buildInfoNoMatch = new JenkinsBuildInfo( - "name", 0, "http://jenkins", "SUCCESS", + "name", null, "http://jenkins", "SUCCESS", [ new JenkinsArtifact("hodornodor_1.1_all.deb", "."), new JenkinsArtifact("hodor-1.1.noarch.rpm", "."), @@ -340,7 +340,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -393,7 +393,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -444,7 +444,7 @@ class CreateBakeTaskSpec extends Specification { ] ] def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) trigger.buildInfo = buildInfo stage { type = "bake" @@ -537,7 +537,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -588,7 +588,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -637,7 +637,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -686,7 +686,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = mapper.convertValue(contextInfo, Map) def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -735,7 +735,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -786,7 +786,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -840,7 +840,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -894,7 +894,7 @@ class CreateBakeTaskSpec extends Specification { given: bakeConfig.buildInfo = contextInfo def pipelineWithTrigger = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) if (triggerInfo != null) { trigger.buildInfo = triggerInfo } @@ -1111,9 +1111,9 @@ class CreateBakeTaskSpec extends Specification { where: triggerConfig | queryParameter - [type: "jenkins", master: "master", job: "job", buildNumber: 1, rebake: true] | "1" - [type: "jenkins", master: "master", job: "job", buildNumber: 1, rebake: false] | null - [type: "jenkins", master: "master", job: "job", buildNumber: 1] | null + [type: "jenkins", master: "master", job: "job", buildNumber: '1', rebake: true] | "1" + [type: "jenkins", master: "master", job: "job", buildNumber: '1', rebake: false] | null + [type: "jenkins", master: "master", job: "job", buildNumber: '1'] | null } def "properly resolves package artifacts"() { diff --git a/orca-clouddriver-provider-titus/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/providers/aws/TitusAmazonServerGroupCreatorDecoratorSpec.groovy b/orca-clouddriver-provider-titus/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/providers/aws/TitusAmazonServerGroupCreatorDecoratorSpec.groovy index 7a91c5981cf..90f2b6951d9 100644 --- a/orca-clouddriver-provider-titus/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/providers/aws/TitusAmazonServerGroupCreatorDecoratorSpec.groovy +++ b/orca-clouddriver-provider-titus/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/providers/aws/TitusAmazonServerGroupCreatorDecoratorSpec.groovy @@ -24,7 +24,7 @@ import static com.netflix.spinnaker.orca.test.model.ExecutionBuilder.stage class TitusAmazonServerGroupCreatorDecoratorSpec extends Specification { def "should find image id from properties file"() { given: - JenkinsTrigger jenkinsTrigger = new JenkinsTrigger("master", "job", 1, null) + JenkinsTrigger jenkinsTrigger = new JenkinsTrigger("master", "job", "1", null) jenkinsTrigger.properties.put("imageName", "imageFromProperties") def pipeline = pipeline { diff --git a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/cluster/FindImageFromClusterTaskSpec.groovy b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/cluster/FindImageFromClusterTaskSpec.groovy index 0bd9f868076..6e723142e58 100644 --- a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/cluster/FindImageFromClusterTaskSpec.groovy +++ b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/cluster/FindImageFromClusterTaskSpec.groovy @@ -85,7 +85,7 @@ class FindImageFromClusterTaskSpec extends Specification { imageId : "ami-012", imageName : "ami-012-name", image : [imageId: "ami-012", name: "ami-012-name", foo: "bar"], - buildInfo : [job: "foo-build", buildNumber: 1] + buildInfo : [job: "foo-build", buildNumber: '1'] ]] ] @@ -95,7 +95,7 @@ class FindImageFromClusterTaskSpec extends Specification { imageId : "ami-234", imageName : "ami-234-name", image : [imageId: "ami-234", name: "ami-234-name", foo: "baz"], - buildInfo : [job: "foo-build", buildNumber: 1] + buildInfo : [job: "foo-build", buildNumber: '1'] ]] ] } @@ -135,7 +135,7 @@ class FindImageFromClusterTaskSpec extends Specification { imageId : "ami-012", imageName : "ami-012-name", image : [imageId: "ami-012", name: "ami-012-name", foo: "bar"], - buildInfo : [job: "foo-build", buildNumber: 1] + buildInfo : [job: "foo-build", buildNumber: '1'] ]] ] @@ -239,7 +239,7 @@ class FindImageFromClusterTaskSpec extends Specification { imageId : "ami-012", imageName : "ami-012-name-ebs", image : [imageId: "ami-012", name: "ami-012-name-ebs", foo: "bar"], - buildInfo : [job: "foo-build", buildNumber: 1] + buildInfo : [job: "foo-build", buildNumber: '1'] ]] ] diff --git a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/providers/appengine/AppEngineBranchFinderSpec.groovy b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/providers/appengine/AppEngineBranchFinderSpec.groovy index 2c3a89f3946..401c32c192a 100644 --- a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/providers/appengine/AppEngineBranchFinderSpec.groovy +++ b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/tasks/providers/appengine/AppEngineBranchFinderSpec.groovy @@ -76,8 +76,8 @@ class AppEngineBranchFinderSpec extends Specification { @Unroll def "(jenkins trigger) should resolve branch, using regex (if provided) to narrow down options"() { given: - def trigger = new JenkinsTrigger("Jenkins", "poll_git_repo", 1, null) - trigger.buildInfo = new JenkinsBuildInfo("poll_git_repo", 1, "http://jenkins", "SUCCESS", [], scm) + def trigger = new JenkinsTrigger("Jenkins", "poll_git_repo", '1', null) + trigger.buildInfo = new JenkinsBuildInfo("poll_git_repo", '1', "http://jenkins", "SUCCESS", [], scm) def operation = [ trigger: [ @@ -99,8 +99,8 @@ class AppEngineBranchFinderSpec extends Specification { @Unroll def "(jenkins trigger) should throw appropriate error if method cannot resolve exactly one branch"() { given: - def trigger = new JenkinsTrigger("Jenkins", "poll_git_repo", 1, null) - trigger.buildInfo = new JenkinsBuildInfo("poll_git_repo", 1, "http://jenkins", "SUCCESS", [], scm) + def trigger = new JenkinsTrigger("Jenkins", "poll_git_repo", '1', null) + trigger.buildInfo = new JenkinsBuildInfo("poll_git_repo", '1', "http://jenkins", "SUCCESS", [], scm) def operation = [ trigger : [ diff --git a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/utils/OortHelperSpec.groovy b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/utils/OortHelperSpec.groovy index e5237b27ff5..116cccceebe 100644 --- a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/utils/OortHelperSpec.groovy +++ b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/clouddriver/utils/OortHelperSpec.groovy @@ -35,14 +35,14 @@ class OortHelperSpec extends Specification { "region": "us-west-2", "asg": { "createdTime": 12344, "suspendedProcesses": [{"processName": "AddToLoadBalancer"}] }, "image": { "imageId": "ami-012", "name": "ami-012" }, - "buildInfo": { "job": "foo-build", "buildNumber": 1 }, + "buildInfo": { "job": "foo-build", "buildNumber": "1" }, "instances": [ { "id": 1 }, { "id": 2 } ] },{ "name": "myapp-v003", "region":"us-west-2", "asg": { "createdTime": 23456, "suspendedProcesses": [] }, "image": { "imageId": "ami-234", "name": "ami-234" }, - "buildInfo": { "job": "foo-build", "buildNumber": 1 }, + "buildInfo": { "job": "foo-build", "buildNumber": "1" }, "instances": [ { "id": 1 } ] }] } @@ -67,7 +67,7 @@ class OortHelperSpec extends Specification { "region": "us-west-2", "asg": { "createdTime": 12344, "suspendedProcesses": [{"processName": "AddToLoadBalancer"}] }, "image": { "imageId": "ami-012", "name": "ami-012" }, - "buildInfo": { "job": "foo-build", "buildNumber": 1 }, + "buildInfo": { "job": "foo-build", "buildNumber": "1" }, "instances": [ { "instanceId": 1, "health" : [{"healthCheckUrl" : "http://foo/bar"}, {"status": "UP"}] }, { "instanceId": 2, "health" : [{"healthCheckUrl" : "http://foo2/bar2"}, {"status": "UP"}] } ] }] } @@ -92,7 +92,7 @@ class OortHelperSpec extends Specification { "region": "us-west-2", "asg": { "createdTime": 12344, "suspendedProcesses": [{"processName": "AddToLoadBalancer"}] }, "image": { "imageId": "ami-012", "name": "ami-012" }, - "buildInfo": { "job": "foo-build", "buildNumber": 1 }, + "buildInfo": { "job": "foo-build", "buildNumber": "1" }, "instances": [ { "instanceId": 1, "health" : [{"healthCheckUrl" : "http://foo/bar"}, {"status": "DOWN"}] }, { "instanceId": 2, "health" : [{"healthCheckUrl" : "http://foo2/bar2"}, {"status": "UP"}] }, { "instanceId": 3, "health" : [{"healthCheckUrl" : "http://foo2/bar3"}] }, diff --git a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/kato/pipeline/ParallelDeployStageSpec.groovy b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/kato/pipeline/ParallelDeployStageSpec.groovy index 4e38e57e6a9..414c1270556 100644 --- a/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/kato/pipeline/ParallelDeployStageSpec.groovy +++ b/orca-clouddriver/src/test/groovy/com/netflix/spinnaker/orca/kato/pipeline/ParallelDeployStageSpec.groovy @@ -30,7 +30,7 @@ class ParallelDeployStageSpec extends Specification { def "should build contexts corresponding to cluster configuration(s)"() { given: def pipeline = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", "1", null) application = "orca" } def bakeStage = new StageExecutionImpl(pipeline, "deploy", "Deploy!", stageContext) @@ -57,7 +57,7 @@ class ParallelDeployStageSpec extends Specification { def "pipeline strategy should #data.scenario"() { given: def parentPipeline = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", "1", null) application = "orca" stage { name = "parent stage" diff --git a/orca-clouddriver/src/test/resources/pipelinetrigger.json b/orca-clouddriver/src/test/resources/pipelinetrigger.json index 2fe9bed02be..bda51a73213 100644 --- a/orca-clouddriver/src/test/resources/pipelinetrigger.json +++ b/orca-clouddriver/src/test/resources/pipelinetrigger.json @@ -11072,12 +11072,12 @@ "master": "mimir", "job": "SPIN-TASKS", "queuedBuild": "173601", - "buildNumber": 206809, + "buildNumber": "206809", "buildInfo": { "building": false, "fullDisplayName": "SPIN-TASKS #206809", "name": "SPIN-TASKS", - "number": 206809, + "number": "206809", "duration": 13190, "timestamp": "1510187419430", "result": "SUCCESS", @@ -11109,7 +11109,7 @@ "building": false, "fullDisplayName": "SPIN-TASKS #206809", "name": "SPIN-TASKS", - "number": 206809, + "number": "206809", "duration": 13190, "timestamp": "1510187419430", "result": "SUCCESS", diff --git a/orca-core-tck/src/main/groovy/com/netflix/spinnaker/orca/pipeline/persistence/PipelineExecutionRepositoryTck.groovy b/orca-core-tck/src/main/groovy/com/netflix/spinnaker/orca/pipeline/persistence/PipelineExecutionRepositoryTck.groovy index 04d20eb8d68..679d4e430ea 100644 --- a/orca-core-tck/src/main/groovy/com/netflix/spinnaker/orca/pipeline/persistence/PipelineExecutionRepositoryTck.groovy +++ b/orca-core-tck/src/main/groovy/com/netflix/spinnaker/orca/pipeline/persistence/PipelineExecutionRepositoryTck.groovy @@ -223,7 +223,7 @@ abstract class PipelineExecutionRepositoryTck ext def pipeline = pipeline { application = "orca" name = "dummy-pipeline" - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) stage { type = "one" context = [foo: "foo"] diff --git a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/BuildInfo.kt b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/BuildInfo.kt index 4cf5182b742..08d8dd33c00 100644 --- a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/BuildInfo.kt +++ b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/BuildInfo.kt @@ -2,7 +2,7 @@ package com.netflix.spinnaker.orca.pipeline.model abstract class BuildInfo( open val name: String?, - open val number: Int, + open val number: String?, open val url: String?, open val result: String?, open val artifacts: List? = emptyList(), diff --git a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/ConcourseTrigger.kt b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/ConcourseTrigger.kt index 8511db89a2c..eab4d98a71f 100644 --- a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/ConcourseTrigger.kt +++ b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/ConcourseTrigger.kt @@ -90,7 +90,7 @@ class ConcourseBuildInfo @JsonCreator constructor( @param:JsonProperty("name") override val name: String?, - @param:JsonProperty("number") override val number: Int, + @param:JsonProperty("number") override val number: String?, @param:JsonProperty("url") override val url: String?, @param:JsonProperty("result") override val result: String?, @param:JsonProperty("artifacts") override val artifacts: List?, diff --git a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/JenkinsTrigger.kt b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/JenkinsTrigger.kt index f09a57226c4..8f757cfd609 100644 --- a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/JenkinsTrigger.kt +++ b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/JenkinsTrigger.kt @@ -35,7 +35,7 @@ data class JenkinsTrigger private var isStrategy: Boolean = false, val master: String, val job: String, - val buildNumber: Int, + val buildNumber: String?, val propertyFile: String? ) : Trigger { @@ -102,7 +102,7 @@ class JenkinsBuildInfo @JsonCreator constructor( @param:JsonProperty("name") override val name: String?, - @param:JsonProperty("number") override val number: Int, + @param:JsonProperty("number") override val number: String?, @param:JsonProperty("url") override val url: String?, @param:JsonProperty("result") override val result: String?, @param:JsonProperty("artifacts") override val artifacts: List?, @@ -115,7 +115,7 @@ constructor( @JvmOverloads constructor( name: String, - number: Int, + number: String?, url: String, result: String, artifacts: List = emptyList(), diff --git a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/support/TriggerDeserializer.kt b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/support/TriggerDeserializer.kt index 102474aa524..1976ed8112f 100644 --- a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/support/TriggerDeserializer.kt +++ b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/model/support/TriggerDeserializer.kt @@ -84,7 +84,7 @@ class TriggerDeserializer : get("strategy")?.booleanValue() == true, get("master").textValue(), get("job").textValue(), - get("buildNumber").intValue(), + get("buildNumber").textValue(), get("propertyFile")?.textValue() ).apply { buildInfo = get("buildInfo")?.parseValue(parser) diff --git a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/util/BuildDetailExtractor.java b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/util/BuildDetailExtractor.java index 54df8f8470e..21796a10461 100644 --- a/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/util/BuildDetailExtractor.java +++ b/orca-core/src/main/java/com/netflix/spinnaker/orca/pipeline/util/BuildDetailExtractor.java @@ -112,7 +112,9 @@ public boolean tryToExtractBuildDetails(BuildInfo buildInfo, Map 0) { + if (buildInfo.getUrl() != null + && buildInfo.getName() != null + && buildInfo.getNumber() != null) { Map copyRequest = new HashMap<>(); copyRequest.put("buildInfoUrl", buildInfo.getUrl()); copyRequest.put("job", buildInfo.getName()); diff --git a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/PipelineSpec.groovy b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/PipelineSpec.groovy index 3e8e11555e1..78f9d7167c8 100644 --- a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/PipelineSpec.groovy +++ b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/PipelineSpec.groovy @@ -31,7 +31,7 @@ class PipelineSpec extends Specification { @Subject pipeline = pipeline { - trigger = new JenkinsTrigger("master", "SPINNAKER-build-job", 1, null) + trigger = new JenkinsTrigger("master", "SPINNAKER-build-job", '1', null) stage { type = "stage1" } stage { type = "stage2" } stage { type = "stage3" } @@ -58,6 +58,6 @@ class PipelineSpec extends Specification { def "trigger is properly build into the pipeline"() { expect: pipeline.trigger.job == "SPINNAKER-build-job" - pipeline.trigger.buildNumber == 1 + pipeline.trigger.buildNumber == '1' } } diff --git a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/model/TriggerSpec.groovy b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/model/TriggerSpec.groovy index 971ad2bd0eb..5c47b5ea008 100644 --- a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/model/TriggerSpec.groovy +++ b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/model/TriggerSpec.groovy @@ -318,7 +318,7 @@ class TriggerSpec extends Specification { with(trigger) { master == "spinnaker" job == "SPINNAKER-package-orca" - buildNumber == 1509 + buildNumber == '1509' propertyFile == "" buildInfo.url == "https://spinnaker.builds.test.netflix.net/job/SPINNAKER-package-orca/1509/" buildInfo.artifacts.size() == 2 @@ -340,7 +340,7 @@ class TriggerSpec extends Specification { "building": false, "fullDisplayName": "SPINNAKER-package-orca #1509", "name": "SPINNAKER-package-orca", - "number": 1509, + "number": "1509", "duration": 124941, "timestamp": "1513230062314", "result": "SUCCESS", @@ -365,7 +365,7 @@ class TriggerSpec extends Specification { }, "type": "jenkins", "job": "SPINNAKER-package-orca", - "buildNumber": 1509, + "buildNumber": "1509", "parameters": {}, "user": "[anonymous]", "enabled": true, @@ -550,7 +550,7 @@ class TriggerSpec extends Specification { with(trigger) { master == "travis-schibsted" job == "spt-infrastructure/metrics/master" - buildNumber == 245 + buildNumber == '245' propertyFile == null buildInfo.url == "https://travis.schibsted.io/spt-infrastructure/metrics/builds/2685930" } @@ -574,7 +574,7 @@ class TriggerSpec extends Specification { "building": false, "duration": 72, "name": "spt-infrastructure/metrics", - "number": 245, + "number": "245", "result": "SUCCESS", "scm": [ { @@ -590,7 +590,7 @@ class TriggerSpec extends Specification { "timestamp": "1516881731000", "url": "https://travis.schibsted.io/spt-infrastructure/metrics/builds/2685930" }, - "buildNumber": 245, + "buildNumber": "245", "constraints": null, "cronExpression": null, "digest": null, @@ -627,10 +627,10 @@ class TriggerSpec extends Specification { with(trigger) { master == "staging" job == "mytest" - buildNumber == 123 + buildNumber == "123" propertyFile == null buildInfo.name == "test-build" - buildInfo.number == 123 + buildInfo.number == "123" buildInfo.url == "https://testurl" } @@ -638,10 +638,10 @@ class TriggerSpec extends Specification { triggerJson = """{ "buildInfo": { "name": "test-build", - "number": 123, + "number": "123", "url": "https://testurl" }, - "buildNumber": 123, + "buildNumber": "123", "job": "mytest", "master": "staging", "propertyFile": null, diff --git a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/BuildDetailExtractorSpec.groovy b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/BuildDetailExtractorSpec.groovy index 13185460a9d..38e1adac948 100644 --- a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/BuildDetailExtractorSpec.groovy +++ b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/BuildDetailExtractorSpec.groovy @@ -36,8 +36,8 @@ class BuildDetailExtractorSpec extends Specification { where: buildInfo | result | expectedResult - ["name": "SPINNAKER", "number": "9001", "url": "http://spinnaker.jenkis.test.netflix.net/job/SPINNAKER-package-echo/69/"] | [:] | ["job": "SPINNAKER", "buildNumber": 9001, "buildInfoUrl": "http://spinnaker.jenkis.test.netflix.net/job/SPINNAKER-package-echo/69/", "buildHost": "http://spinnaker.jenkis.test.netflix.net/"] - ["name": "organization/SPINNAKER", "number": "9001", "url": "http://spinnaker.travis.test.netflix.net/organization/SPINNAKER-package-echo/builds/69/"] | [:] | ["job": "organization/SPINNAKER", "buildNumber": 9001, "buildInfoUrl": "http://spinnaker.travis.test.netflix.net/organization/SPINNAKER-package-echo/builds/69/", "buildHost": "http://spinnaker.travis.test.netflix.net/"] + ["name": "SPINNAKER", "number": "9001", "url": "http://spinnaker.jenkis.test.netflix.net/job/SPINNAKER-package-echo/69/"] | [:] | ["job": "SPINNAKER", "buildNumber": '9001', "buildInfoUrl": "http://spinnaker.jenkis.test.netflix.net/job/SPINNAKER-package-echo/69/", "buildHost": "http://spinnaker.jenkis.test.netflix.net/"] + ["name": "organization/SPINNAKER", "number": "9001", "url": "http://spinnaker.travis.test.netflix.net/organization/SPINNAKER-package-echo/builds/69/"] | [:] | ["job": "organization/SPINNAKER", "buildNumber": '9001', "buildInfoUrl": "http://spinnaker.travis.test.netflix.net/organization/SPINNAKER-package-echo/builds/69/", "buildHost": "http://spinnaker.travis.test.netflix.net/"] } @Unroll diff --git a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/ContextParameterProcessorSpec.groovy b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/ContextParameterProcessorSpec.groovy index d11d8f4d4db..56aa50c61a2 100644 --- a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/ContextParameterProcessorSpec.groovy +++ b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/ContextParameterProcessorSpec.groovy @@ -304,7 +304,7 @@ class ContextParameterProcessorSpec extends Specification { @Unroll def "correctly compute scmInfo attribute"() { given: - context.trigger.buildInfo = new JenkinsBuildInfo("name", 1, "http://jenkins", "SUCCESS", [], scm) + context.trigger.buildInfo = new JenkinsBuildInfo("name", '1', "http://jenkins", "SUCCESS", [], scm) def source = ['branch': '${scmInfo.branch}'] @@ -323,7 +323,7 @@ class ContextParameterProcessorSpec extends Specification { [new SourceControl("", "buildBranch", ""), new SourceControl("", "jenkinsBranch", "")] | 'buildBranch' context = [ - trigger: new JenkinsTrigger("master", "job", 1, null) + trigger: new JenkinsTrigger("master", "job", '1', null) ] } @@ -401,7 +401,7 @@ class ContextParameterProcessorSpec extends Specification { type = "wait" status = SUCCEEDED } - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) }, pipeline { stage { @@ -432,7 +432,7 @@ class ContextParameterProcessorSpec extends Specification { status = SUCCEEDED context = [waitTime: 10] } - trigger = new JenkinsTrigger("master", "job", 1, null) + trigger = new JenkinsTrigger("master", "job", '1', null) }, pipeline { stage { diff --git a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/PackageInfoSpec.groovy b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/PackageInfoSpec.groovy index 768b7818ecc..24a5c528c72 100644 --- a/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/PackageInfoSpec.groovy +++ b/orca-core/src/test/groovy/com/netflix/spinnaker/orca/pipeline/util/PackageInfoSpec.groovy @@ -62,8 +62,8 @@ class PackageInfoSpec extends Specification { given: def execution = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) - trigger.buildInfo = new JenkinsBuildInfo("name", 1, "http://jenkins", "SUCCESS", [new JenkinsArtifact("testFileName", ".")]) + trigger = new JenkinsTrigger("master", "job", '1', null) + trigger.buildInfo = new JenkinsBuildInfo("name", '1', "http://jenkins", "SUCCESS", [new JenkinsArtifact("testFileName", ".")]) stage { context = [buildInfo: [name: "someName"], package: "testPackageName"] } @@ -220,7 +220,7 @@ class PackageInfoSpec extends Specification { url : "http://jenkins", master : "master", name : "job", - number : 1, + number : '1', artifacts: [[fileName: "api_1.1.1-h02.sha123_all.deb", relativePath: "."]], scm : [] ] @@ -276,7 +276,7 @@ class PackageInfoSpec extends Specification { url : "http://jenkins", master : "master", name : "job", - number : 1, + number : '1', artifacts: [[fileName: "api_1.1.1-h01.sha123_all.deb", relativePath: "."]], scm : [] ] @@ -289,7 +289,7 @@ class PackageInfoSpec extends Specification { url : "http://jenkins", master : "master", name : "job", - number : 1, + number : '1', scm : [] ] } @@ -325,7 +325,7 @@ class PackageInfoSpec extends Specification { url : "http://jenkins", master : "master", name : "job", - number : 1, + number : '1', artifacts: [[fileName: "api_1.1.1-h01.sha123_all.deb", relativePath: "."]], scm : [] ] @@ -360,7 +360,7 @@ class PackageInfoSpec extends Specification { url : "http://jenkins", master : "master", name : "job", - number : 1, + number : '1', artifacts: [[fileName: "api_1.1.1-h01.sha123_all.deb", relativePath: "."]], scm : [] ] @@ -393,8 +393,8 @@ class PackageInfoSpec extends Specification { def "findTargetPackage: allowing unmatched packages is guarded by the allowMissingPackageInstallation flag"() { given: def pipeline = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) - trigger.buildInfo = new JenkinsBuildInfo("name", 1, "http://jenkins", "SUCCESS", [new JenkinsArtifact("api_1.1.1-h01.sha123_all.deb", ".")]) + trigger = new JenkinsTrigger("master", "job", '1', null) + trigger.buildInfo = new JenkinsBuildInfo("name", '1', "http://jenkins", "SUCCESS", [new JenkinsArtifact("api_1.1.1-h01.sha123_all.deb", ".")]) stage { refId = "1" context["package"] = "another_package" @@ -429,8 +429,8 @@ class PackageInfoSpec extends Specification { def "findTargetPackage: stage execution instance of Pipeline with trigger and no buildInfo"() { given: def pipeline = pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) - trigger.buildInfo = new JenkinsBuildInfo("name", 1, "http://jenkins", "SUCCESS", [new JenkinsArtifact("api_2.2.2-h02.sha321_all.deb", ".")]) + trigger = new JenkinsTrigger("master", "job", '1', null) + trigger.buildInfo = new JenkinsBuildInfo("name", '1', "http://jenkins", "SUCCESS", [new JenkinsArtifact("api_2.2.2-h02.sha321_all.deb", ".")]) stage { context = [package: 'api'] } @@ -516,11 +516,11 @@ class PackageInfoSpec extends Specification { packageVersion = "1.1.1-h01.sha123" pipelineTrigger << [ new PipelineTrigger(ExecutionBuilder.pipeline { - trigger = new JenkinsTrigger("master", "job", 1, null) - trigger.buildInfo = new JenkinsBuildInfo("name", 1, "http://jenkins", "SUCCESS", [new JenkinsArtifact("api_1.1.1-h01.sha123_all.deb", ".")]) + trigger = new JenkinsTrigger("master", "job", '1', null) + trigger.buildInfo = new JenkinsBuildInfo("name", '1', "http://jenkins", "SUCCESS", [new JenkinsArtifact("api_1.1.1-h01.sha123_all.deb", ".")]) }), - new JenkinsTrigger("master", "job", 1, null).with { - it.buildInfo = new JenkinsBuildInfo("name", 1, "http://jenkins", "SUCCESS", [new JenkinsArtifact("api_1.1.1-h01.sha123_all.deb", ".")]) + new JenkinsTrigger("master", "job", '1', null).with { + it.buildInfo = new JenkinsBuildInfo("name", '1', "http://jenkins", "SUCCESS", [new JenkinsArtifact("api_1.1.1-h01.sha123_all.deb", ".")]) it } ] @@ -528,8 +528,8 @@ class PackageInfoSpec extends Specification { def "should fetch artifacts from upstream stage when not specified on pipeline trigger"() { given: - def jenkinsTrigger = new JenkinsTrigger("master", "job", 1, "propertyFile") - jenkinsTrigger.buildInfo = new JenkinsBuildInfo("name", 0, "url", "result") + def jenkinsTrigger = new JenkinsTrigger("master", "job", '1', "propertyFile") + jenkinsTrigger.buildInfo = new JenkinsBuildInfo("name", '0', "url", "result") def pipeline = pipeline { trigger = jenkinsTrigger // has no artifacts! @@ -791,7 +791,7 @@ class PackageInfoSpec extends Specification { url : "http://jenkins", master : "master", name : "grandParentStage", - number : 1, + number : '1', artifacts: [[fileName: "artifact1_1.1.1-h01.grandParent.deb", relativePath: "."], [fileName: "artifact2_1.1.1-h01.grandParent.deb", relativePath: "."]], scm : [] @@ -825,7 +825,7 @@ class PackageInfoSpec extends Specification { url : "http://jenkins", master : "master", name : "parentStage", - number : 1, + number : '1', artifacts: [[fileName: "artifact1_1.1.2-h02-parent.deb", relativePath: "."]], scm : [] ] @@ -857,7 +857,7 @@ class PackageInfoSpec extends Specification { url : "http://jenkins", master : "master", name : "childStage", - number : 1, + number : '1', artifacts: [[fileName: "blah_1.1.1-h01.child.deb", relativePath: "."]], scm : [] ] @@ -893,7 +893,7 @@ class PackageInfoSpec extends Specification { then: noExceptionThrown() buildInfo1 == [packageVersion:"1.1.1-h01.child", package:"blah_1.1.1-h01.child", - buildInfoUrl:"http://jenkins", job:"childStage", buildNumber:1] + buildInfoUrl:"http://jenkins", job:"childStage", buildNumber:'1'] when: PackageInfo packageInfo2 = new PackageInfo( @@ -903,7 +903,7 @@ class PackageInfoSpec extends Specification { then: noExceptionThrown() buildInfo2 == [packageVersion:"1.1.2-h02-parent", package:"artifact1_1.1.2-h02-parent", - buildInfoUrl:"http://jenkins", job:"parentStage", buildNumber:1] + buildInfoUrl:"http://jenkins", job:"parentStage", buildNumber:'1'] when: PackageInfo packageInfo3 = new PackageInfo( @@ -913,6 +913,6 @@ class PackageInfoSpec extends Specification { then: noExceptionThrown() buildInfo3 == [packageVersion:"1.1.1-h01.grandParent", package:"artifact2_1.1.1-h01.grandParent", - buildInfoUrl:"http://jenkins", job:"grandParentStage", buildNumber:1] + buildInfoUrl:"http://jenkins", job:"grandParentStage", buildNumber:'1'] } } diff --git a/orca-core/src/test/java/com/netflix/spinnaker/orca/pipeline/model/JenkinsTriggerTest.java b/orca-core/src/test/java/com/netflix/spinnaker/orca/pipeline/model/JenkinsTriggerTest.java index 3949f4fb27c..39c2b542055 100644 --- a/orca-core/src/test/java/com/netflix/spinnaker/orca/pipeline/model/JenkinsTriggerTest.java +++ b/orca-core/src/test/java/com/netflix/spinnaker/orca/pipeline/model/JenkinsTriggerTest.java @@ -29,7 +29,7 @@ class JenkinsTriggerTest { + "\"type\": \"jenkins\"," + "\"master\": \"my-jenkins-master\"," + "\"job\": \"my-job\"," - + "\"buildNumber\": 50," + + "\"buildNumber\": \"50\"," + "\"buildInfo\": {" + " \"artifacts\": [" + " {" @@ -42,7 +42,7 @@ class JenkinsTriggerTest { + " \"duration\": 246," + " \"fullDisplayName\": \"PropertiesTest #106\"," + " \"name\": \"PropertiesTest\"," - + " \"number\": 106," + + " \"number\": \"106\"," + " \"result\": \"SUCCESS\"," + " \"scm\": [" + " {" diff --git a/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorJenkinsJobTask.groovy b/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorJenkinsJobTask.groovy index 6aecaaecfae..ddd051664d7 100644 --- a/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorJenkinsJobTask.groovy +++ b/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorJenkinsJobTask.groovy @@ -53,7 +53,7 @@ class MonitorJenkinsJobTask implements OverridableTimeoutRetryableTask { return TaskResult.ofStatus(ExecutionStatus.TERMINAL) } - def buildNumber = (int) stage.context.buildNumber + def buildNumber = stage.context.buildNumber try { Map build = buildService.getBuild(buildNumber, master, job) Map outputs = [:] diff --git a/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorQueuedJenkinsJobTask.groovy b/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorQueuedJenkinsJobTask.groovy index 3a479d8f5bc..b8d7b937e01 100644 --- a/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorQueuedJenkinsJobTask.groovy +++ b/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorQueuedJenkinsJobTask.groovy @@ -53,7 +53,7 @@ class MonitorQueuedJenkinsJobTask implements OverridableTimeoutRetryableTask { if (build?.number == null) { return TaskResult.ofStatus(ExecutionStatus.RUNNING) } else { - createBacklink(stage, jenkinsController, jobName, build.number as Integer) + createBacklink(stage, jenkinsController, jobName, build.number as String) return TaskResult.builder(ExecutionStatus.SUCCEEDED).context([buildNumber: build.number]).build() } } catch (RetrofitError e) { @@ -84,7 +84,7 @@ class MonitorQueuedJenkinsJobTask implements OverridableTimeoutRetryableTask { private void createBacklink(StageExecution stageExecution, String jenkinsController, String jobName, - Integer buildNumber) { + String buildNumber) { if (wwwBaseUrl == null || wwwBaseUrl.isEmpty()) { log.info("Not creating backlink from Jenkins to Spinnaker, see https://spinnaker.io/setup/ci/jenkins/ for more info") return diff --git a/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorWerckerJobStartedTask.groovy b/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorWerckerJobStartedTask.groovy index 9fe96b056c8..7f8d479d640 100644 --- a/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorWerckerJobStartedTask.groovy +++ b/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorWerckerJobStartedTask.groovy @@ -34,7 +34,7 @@ class MonitorWerckerJobStartedTask implements OverridableTimeoutRetryableTask { TaskResult execute(@Nonnull final StageExecution stage) { String master = stage.context.master String job = stage.context.job - Integer buildNumber = Integer.valueOf(stage.context.queuedBuild) + String buildNumber = stage.context.queuedBuild try { Map build = buildService.getBuild(buildNumber, master, job) diff --git a/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/StopJenkinsJobTask.groovy b/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/StopJenkinsJobTask.groovy index 5644463fd41..796a235a030 100644 --- a/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/StopJenkinsJobTask.groovy +++ b/orca-igor/src/main/groovy/com/netflix/spinnaker/orca/igor/tasks/StopJenkinsJobTask.groovy @@ -43,7 +43,7 @@ class StopJenkinsJobTask implements Task { String master = stage.context.master String job = stage.context.job String queuedBuild = stage.context.queuedBuild - Integer buildNumber = stage.context.buildNumber ? (Integer) stage.context.buildNumber : 0 + String buildNumber = stage.context.buildNumber ? stage.context.buildNumber : "0" if (queuedBuild != null) { buildService.stop(master, job, queuedBuild, buildNumber) diff --git a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/BuildService.java b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/BuildService.java index 0ecc8a0d823..1432cb697f4 100644 --- a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/BuildService.java +++ b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/BuildService.java @@ -44,7 +44,7 @@ public Response build( return igorService.build(master, encode(jobName), queryParams, startTime); } - public String stop(String master, String jobName, String queuedBuild, Integer buildNumber) { + public String stop(String master, String jobName, String queuedBuild, String buildNumber) { if (this.igorFeatureFlagProperties.isJobNameAsQueryParameter()) { return igorService.stopWithJobNameAsQueryParameter( master, jobName, queuedBuild, buildNumber, ""); @@ -56,22 +56,22 @@ public Map queuedBuild(String master, String item) { return igorService.queuedBuild(master, item); } - public Map getBuild(Integer buildNumber, String master, String job) { + public Map getBuild(String buildNumber, String master, String job) { return igorService.getBuild(buildNumber, master, encode(job)); } public Map getPropertyFile( - Integer buildNumber, String fileName, String master, String job) { + String buildNumber, String fileName, String master, String job) { return igorService.getPropertyFile(buildNumber, fileName, master, encode(job)); } public List getArtifacts( - Integer buildNumber, String fileName, String master, String job) { + String buildNumber, String fileName, String master, String job) { return igorService.getArtifacts(buildNumber, fileName, master, encode(job)); } public Response updateBuild( - String master, String jobName, Integer buildNumber, IgorService.UpdatedBuild updatedBuild) { + String master, String jobName, String buildNumber, IgorService.UpdatedBuild updatedBuild) { return igorService.update(master, jobName, buildNumber, updatedBuild); } } diff --git a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/IgorService.java b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/IgorService.java index b9896c678bf..6cda2ea0900 100644 --- a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/IgorService.java +++ b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/IgorService.java @@ -39,7 +39,7 @@ String stop( @Path("name") String master, @Path(encode = false, value = "jobName") String jobName, @Path(encode = false, value = "queuedBuild") String queuedBuild, - @Path(encode = false, value = "buildNumber") Integer buildNumber, + @Path(encode = false, value = "buildNumber") String buildNumber, @Body String ignored); @PUT("/masters/{name}/jobs/stop/{queuedBuild}/{buildNumber}") @@ -47,14 +47,14 @@ String stopWithJobNameAsQueryParameter( @Path("name") String master, @Query(value = "jobName") String jobName, @Path(encode = false, value = "queuedBuild") String queuedBuild, - @Path(encode = false, value = "buildNumber") Integer buildNumber, + @Path(encode = false, value = "buildNumber") String buildNumber, @Body String ignored); @PATCH("/masters/{name}/jobs/{jobName}/update/{buildNumber}") Response update( @Path("name") String master, @Path(encode = false, value = "jobName") String jobName, - @Path(encode = false, value = "buildNumber") Integer buildNumber, + @Path(encode = false, value = "buildNumber") String buildNumber, @Body UpdatedBuild updatedBuild); @GET("/builds/queue/{master}/{item}") @@ -62,13 +62,13 @@ Response update( @GET("/builds/status/{buildNumber}/{master}/{job}") Map getBuild( - @Path("buildNumber") Integer buildNumber, + @Path("buildNumber") String buildNumber, @Path("master") String master, @Path(encode = false, value = "job") 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(encode = false, value = "job") String job); @@ -82,7 +82,7 @@ List compareCommits( @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/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/model/CIStageDefinition.java b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/model/CIStageDefinition.java index 58517693919..a7e8f9419b3 100644 --- a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/model/CIStageDefinition.java +++ b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/model/CIStageDefinition.java @@ -30,7 +30,7 @@ public class CIStageDefinition implements RetryableStageDefinition { private final String master; private final String job; private final String propertyFile; - private final Integer buildNumber; + private final String buildNumber; private final BuildInfo buildInfo; private final boolean waitForCompletion; private final List expectedArtifacts; @@ -43,7 +43,7 @@ public CIStageDefinition( @JsonProperty("master") String master, @JsonProperty("job") String job, @JsonProperty("property") String propertyFile, - @JsonProperty("buildNumber") Integer buildNumber, + @JsonProperty("buildNumber") String buildNumber, @JsonProperty("buildInfo") BuildInfo buildInfo, @JsonProperty("waitForCompletion") Boolean waitForCompletion, @JsonProperty("expectedArtifacts") List expectedArtifacts, diff --git a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/model/ConcourseStageExecution.java b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/model/ConcourseStageExecution.java index 94457cdf236..c407bdb94ef 100644 --- a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/model/ConcourseStageExecution.java +++ b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/model/ConcourseStageExecution.java @@ -28,5 +28,5 @@ public class ConcourseStageExecution { private final String stageId; private final String jobName; - private final Integer buildNumber; + private final String buildNumber; } diff --git a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/tasks/WaitForConcourseJobCompletionTask.java b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/tasks/WaitForConcourseJobCompletionTask.java index 447bd1ed07b..aed83881844 100644 --- a/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/tasks/WaitForConcourseJobCompletionTask.java +++ b/orca-igor/src/main/java/com/netflix/spinnaker/orca/igor/tasks/WaitForConcourseJobCompletionTask.java @@ -51,7 +51,7 @@ public TaskResult execute(@Nonnull StageExecution stage) { Map buildMap = buildService.getBuild( - (Integer) stage.getContext().get("buildNumber"), stageDefinition.getMaster(), jobPath); + (String) stage.getContext().get("buildNumber"), stageDefinition.getMaster(), jobPath); ConcourseBuildInfo buildInfo = mapper.convertValue(buildMap, ConcourseBuildInfo.class); diff --git a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/BuildServiceSpec.groovy b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/BuildServiceSpec.groovy index 16c097f33ae..1ca6424eb14 100644 --- a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/BuildServiceSpec.groovy +++ b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/BuildServiceSpec.groovy @@ -24,7 +24,7 @@ class BuildServiceSpec extends Specification { IgorService igorService private static final MASTER = 'MASTER' - private static final BUILD_NUMBER = 123 + private static final BUILD_NUMBER = '123' private static final JOB_NAME = "name/with/slashes and spaces" private static final JOB_NAME_ENCODED = "name/with/slashes%20and%20spaces" private static final PARAMS = ['key': 'value'] diff --git a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/GetBuildArtifactsTaskSpec.groovy b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/GetBuildArtifactsTaskSpec.groovy index a81e8f4f52d..8633abdc531 100644 --- a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/GetBuildArtifactsTaskSpec.groovy +++ b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/GetBuildArtifactsTaskSpec.groovy @@ -30,7 +30,7 @@ class GetBuildArtifactsTaskSpec extends Specification { def buildService = Mock(BuildService) def testArtifact = Artifact.builder().name("my-artifact").build() - def BUILD_NUMBER = 4 + def BUILD_NUMBER = '4' def MASTER = "builds" def JOB = "orca" def PROPERTY_FILE = "my-file" diff --git a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/GetBuildPropertiesTaskSpec.groovy b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/GetBuildPropertiesTaskSpec.groovy index 43a57d7eaac..66144eb4437 100644 --- a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/GetBuildPropertiesTaskSpec.groovy +++ b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/GetBuildPropertiesTaskSpec.groovy @@ -39,7 +39,7 @@ class GetBuildPropertiesTaskSpec extends Specification { def artifactUtils = new ArtifactUtils(new ObjectMapper(), executionRepository, new ContextParameterProcessor()) def buildService = Mock(BuildService) - def BUILD_NUMBER = 4 + def BUILD_NUMBER = '4' def MASTER = "builds" def JOB = "orca" def PROPERTY_FILE = "sample.properties" @@ -52,7 +52,7 @@ class GetBuildPropertiesTaskSpec extends Specification { def "retrieves values from a property file if specified"() { given: - def stage = new StageExecutionImpl(execution, "jenkins", [master: MASTER, job: JOB, buildNumber: 4, propertyFile: PROPERTY_FILE]) + def stage = new StageExecutionImpl(execution, "jenkins", [master: MASTER, job: JOB, buildNumber: '4', propertyFile: PROPERTY_FILE]) and: 1 * buildService.getPropertyFile(BUILD_NUMBER, PROPERTY_FILE, MASTER, JOB) >> [val1: "one", val2: "two"] @@ -67,7 +67,7 @@ class GetBuildPropertiesTaskSpec extends Specification { def "retrieves complex from a property file"() { given: - def stage = new StageExecutionImpl(execution, "jenkins", [master: "builds", job: "orca", buildNumber: 4, propertyFile: PROPERTY_FILE]) + def stage = new StageExecutionImpl(execution, "jenkins", [master: "builds", job: "orca", buildNumber: '4', propertyFile: PROPERTY_FILE]) and: 1 * buildService.getPropertyFile(BUILD_NUMBER, PROPERTY_FILE, MASTER, JOB) >> diff --git a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorJenkinsJobTaskSpec.groovy b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorJenkinsJobTaskSpec.groovy index 3929879b3cd..7f7cc041dcb 100644 --- a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorJenkinsJobTaskSpec.groovy +++ b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorJenkinsJobTaskSpec.groovy @@ -38,7 +38,7 @@ class MonitorJenkinsJobTaskSpec extends Specification { @Unroll def "should return #taskStatus if job is #jobState"() { given: - def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: 4]) + def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: '4']) and: task.buildService = Stub(BuildService) { @@ -61,7 +61,7 @@ class MonitorJenkinsJobTaskSpec extends Specification { @Unroll def "should ignore job state when build is running"() { given: - def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: 4]) + def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: '4']) and: task.buildService = Stub(BuildService) { @@ -83,7 +83,7 @@ class MonitorJenkinsJobTaskSpec extends Specification { @Unroll def "should ignore job state when build is building"() { given: - def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: 4]) + def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: '4']) and: task.buildService = Stub(BuildService) { @@ -104,7 +104,7 @@ class MonitorJenkinsJobTaskSpec extends Specification { def "should return running status if igor call 404/500/503's"() { given: - def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: 4]) + def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: '4']) and: def exception = Stub(RetrofitError) { @@ -138,7 +138,7 @@ class MonitorJenkinsJobTaskSpec extends Specification { def "marks 'unstable' results as successful if explicitly configured to do so"() { given: def stage = new StageExecutionImpl(pipeline, "jenkins", - [master: "builds", job: "orca", buildNumber: 4, markUnstableAsSuccessful: markUnstableAsSuccessful]) + [master: "builds", job: "orca", buildNumber: '4', markUnstableAsSuccessful: markUnstableAsSuccessful]) and: @@ -159,7 +159,7 @@ class MonitorJenkinsJobTaskSpec extends Specification { @Unroll def 'provides breadcrumb stage error message in failure states'() { given: - def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: 4]) + def stage = new StageExecutionImpl(pipeline, "jenkins", [master: "builds", job: "orca", buildNumber: '4']) and: task.buildService = Stub(BuildService) { diff --git a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorWerckerJobStartedTaskSpec.groovy b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorWerckerJobStartedTaskSpec.groovy index 5b752d25565..1462ea037a2 100644 --- a/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorWerckerJobStartedTaskSpec.groovy +++ b/orca-igor/src/test/groovy/com/netflix/spinnaker/orca/igor/tasks/MonitorWerckerJobStartedTaskSpec.groovy @@ -28,7 +28,7 @@ class MonitorWerckerJobStartedTaskSpec extends Specification { def "should return running #expectedExecutionStatus if #result is not_built or #buildNumber missing"() { given: - def stage = new StageExecutionImpl(pipeline, "wercker", [master: "builds", job: "orca", queuedBuild: 4]) + def stage = new StageExecutionImpl(pipeline, "wercker", [master: "builds", job: "orca", queuedBuild: '4']) and: task.buildService = Stub(BuildService) { @@ -40,9 +40,9 @@ class MonitorWerckerJobStartedTaskSpec extends Specification { where: result | buildNumber | expectedExecutionStatus - "not_built" | 4 | ExecutionStatus.RUNNING + "not_built" | '4' | ExecutionStatus.RUNNING "success" | null | ExecutionStatus.RUNNING - "success" | 4 | ExecutionStatus.SUCCEEDED + "success" | '4' | ExecutionStatus.SUCCEEDED } } diff --git a/orca-web/src/main/groovy/com/netflix/spinnaker/orca/controllers/OperationsController.groovy b/orca-web/src/main/groovy/com/netflix/spinnaker/orca/controllers/OperationsController.groovy index c0a6cf9a646..0151dcdcecf 100644 --- a/orca-web/src/main/groovy/com/netflix/spinnaker/orca/controllers/OperationsController.groovy +++ b/orca-web/src/main/groovy/com/netflix/spinnaker/orca/controllers/OperationsController.groovy @@ -343,7 +343,7 @@ class OperationsController { if (trigger.propertyFile) { try { trigger.properties = buildService.getPropertyFile( - trigger.buildNumber as Integer, + trigger.buildNumber as String, trigger.propertyFile as String, trigger.master as String, trigger.job as String diff --git a/orca-web/src/main/java/com/netflix/spinnaker/orca/controllers/ConcourseController.java b/orca-web/src/main/java/com/netflix/spinnaker/orca/controllers/ConcourseController.java index ea20e10acb6..c5dabff5b39 100644 --- a/orca-web/src/main/java/com/netflix/spinnaker/orca/controllers/ConcourseController.java +++ b/orca-web/src/main/java/com/netflix/spinnaker/orca/controllers/ConcourseController.java @@ -25,7 +25,7 @@ public ConcourseController(Optional concourseService) { public void notifyConcourseExecution( @RequestParam("stageId") String stageId, @RequestParam("job") String job, - @RequestParam("buildNumber") Integer buildNumber) { + @RequestParam("buildNumber") String buildNumber) { concourseService.pushExecution(new ConcourseStageExecution(stageId, job, buildNumber)); } } diff --git a/orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/OperationsControllerSpec.groovy b/orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/OperationsControllerSpec.groovy index 8dd6c1b444a..85189811709 100644 --- a/orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/OperationsControllerSpec.groovy +++ b/orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/OperationsControllerSpec.groovy @@ -147,7 +147,7 @@ class OperationsControllerSpec extends Specification { where: master = "master" job = "job" - buildNumber = 1337 + buildNumber = '1337' requestedPipeline = [ application: "someapp", trigger : [ @@ -282,7 +282,7 @@ class OperationsControllerSpec extends Specification { master = "master" job = "job" - buildNumber = 1337 + buildNumber = '1337' requestedPipeline = [ trigger: [ type : "jenkins", @@ -317,7 +317,7 @@ class OperationsControllerSpec extends Specification { where: master = "qs-master" job = "qs-job" - buildNumber = 1337 + buildNumber = '1337' propertyFile = "foo.properties" requestedPipeline = [ trigger: [ @@ -343,7 +343,7 @@ class OperationsControllerSpec extends Specification { type : "jenkins", master : "master", job : "jon", - number : 1, + number : '1', properties: [ key1 : 'val1', key2 : 'val2', diff --git a/orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/TaskControllerSpec.groovy b/orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/TaskControllerSpec.groovy index 8dee3526af4..6f58199f081 100644 --- a/orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/TaskControllerSpec.groovy +++ b/orca-web/src/test/groovy/com/netflix/spinnaker/orca/controllers/TaskControllerSpec.groovy @@ -360,7 +360,7 @@ class TaskControllerSpec extends Specification { trigger: new GitTrigger("c681a6af-1096-4727-ac9e-70d3b2460228", "github", "spinnaker", "no-match", "orca", "push") ], [pipelineConfigId: "1", id: "test-3", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), - trigger: new JenkinsTrigger("master", "job", 1, "test-property-file") + trigger: new JenkinsTrigger("master", "job", '1', "test-property-file") ], [pipelineConfigId: "1", id: "test-4", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), trigger: new ArtifactoryTrigger("libs-demo-local") @@ -408,7 +408,7 @@ class TaskControllerSpec extends Specification { trigger: new GitTrigger("c681a6af-1096-4727-ac9e-70d3b2460228", "github", "spinnaker", "no-match", "orca", "push") ], [pipelineConfigId: "1", id: "test-4", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), - trigger: new JenkinsTrigger("master", "job", 1, "test-property-file") + trigger: new JenkinsTrigger("master", "job", '1', "test-property-file") ], [pipelineConfigId: "1", id: "test-5", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), trigger: new ArtifactoryTrigger("libs-demo-local") @@ -457,7 +457,7 @@ class TaskControllerSpec extends Specification { trigger: new GitTrigger("c681a6af-1096-4727-ac9e-70d3b2460228", "github", "spinnaker", "no-match", "orca", "push"), eventId: wrongEventId ], [pipelineConfigId: "1", id: "test-4", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), - trigger: new JenkinsTrigger("master", "job", 1, "test-property-file"), eventId: eventId + trigger: new JenkinsTrigger("master", "job", '1', "test-property-file"), eventId: eventId ], [pipelineConfigId: "1", id: "test-5", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), trigger: new ArtifactoryTrigger("libs-demo-local"), eventId: wrongEventId @@ -503,10 +503,10 @@ class TaskControllerSpec extends Specification { trigger: new GitTrigger("c681a6af-1096-4727-ac9e-70d3b2460228", "github", "spinnaker", "no-match", "orca", "push") ], [pipelineConfigId: "2", id: "test-3", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), - trigger: new JenkinsTrigger("master", "job", 1, "test-property-file") + trigger: new JenkinsTrigger("master", "job", '1', "test-property-file") ], [pipelineConfigId: "2", id: "test-4", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), - trigger: new JenkinsTrigger("master", "job", 1, "test-property-file") + trigger: new JenkinsTrigger("master", "job", '1', "test-property-file") ] ] @@ -545,7 +545,7 @@ class TaskControllerSpec extends Specification { trigger: new GitTrigger("c681a6af-1096-4727-ac9e-70d3b2460228", "github", "spinnaker", "no-match", "orca", "push") ], [name: "pipeline3", pipelineConfigId: "3", id: "test-3", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), - trigger: new JenkinsTrigger("master", "job", 1, "test-property-file") + trigger: new JenkinsTrigger("master", "job", '1', "test-property-file") ] ] @@ -581,7 +581,7 @@ class TaskControllerSpec extends Specification { trigger: new DockerTrigger("test-account", "test-repo", "1") ], [pipelineConfigId: "1", id: "test-2", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(2, HOURS).toEpochMilli(), - trigger: new JenkinsTrigger("master", "job", 1, "test-property-file") + trigger: new JenkinsTrigger("master", "job", '1', "test-property-file") ], [pipelineConfigId: "1", id: "test-3", startTime: clock.instant().minus(daysOfExecutionHistory, DAYS).minus(1, HOURS).toEpochMilli(), trigger: new DockerTrigger("test-account", "test-repo", "1")