From bf355cbc097bf2f2dfc72ef21da4f2938d15b9cb Mon Sep 17 00:00:00 2001 From: Bram Prieshof Date: Tue, 5 Jan 2021 22:28:31 +0100 Subject: [PATCH] added jenkinsfile for node --- jenkinsfile | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 jenkinsfile diff --git a/jenkinsfile b/jenkinsfile new file mode 100644 index 0000000..a7736d4 --- /dev/null +++ b/jenkinsfile @@ -0,0 +1,46 @@ +pipeline { + agent { label 'linux' } + tools { + nodejs 'Latest' + } + options { + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '10')) + } + stages { + stage('Build') { + steps { + // Build SH script + sh '''echo $PATH + node --version + npm --version + ''' + // 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' + } + } +} \ No newline at end of file