From 6ae35d012bc52083897c8459d108d4e5507256b5 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Sat, 31 Aug 2024 17:06:51 +0200 Subject: [PATCH] Dry-run pipeline1C test --- build.gradle.kts | 44 +++++++++++-------- test/integration/groovy/pipeline1cTest.groovy | 33 ++++++++++++++ 2 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 test/integration/groovy/pipeline1cTest.groovy diff --git a/build.gradle.kts b/build.gradle.kts index c3fc0d7e..68b71f58 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 { @@ -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 { @@ -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) @@ -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") } } diff --git a/test/integration/groovy/pipeline1cTest.groovy b/test/integration/groovy/pipeline1cTest.groovy new file mode 100644 index 00000000..5930571d --- /dev/null +++ b/test/integration/groovy/pipeline1cTest.groovy @@ -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)) + } + +}