From a0d90e3b94edf767cc14223aa8dae0156c8a61c5 Mon Sep 17 00:00:00 2001 From: "Lennon Benedict D. Jansuy" <45531522+lenn0n@users.noreply.github.com> Date: Sat, 21 Sep 2024 14:40:05 +0800 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 7c712b7..469c71d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,22 +5,22 @@ pipeline { stage("Test Application"){ steps { nodejs(nodeJSInstallationName: 'nodejs') { - sh 'npm run test' + bat 'npm run test' } } } stage("Build Application"){ steps { nodejs(nodeJSInstallationName: 'nodejs') { - sh 'npm install' - sh 'npm run build' + bat 'npm install' + bat 'npm run build' } } } stage("Dockerize Application"){ steps { - sh 'docker build -t webapp .' - sh 'docker images' + bat 'docker build -t webapp .' + bat 'docker images' } } stage("Push To DockerHub"){ @@ -30,20 +30,20 @@ pipeline { usernameVariable: "USERNAME", passwordVariable: "PASSWORD" )]) { - sh 'docker login --username $USERNAME -- password PASSWORD' - sh 'docker push webapp:dev' + bat 'docker login --username $USERNAME -- password PASSWORD' + bat 'docker push webapp:dev' } } } stage("Push To Github"){ steps { - sh 'git config --global user.email "auto@jenkins.com"' - sh 'git config --global user.name "Jenkins"' - sh 'git remote add jenkins https://github.com/lenn0n/jenkins-post-build.git' - sh 'git add .' - sh "git commit -m 'Commit from Jenkins'" + bat 'git config --global user.email "auto@jenkins.com"' + bat 'git config --global user.name "Jenkins"' + bat 'git remote add jenkins https://github.com/lenn0n/jenkins-post-build.git' + bat 'git add .' + bat "git commit -m 'Commit from Jenkins'" withCredentials([gitUsernamePassword(credentialsId: 'gh-cred', gitToolName: 'Default')]) { - sh "git push -u origin HEAD:jenkins" + bat "git push -u origin HEAD:jenkins" } } }