diff --git a/Jenkinsfile b/Jenkinsfile index e3f2a21..8ce5cc4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,12 +1,53 @@ pipeline { agent any + environment { + VERSION_STR = "$BUILD_NUMBER" + DOWNLOAD_STR = "http://192.168.1.200:8082/repository/zip-repo/shared-compendia/${BUILD_NUMBER}/shared-compendia-${BUILD_NUMBER}.zip" + } + stages { - stage('test') { + stage('modifying module.json') { steps { - sh '/bin/true' - sh 'ls -la' + sh "sed -i 's_\"version\":.*\$_\"version\": \"${BUILD_NUMBER}\",_;s_\"download\":.*\$_\"download\": \"${DOWNLOAD_STR}\",_' module.json" + } + } + stage('copy module.json') { + steps { + sh "cp -f module.json src/module.json" + } + } + stage('archive artifacts') { + steps { + archiveArtifacts artifacts: 'module.json', fingerprint: true + } + } + stage('generate archive') { + steps { + zip zipFile: "shared-compendia-${BUILD_NUMBER}.zip", archive: false, overwrite: true, dir: "src" + } + } + stage('upload artifact') { + steps { + nexusArtifactUploader ( + artifacts: [ + [ + artifactId: "shared-compendia", + classifier: '', + file: "shared-compendia-${BUILD_NUMBER}.zip", + type: 'zip' + ] + ], + credentialsId: '190405b3-4cdf-4475-85ed-a3a7713cb6eb', + groupId: 'shared-compendia', + nexusUrl: '192.168.1.200:8082', + nexusVersion: 'nexus3', + protocol: 'http', + repository: 'zip-repo', + version: '$BUILD_NUMBER' + ) + sh 'curl --user jenkins:12345678 --upload-file module.json http://192.168.1.200:8082/repository/zip-repo/shared-compendia/module.json' } } } -} \ No newline at end of file +}