pipeline { agent any options { buildDiscarder( logRotator( numToKeepStr: '5' ) ) } tools { jdk 'jdk8' } stages { stage("Build on Linux") { agent { label 'linux' } steps { script { sh ''' #!/bin/bash chmod +x gradlew ./gradlew build publish ''' } } post { always { archiveArtifacts artifacts: "build/libs/*.jar" deleteDir() } } } } }