environment test

This commit is contained in:
crusader 2023-02-01 23:47:29 +00:00
parent a62cee565c
commit b66ccf5202
2 changed files with 12 additions and 5 deletions

7
Jenkinsfile vendored
View File

@ -46,12 +46,15 @@ podTemplate(
stage('Test') {
try {
container('gradle') {
def projectDetails = sh(returnStdout: true, script: "gradle -q projectDetails").trim()
def projectName = sh(returnStdout: true, script: "gradle -q projectName").trim()
def projectVersion = sh(returnStdout: true, script: "gradle -q projectVersion").trim()
env.PROJECT_NAME = projectName
env.PROJECT_VERSION = projectVersion
sh """
pwd
echo "GIT_BRANCH=${gitBranch}" >> /etc/environment
echo "GIT_COMMIT=${gitCommit}" >> /etc/environment
echo "${projectDetails}" >> /etc/environment
gradle test
"""
}

View File

@ -21,9 +21,13 @@ tasks.named('test') {
useJUnitPlatform()
}
task projectDetails {
task projectName {
doLast {
println "PROJECT_NAME=${project.name}"
println "PROJECT_VERSION=${project.version}"
println "${project.name}"
}
}
task projectVersion {
doLast {
println "${project.version}"
}
}