Last active
March 5, 2020 19:35
-
-
Save justindonnaruma/a5b7574cc66b756a9924b8fbb02d4c91 to your computer and use it in GitHub Desktop.
Jenkinsfile for NodeJS project pushing to Artifactory as a tarball.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline { | |
agent any | |
environment { | |
def uploadSpec = """{ | |
"files": [ | |
{ | |
"pattern": "dist/*", | |
"target": "repo/folder/" | |
} | |
] | |
}""" | |
} | |
stages { | |
stage('Build') { | |
steps { | |
echo 'Building..' | |
sh 'npm install --quiet' | |
} | |
} | |
stage('Test') { | |
steps { | |
echo 'Run Unit Tests..' | |
sh 'npm test' | |
} | |
} | |
stage('Publish') { | |
steps { | |
echo 'Build the artifacts..' | |
sh 'npx oclif-dev pack' | |
echo 'Publish the artifacts..' | |
script | |
{ | |
//def server = Artifactory.newServer('http://10.213.243.17:8081/artifactory', 'admin', 'art@123') | |
def server = Artifactory.server 'Artifac_dev_server1' | |
server.bypassProxy = true | |
server.upload(uploadSpec) | |
echo 'Uploaded the file to Jfrog Artifactory successfully' | |
} | |
} | |
} | |
stage('Deploy') { | |
steps { | |
echo 'TO BE BUILT' | |
} | |
} | |
stage('Notify') { | |
steps { | |
echo 'Mail Notification...' | |
mail body: 'Project build successful for job named testpipeline-1', | |
from: '[email protected]', | |
subject: 'project build successful', | |
to: '[email protected]' | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment