Added Jenkinsfile 6
This commit is contained in:
14
Jenkinsfile
vendored
14
Jenkinsfile
vendored
@@ -22,12 +22,20 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
node {
|
node {
|
||||||
|
|
||||||
|
sh 'git name-rev --name-only HEAD > GIT_BRANCH'
|
||||||
|
sh 'cat GIT_BRANCH'
|
||||||
|
git_branch = readFile('GIT_BRANCH').trim().substring(0, 10)
|
||||||
|
env.GIT_BRANCH = git_branch
|
||||||
|
sh 'rm GIT_BRANCH'
|
||||||
|
|
||||||
env.NODEJS_HOME = "${tool 'node14'}"
|
env.NODEJS_HOME = "${tool 'node14'}"
|
||||||
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
|
||||||
|
env.DOCKER_NAME="web/wannistesvorbei:${env.BRANCH_NAME}-${env.GIT_COMMIT}"
|
||||||
|
|
||||||
def customImage
|
def customImage
|
||||||
|
|
||||||
|
|
||||||
currentBuild.result = "UNSTABLE"
|
currentBuild.result = "SUCCESS"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -51,7 +59,7 @@ node {
|
|||||||
|
|
||||||
stage('Build Docker'){
|
stage('Build Docker'){
|
||||||
|
|
||||||
customImage = docker.build("web/wannistesvorbei:${env.BRANCH_NAME}-${env.GIT_COMMIT}")
|
customImage = docker.build(env.DOCKER_NAME)
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Deploy'){
|
stage('Deploy'){
|
||||||
@@ -70,8 +78,6 @@ node {
|
|||||||
|
|
||||||
stage('Cleanup'){
|
stage('Cleanup'){
|
||||||
|
|
||||||
currentBuild.result = "SUCCESS"
|
|
||||||
|
|
||||||
echo 'prune and cleanup'
|
echo 'prune and cleanup'
|
||||||
sh 'npm prune'
|
sh 'npm prune'
|
||||||
sh 'rm node_modules -rf'
|
sh 'rm node_modules -rf'
|
||||||
|
|||||||
Reference in New Issue
Block a user