From a8778adaa8a3b6f2eb0ce706c65e12e38ab7e6dd Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 1 Feb 2023 22:39:33 +0000 Subject: [PATCH] environment test --- Jenkinsfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 8e8f221..7962e14 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,23 @@ +import org.gradle.tooling.GradleConnector +import org.gradle.tooling.ProjectConnection +import org.gradle.tooling.model.GradleProject + +def getIncludedProjectNamesMap(Project project) { + def projectNamesMap = new HashMap() + project.gradle.includedBuilds.each { includedBuild -> + ProjectConnection connection = GradleConnector.newConnector() + .forProjectDirectory(includedBuild.projectDir) + .connect() + GradleProject includedProject = connection.getModel(GradleProject.class); + def name = includedProject.getName(); + connection.close(); + + projectNamesMap.put includedBuild.name, name; + } + + return projectNamesMap +} + def label = "worker-${UUID.randomUUID().toString()}" podTemplate( @@ -45,6 +65,7 @@ podTemplate( def app_version_value = sh(returnStdout: true, script: "cat build.gradle | grep -o 'version = [^,]*'").trim() sh "echo Project in version value: $app_version_value" def app_version = app_version_value.split(/=/)[1].trim() + println getIncludedProjectNamesMap(project) stage('Test') { try {