Files
JenkinsGoTest/jenkinsfile
Bram Prieshof 67c33075c5
Some checks failed
GiteaTest/JenkinsGoTest/pipeline/head There was a failure building this commit
added go to tools
2021-01-05 22:13:21 +01:00

43 lines
1.8 KiB
Plaintext

pipeline {
agent { label 'linux' }
tool name: 'Latest', type: 'go'
options {
buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10'))
}
stages {
stage('Build') {
steps {
// Build SH script
sh '''go build -o "HelloWorld-amd64-$BUILD_DISPLAY_NAME"
cp HelloWorld-amd64-$BUILD_DISPLAY_NAME HelloWorld-amd64-Latest
'''
// Archive Build file
// Local
archiveArtifacts artifacts: "HelloWorld-amd64-$BUILD_DISPLAY_NAME", onlyIfSuccessful: true
//Remote sftp server
sshPublisher(publishers: [sshPublisherDesc(configName: 'centnas', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '/$JOB_NAME', remoteDirectorySDF: false, removePrefix: '', sourceFiles: 'HelloWorld-amd64*')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
// Cleaning WorkSpace
cleanWs()
}
}
}
post {
success {
echo 'Build successful'
}
failure {
echo 'Build Failed'
// Send To person to make commit
//emailext body: '$DEFAULT_CONTENT', recipientProviders: [culprits()], subject: '$DEFAULT_SUBJECT'
// Send To static addres
emailext attachLog: true,body: '$DEFAULT_CONTENT', subject: '$DEFAULT_SUBJECT', to: 'bram@bprieshof.nl'
}
unstable {
echo 'Build unstable'
}
changed {
echo 'Pipeline has changed'
}
}
}