Update Jenkinsfile to build inside container
Gitea/Java-Installer/pipeline/head There was a failure building this commit
Details
Gitea/Java-Installer/pipeline/head There was a failure building this commit
Details
parent
b683978039
commit
b24dbd1dfb
|
@ -1,23 +1,33 @@
|
||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
|
||||||
|
|
||||||
tools {
|
agent {
|
||||||
jdk '17'
|
// Use the kubernetes agent
|
||||||
|
kubernetes {
|
||||||
|
label 'java-17-gradle-8'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
container('java-17-gradle-8') {
|
||||||
withCredentials([
|
|
||||||
file(credentialsId: 'MAVEN_PUBLISH_SONATYPE_GRADLE_PROPERTIES', variable: 'SONATYPE_CREDENTIALS')
|
script {
|
||||||
]) {
|
|
||||||
// Build and publish
|
if (env.GIT_BRANCH != "main" && env.GIT_BRANCH != "master") {
|
||||||
sh 'cp \${SONATYPE_CREDENTIALS} ./gradle.properties'
|
// When not on master only test to build the installer
|
||||||
sh './gradlew --no-build-cache build publishToMavenLocal publishToSonatype closeAndReleaseSonatypeStagingRepository --warning-mode all'
|
sh 'gradle --no-build-cache build'
|
||||||
sh 'rm ./gradle.properties'
|
} else {
|
||||||
|
withCredentials([
|
||||||
|
file(credentialsId: 'MAVEN_PUBLISH_SONATYPE_GRADLE_PROPERTIES', variable: 'SONATYPE_CREDENTIALS')
|
||||||
|
]) {
|
||||||
|
// Build and publish
|
||||||
|
sh 'cp \${SONATYPE_CREDENTIALS} ./gradle.properties'
|
||||||
|
sh 'gradle --no-build-cache build publishToMavenLocal publishToSonatype closeAndReleaseSonatypeStagingRepository --warning-mode all'
|
||||||
|
sh 'rm ./gradle.properties'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +35,7 @@ pipeline {
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
archiveArtifacts artifacts: 'release/installer-*', fingerprint: true
|
echo "Build successfull"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean after build
|
// Clean after build
|
||||||
|
|
Loading…
Reference in New Issue