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') {
steps {
sh 'npm run build'
}
sh 'npm run build'
}

View File

@ -1,5 +1,3 @@
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') {
steps {
echo 'starting installing'
sh 'npm install'
}
echo 'starting installing'
sh 'npm install'
}

32
predeploy/Jenkinsfile vendored
View File

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

14
stats/Jenkinsfile vendored
View File

@ -1,10 +1,8 @@
stage('stats') {
steps {
sh 'node -v'
sh 'npm -v'
sh 'ls -a'
sh 'df -h'
sh 'free -m'
sh 'vmstat -s'
}
sh 'node -v'
sh 'npm -v'
sh 'ls -a'
sh 'df -h'
sh 'free -m'
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') {
steps {
echo 'ui tests'
sh 'npm run test:ui'
}
echo 'ui tests'
sh 'npm run test:ui'
}

6
unit/Jenkinsfile vendored
View File

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