Skip to content

Commit

Permalink
Revert spock version update (#212)
Browse files Browse the repository at this point in the history
* Revert spock version update

* Use maven from jenkins tools
  • Loading branch information
c00ler authored Nov 3, 2022
1 parent 88a0112 commit 028b313
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ dependencies {
testImplementation 'org.jenkins-ci.plugins:timestamper:1.8.10'
testImplementation 'org.jenkins-ci.plugins:pipeline-stage-step:2.3'
testImplementation 'org.jenkins-ci.plugins:pipeline-maven:3.10.0'
testImplementation 'org.spockframework:spock-core:2.3-groovy-2.5'
testImplementation 'org.spockframework:spock-core:1.3-groovy-2.4'

testImplementation('io.ratpack:ratpack-groovy-test:1.9.0') {
exclude group: 'com.google.guava', module: 'guava'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ class BuildScanInjectionMavenIntegrationTest extends BaseInjectionIntegrationTes
def 'build scan is published without GE plugin with simple pipeline'() {
given:
createSlaveAndTurnOnInjection()
def mavenInstallationName = setupMavenInstallation()

def pipelineJob = j.createProject(WorkflowJob)
pipelineJob.setDefinition(new CpsFlowDefinition(simplePipeline(), false))
pipelineJob.setDefinition(new CpsFlowDefinition(simplePipeline(mavenInstallationName), false))

when:
def build = j.buildAndAssertSuccess(pipelineJob)
Expand All @@ -160,11 +162,13 @@ class BuildScanInjectionMavenIntegrationTest extends BaseInjectionIntegrationTes
def 'access key is injected into the simple pipeline'() {
given:
createSlaveAndTurnOnInjection()
def mavenInstallationName = setupMavenInstallation()

withInjectionConfig {
accessKey = Secret.fromString("invalid")
}
def pipelineJob = j.createProject(WorkflowJob)
pipelineJob.setDefinition(new CpsFlowDefinition(simplePipeline(), false))
pipelineJob.setDefinition(new CpsFlowDefinition(simplePipeline(mavenInstallationName), false))

when:
def build = j.buildAndAssertStatus(Result.FAILURE, pipelineJob)
Expand Down Expand Up @@ -337,8 +341,10 @@ node {
}

createSlave('foo')
def mavenInstallationName = setupMavenInstallation()

def pipelineJob = j.createProject(WorkflowJob)
pipelineJob.setDefinition(new CpsFlowDefinition(simplePipeline(), false))
pipelineJob.setDefinition(new CpsFlowDefinition(simplePipeline(mavenInstallationName), false))

when:
def build = j.buildAndAssertSuccess(pipelineJob)
Expand All @@ -353,8 +359,10 @@ node {
def 'build scan is not published when global MAVEN_OPTS is set'() {
given:
def slave = createSlaveAndTurnOnInjection()
def mavenInstallationName = setupMavenInstallation()

def pipelineJob = j.createProject(WorkflowJob)
pipelineJob.setDefinition(new CpsFlowDefinition(simplePipeline(), false))
pipelineJob.setDefinition(new CpsFlowDefinition(simplePipeline(mavenInstallationName), false))
withGlobalEnvVars {
put('MAVEN_OPTS', '-Dfoo=bar')
}
Expand Down Expand Up @@ -423,11 +431,12 @@ node {
}
}

private static String simplePipeline() {
private static String simplePipeline(String mavenInstallationName) {
"""
node {
stage('Build') {
node('foo') {
withEnv(["PATH+MAVEN=\${tool '$mavenInstallationName'}/bin"]) {
writeFile file: 'pom.xml', text: '$POM_XML'
if (isUnix()) {
sh "env"
Expand All @@ -436,6 +445,7 @@ node {
bat "set"
bat "mvn package -B"
}
}
}
}
}
Expand Down

0 comments on commit 028b313

Please sign in to comment.