From 3013f331611293426013f8f4c3a302ef132c3d79 Mon Sep 17 00:00:00 2001 From: subbutony11 <105411669+subbutony11@users.noreply.github.com> Date: Thu, 16 Jun 2022 12:39:24 +0530 Subject: [PATCH] Create Jenkinsfile --- Jenkinsfile | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..78fa1ee --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,58 @@ +#!groovy + +properties( + [ + [$class: 'BuildDiscarderProperty', strategy: + [$class: 'LogRotator', artifactDaysToKeepStr: '14', artifactNumToKeepStr: '5', daysToKeepStr: '30', numToKeepStr: '60']], + pipelineTriggers( + [ + pollSCM('H/15 * * * *'), + cron('@daily'), + ] + ) + ] +) +node { + stage('Checkout') { + //disable to recycle workspace data to save time/bandwidth + deleteDir() + checkout scm + + //enable for commit id in build number + //env.git_commit_id = sh returnStdout: true, script: 'git rev-parse HEAD' + //env.git_commit_id_short = env.git_commit_id.take(7) + //currentBuild.displayName = "#${currentBuild.number}-${env.git_commit_id_short}" + } + + stage('NPM Install') { + withEnv(["NPM_CONFIG_LOGLEVEL=warn"]) { + sh 'npm install' + } + } + + stage('Test') { + withEnv(["CHROME_BIN=/usr/bin/chromium-browser"]) { + sh 'ng test --progress=false --watch false' + } + junit '**/test-results.xml' + } + + stage('Lint') { + sh 'ng lint' + } + + stage('Build') { + milestone() + sh 'ng build --prod --aot --sm --progress=false' + } + + stage('Archive') { + sh 'tar -cvzf dist.tar.gz --strip-components=1 dist' + archive 'dist.tar.gz' + } + + stage('Deploy') { + milestone() + echo "Deploying..." + } +}