Skip to content

Commit

Permalink
Dry-run pipeline1C test
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Aug 31, 2024
1 parent b063905 commit 6ae35d0
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 18 deletions.
44 changes: 26 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugins {
groovy
jacoco
id("com.mkobit.jenkins.pipelines.shared-library") version "0.10.1"
id("com.github.ben-manes.versions") version "0.28.0"
id("org.jenkins-ci.jpi") version "0.38.0" apply false
id("com.github.ben-manes.versions") version "0.51.0"
id("org.jenkins-ci.jpi") version "0.52.0-rc.1" apply false
}

repositories {
Expand All @@ -28,13 +28,14 @@ tasks {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

val junitVersion = "5.6.1"
val junitVersion = "5.11.0"
val spockVersion = "1.3-groovy-2.4"
val groovyVersion = "2.4.19"
val slf4jVersion = "1.8.0-beta4"
val groovyVersion = "2.4.21"
val slf4jVersion = "2.0.16"
val jsonschemaVersion = "4.36.0"

dependencies {
Expand All @@ -48,8 +49,8 @@ dependencies {
testImplementation("org.junit.jupiter", "junit-jupiter-api", junitVersion)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junitVersion)

testImplementation("org.assertj", "assertj-core", "3.15.0")
testImplementation("org.mockito", "mockito-core", "5.11.0")
testImplementation("org.assertj", "assertj-core", "3.26.3")
testImplementation("org.mockito", "mockito-core", "5.13.0")

testImplementation("org.slf4j", "slf4j-api", slf4jVersion)
testImplementation("org.slf4j", "slf4j-simple", slf4jVersion)
Expand Down Expand Up @@ -102,20 +103,27 @@ sharedLibrary {
coreVersion.set(jenkinsIntegration.downloadDirectory.file("core-version.txt").map { it.asFile.readText().trim() })
// TODO: retrieve downloaded plugin resource
pluginDependencies {
dependency("org.jenkins-ci.plugins", "pipeline-build-step", "2.12")
dependency("org.jenkins-ci.plugins", "pipeline-utility-steps", "2.8.0")
dependency("org.jenkins-ci.plugins", "git", "4.4.4")
dependency("org.jenkins-ci.plugins", "http_request", "1.15")
dependency("org.6wind.jenkins", "lockable-resources", "2.7")
dependency("ru.yandex.qatools.allure", "allure-jenkins-plugin", "2.28.1")
val declarativePluginsVersion = "1.6.0"
dependency("org.jenkins-ci.plugins", "pipeline-build-step", "540.vb_e8849e1a_b_d8")
dependency("org.jenkins-ci.plugins", "pipeline-utility-steps", "2.17.0")
dependency("org.jenkins-ci.plugins", "git", "5.2.2")
dependency("org.jenkins-ci.plugins", "http_request", "1.19")
dependency("org.jenkins-ci.plugins", "timestamper", "1.27")
dependency("org.jenkins-ci.plugins", "credentials", "1371.vfee6b_095f0a_3")
dependency("org.jenkins-ci.plugins", "token-macro", "400.v35420b_922dcb_")
dependency("org.jenkins-ci.plugins.workflow", "workflow-step-api", "678.v3ee58b_469476")

dependency("org.jenkins-ci.modules", "sshd", "3.329.v668e35efc720")

dependency("org.6wind.jenkins", "lockable-resources", "1255.vf48745da_35d0")
dependency("ru.yandex.qatools.allure", "allure-jenkins-plugin", "2.31.1")
dependency("io.jenkins.blueocean", "blueocean-pipeline-api-impl", "1.27.14")
dependency("sp.sd", "file-operations", "266.v9d4e1eb_235b_a_")

val declarativePluginsVersion = "2.2214.vb_b_34b_2ea_9b_83"

dependency("org.jenkinsci.plugins", "pipeline-model-api", declarativePluginsVersion)
dependency("org.jenkinsci.plugins", "pipeline-model-declarative-agent", "1.1.1")
dependency("org.jenkinsci.plugins", "pipeline-model-definition", declarativePluginsVersion)
dependency("org.jenkinsci.plugins", "pipeline-model-extensions", declarativePluginsVersion)
dependency("io.jenkins.blueocean", "blueocean-pipeline-api-impl", "1.25.3")
dependency("sp.sd", "file-operations", "214.v2e7dc7f25757")
dependency("org.jenkinsci.plugins", "pipeline-model-declarative-agent", "1.1.1")
}
}
33 changes: 33 additions & 0 deletions test/integration/groovy/pipeline1cTest.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import hudson.model.Label
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition
import org.jenkinsci.plugins.workflow.job.WorkflowJob
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.jvnet.hudson.test.JenkinsRule

class pipeline1cTest {

@Rule
public JenkinsRule rule = new JenkinsRule()

@Before
void configureGlobalGitLibraries() {
RuleBootstrapper.setup(rule)
}

@Test
void "pipeline1C should do something"() {
def pipeline = '''
pipeline1C()
'''.stripIndent()

rule.createSlave(Label.get("agent"))
final CpsFlowDefinition flow = new CpsFlowDefinition(pipeline, true)
final WorkflowJob workflowJob = rule.createProject(WorkflowJob, 'project')
workflowJob.definition = flow

rule.assertLogContains('(pre-stage)', rule.buildAndAssertSuccess(workflowJob))
}

}

0 comments on commit 6ae35d0

Please sign in to comment.