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'
}

6
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'
}
} }

32
predeploy/Jenkinsfile vendored
View File

@ -1,22 +1,18 @@
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()) { def tag = sh(returnStdout: true, script: "git tag --contains").trim()
def tag = sh(returnStdout: true, script: "git tag --contains").trim() echo 'found tag ' + tag
echo 'found tag ' + tag sh "cd dist ; echo 'mkdir ${tag}; mv ./master/* ./${tag}; rm -r -d ./master; rm version.sh' > version.sh"
sh "cd dist ; echo 'mkdir ${tag}; mv ./master/* ./${tag}; rm -r -d ./master; rm version.sh' > version.sh" } else {
} else { echo 'tag not found'
echo 'tag not found' sh "cd dist ; echo 'rm version.sh' > version.sh"
sh "cd dist ; echo 'rm version.sh' > version.sh"
}
}
}
stage ('archiving') {
steps {
// Archive the build output artifacts.
archiveArtifacts artifacts: 'dist/*'
} }
} }
} }
stage ('archiving') {
// Archive the build output artifacts.
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'
}
}

18
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 --access public'
sh 'npm publish' } else {
} else { echo 'tag not found'
echo 'tag not found'
}
} }
} }
} }

14
stats/Jenkinsfile vendored
View File

@ -1,10 +1,8 @@
stage('stats') { stage('stats') {
steps { sh 'node -v'
sh 'node -v' sh 'npm -v'
sh 'npm -v' sh 'ls -a'
sh 'ls -a' sh 'df -h'
sh 'df -h' 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')
}
}
}
}

6
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'
}
} }

6
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'
}
} }