This commit is contained in:
Primakov Alexandr Alexandrovich 2020-03-02 22:47:41 +03:00
parent b72fecbbec
commit 7d73129731
11 changed files with 76 additions and 61 deletions

View File

@ -1,5 +1,3 @@
stage ('production build') { stage ('production build') {
steps {
sh 'npm run build' sh 'npm run build'
} }
}

View File

@ -1,5 +1,3 @@
stage ('production build') { stage ('production build') {
steps {
sh 'npm run build:prod' sh 'npm run build:prod'
} }
}

5
clean-all/Jenkinsfile vendored Normal file
View File

@ -0,0 +1,5 @@
stage('clean-all') {
sh 'rm -rf .[!.]*'
sh 'rm -rf ./*'
sh 'ls -a'
}

2
install/Jenkinsfile vendored
View File

@ -1,6 +1,4 @@
stage('install') { stage('install') {
steps {
echo 'starting installing' echo 'starting installing'
sh 'npm install' sh 'npm install'
} }
}

View File

@ -1,5 +1,4 @@
stage ('predeploy') { stage ('predeploy') {
steps {
echo 'checking tag' echo 'checking tag'
script { script {
if (sh(returnStdout: true, script: "git tag --contains").trim()) { if (sh(returnStdout: true, script: "git tag --contains").trim()) {
@ -14,9 +13,6 @@ stage ('predeploy') {
} }
stage ('archiving') { stage ('archiving') {
steps {
// Archive the build output artifacts. // Archive the build output artifacts.
archiveArtifacts artifacts: 'dist/*' archiveArtifacts artifacts: 'dist/*'
} }
}
}

7
prepare/Jenkinsfile vendored
View File

@ -1,7 +0,0 @@
stage('prepare') {
steps {
sh 'rm -rf .[!.]*'
sh 'rm -rf ./*'
sh 'ls -a'
}
}

4
publish/Jenkinsfile vendored
View File

@ -1,14 +1,12 @@
stage ('publish') { stage ('publish') {
steps {
echo 'checking tag' echo 'checking tag'
script { script {
def tag = sh(returnStdout: true, script: "git tag --contains").trim() def tag = sh(returnStdout: true, script: "git tag --contains").trim()
if (tag) { if (tag) {
echo 'found tag ' + tag echo 'found tag ' + tag
sh 'npm publish' sh 'npm publish --access public'
} else { } else {
echo 'tag not found' echo 'tag not found'
} }
} }
} }
}

2
stats/Jenkinsfile vendored
View File

@ -1,5 +1,4 @@
stage('stats') { stage('stats') {
steps {
sh 'node -v' sh 'node -v'
sh 'npm -v' sh 'npm -v'
sh 'ls -a' sh 'ls -a'
@ -7,4 +6,3 @@ stage('stats') {
sh 'free -m' sh 'free -m'
sh 'vmstat -s' sh 'vmstat -s'
} }
}

35
template Normal file
View File

@ -0,0 +1,35 @@
def clean () {
sh 'rm -rf .[!.]*'
sh 'rm -rf ./*'
sh 'ls -a'
}
def clone (String repoPath, String folder) {
echo 'cloning...'
sh "git clone ${repoPath}.git tmp"
sh "mkdir -p ${folder}"
sh "mv ./tmp/* ./${folder}"
sh "mv ./tmp/.[!.]* ./${folder}"
}
def loadScript (String scriptName) {
load "tmp--jfiles/${scriptName}/Jenkinsfile"
}
pipeline {
agent any
stages {
stage('processing') {
steps {
clean()
clone('https://aaprimakov@bitbucket.org/jsadvance20201/jenkins', 'tmp--jfiles')
loadScript('stats')
clone('https://aaprimakov@bitbucket.org/jsadvance20201/dev-server', './')
loadScript('publish')
loadScript('clean-all')
}
}
}
}

2
ui/Jenkinsfile vendored
View File

@ -1,6 +1,4 @@
stage('ui tests') { stage('ui tests') {
steps {
echo 'ui tests' echo 'ui tests'
sh 'npm run test:ui' sh 'npm run test:ui'
} }
}

2
unit/Jenkinsfile vendored
View File

@ -1,6 +1,4 @@
stage('unit tests') { stage('unit tests') {
steps {
echo 'runing tests...' echo 'runing tests...'
sh 'npm run test' sh 'npm run test'
} }
}