2022-06-08 17:35:09 +00:00
|
|
|
pipeline {
|
2022-06-09 09:09:49 +00:00
|
|
|
agent none
|
2022-06-09 08:38:34 +00:00
|
|
|
|
2022-06-09 07:45:33 +00:00
|
|
|
stages {
|
2022-06-09 08:38:34 +00:00
|
|
|
stage('Install') {
|
2022-06-09 09:09:49 +00:00
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'node:lts-bullseye-slim'
|
|
|
|
args '-p 3000:3000'
|
|
|
|
}
|
|
|
|
}
|
2022-06-09 07:45:33 +00:00
|
|
|
steps {
|
2022-06-09 08:38:34 +00:00
|
|
|
sh 'npm install'
|
2022-06-09 09:09:49 +00:00
|
|
|
stash includes: 'node_modules/', name: 'node_modules'
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 08:38:34 +00:00
|
|
|
|
|
|
|
stage('Test') {
|
2022-06-09 09:12:37 +00:00
|
|
|
stage('Static code analysis') {
|
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'node:lts-bullseye-slim'
|
|
|
|
args '-p 3000:3000'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
unstash 'node_modules'
|
|
|
|
sh 'npm run-script lint'
|
|
|
|
stash includes: 'node_modules/', name: 'node_modules'
|
|
|
|
}
|
2022-06-09 09:09:49 +00:00
|
|
|
}
|
2022-06-09 09:12:37 +00:00
|
|
|
stage('Unit tests') {
|
|
|
|
agent {
|
|
|
|
docker {
|
|
|
|
image 'node:lts-bullseye-slim'
|
|
|
|
args '-p 3000:3000'
|
|
|
|
}
|
2022-06-09 08:38:34 +00:00
|
|
|
}
|
2022-06-09 09:12:37 +00:00
|
|
|
steps {
|
|
|
|
unstash 'node_modules'
|
|
|
|
sh 'npm run-script test'
|
|
|
|
stash includes: 'node_modules/', name: 'node_modules'
|
2022-06-09 08:38:34 +00:00
|
|
|
}
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 08:38:34 +00:00
|
|
|
|
|
|
|
stage('Build') {
|
2022-06-09 07:45:33 +00:00
|
|
|
steps {
|
2022-06-09 09:09:49 +00:00
|
|
|
unstash 'node_modules'
|
2022-06-09 08:38:34 +00:00
|
|
|
sh 'npm run-script build'
|
2022-06-09 08:42:23 +00:00
|
|
|
stash includes: 'dist/', name: 'dist'
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 08:38:34 +00:00
|
|
|
|
|
|
|
stage('Build Docker Image') {
|
|
|
|
// environment {
|
|
|
|
// DOCKER_PUSH = credentials('docker_push')
|
|
|
|
// }
|
2022-06-09 08:06:50 +00:00
|
|
|
steps {
|
2022-06-09 08:20:46 +00:00
|
|
|
unstash 'dist'
|
2022-06-09 08:38:34 +00:00
|
|
|
// sh 'docker build -t $DOCKER_PUSH_URL/frontend .'
|
|
|
|
sh 'docker build .'
|
|
|
|
// sh 'docker login -u $DOCKER_PUSH_USR -p $DOCKER_PUSH_PSW $DOCKER_PUSH_URL'
|
|
|
|
// sh 'docker push $DOCKER_PUSH_URL/frontend'
|
2022-06-09 08:06:50 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-09 07:45:33 +00:00
|
|
|
}
|
|
|
|
}
|