Compare commits

...

15 Commits

Author SHA1 Message Date
Primakov Alexandr Alexandrovich
815a3d8838 deploy config name as parameter
Some checks failed
platform/bro-js/jenkins-scripts/pipeline/head There was a failure building this commit
2024-11-06 23:56:25 +03:00
Primakov Alexandr Alexandrovich
c7b1b2fdf3 cleanup stats script
Some checks failed
platform/bro-js/jenkins-scripts/pipeline/head There was a failure building this commit
2024-09-07 20:58:42 +03:00
Primakov Alexandr Alexandrovich
d474d02217 npm ci flags 2024-08-23 10:04:06 +03:00
Primakov Alexandr Alexandrovich
3529316fdd fix predeploy no tag error
Some checks failed
platform/gitea-bro-js/jenkins-scripts/pipeline/head There was a failure building this commit
platform/bro-js/jenkins-scripts/pipeline/head There was a failure building this commit
2024-08-07 23:36:29 +03:00
Primakov Alexandr Alexandrovich
9cc5f2734b groovy scripts 2024-08-05 18:47:45 +03:00
Primakov Alexandr Alexandrovich
9bccd1f0a1 edit description 2024-08-05 12:58:55 +03:00
Primakov Alexandr Alexandrovich
3d902f7a67 cd script 2024-08-04 10:48:42 +03:00
c5a16dd2c3 back to simple log 2024-04-11 13:11:20 +03:00
ecbdbfc291 pretty format git log 2024-04-11 13:02:51 +03:00
da048592da no tag variant 2024-04-11 12:57:37 +03:00
a19826ea49 fix no branch name in scope 2024-04-11 12:50:46 +03:00
e1b4dcfb51 move display name 2 install stage 2024-04-11 12:47:41 +03:00
b39f5d8708 build display name 2024-04-11 12:45:45 +03:00
a3b99ccd20 Merge remote-tracking branch 'origin/master' 2024-04-10 00:40:28 +03:00
5e7df3b8b3 fix not master branch build:prod 2024-04-09 23:57:42 +03:00
6 changed files with 88 additions and 18 deletions

View File

@@ -9,7 +9,7 @@ stage ('production build') {
sh "VERSION=${tagNoV} npm run build:prod"; sh "VERSION=${tagNoV} npm run build:prod";
} else { } else {
echo 'tag not found' echo 'tag not found'
sh "VERSION=master npm run build:prod" sh "VERSION=${branchName} npm run build:prod"
} }
sh 'ls dist'; sh 'ls dist';

5
groovy/deploy.groovy Normal file
View File

@@ -0,0 +1,5 @@
def deploy(String versionName, String staticFolderName, String sshConfigName = 'bro-js-static') {
sshPublisher(publishers: [sshPublisherDesc(configName: sshConfigName, transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: '', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: staticFolderName, remoteDirectorySDF: false, removePrefix: '', sourceFiles: "${versionName}/**")], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: true)])
}
return this

12
groovy/tag.groovy Normal file
View File

@@ -0,0 +1,12 @@
String tag = ''
def calcTag() {
tag = sh(returnStdout: true, script: "git tag --contains").trim()
return tag
}
def getTagNoV() {
return tag.substring(1)
}
return this

View File

@@ -1,4 +1,19 @@
stage('install:ci') { stage('install:ci') {
def tag = sh(returnStdout: true, script: "git tag --contains").trim()
def branchName = sh(returnStdout: true, script: "git rev-parse --abbrev-ref HEAD").trim()
def commit = sh(returnStdout: true, script: 'git log -1 --oneline').trim()
String commitMsg = commit.substring( commit.indexOf(' ') ).trim()
def lastLog = sh(returnStdout: true, script: "git log -1").trim()
if (tag) {
currentBuild.displayName = "#${BUILD_NUMBER}, tag ${tag}"
} else {
currentBuild.displayName = "#${BUILD_NUMBER}, branch ${branchName}"
}
String author = sh(returnStdout: true, script: "git log -1 --pretty=format:'%an'").trim()
currentBuild.description = "${author}<br />${commitMsg}"
// currentBuild.description = "#${BUILD_NUMBER}, branch ${branchName}, tag ${tag ? tag : 'no tag'}\n\n${lastLog}"
echo 'starting installing' echo 'starting installing'
sh 'npm ci' sh "pwd"
sh 'npm ci --progress=false --loglevel=error --fetch-retries=3'
} }

64
predeploy/Jenkinsfile vendored
View File

@@ -1,31 +1,69 @@
// stage ('predeploy') {
// echo 'checking tag'
// script {
// def tag = sh(returnStdout: true, script: "git tag --contains").trim()
// def branchName = sh(returnStdout: true, script: "git rev-parse --abbrev-ref HEAD").trim()
// if (tag) {
// echo 'found tag ' + tag
// addBadge(
// icon: 'completed.gif',
// text: "Release ${tag}")
// def tagNoV = tag.substring(1)
// sh "cd ${TARGET_FOLDER}; echo '${tagNoV}' > ${DEPLOY_VERSION_VAR}";
// // sh "cd ${TARGET_FOLDER} ; echo 'mkdir ${tagNoV}; mv ./${branchName}/* ./${tagNoV}; rm -r -d ./${branchName}; rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}"
// } else {
// echo 'tag not found'
// addBadge(
// icon: 'info.gif',
// text: "Сборка в master")
// sh "cd ${TARGET_FOLDER}; echo '${branchName}' > ${DEPLOY_VERSION_VAR}"
// // sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}"
// }
// }
// }
// stage ('archiving') {
// // Archive the build output artifacts.
// script {
// archiveArtifacts artifacts: "${TARGET_FOLDER}/*/**"
// }
// }
def tagModule = load "${JEN_FILES_TMP_NAME}/groovy/tag.groovy"
stage ('predeploy') { stage ('predeploy') {
echo 'checking tag' echo 'checking tag'
script { script {
def tag = sh(returnStdout: true, script: "git tag --contains").trim() tag = tagModule.calcTag()
def branchName = sh(returnStdout: true, script: "git rev-parse --abbrev-ref HEAD").trim() def branchName = sh(returnStdout: true, script: "git rev-parse --abbrev-ref HEAD").trim()
if (tag) { if (tag) {
echo 'found tag ' + tag println "found tag ${tag}"
addBadge( addBadge(
icon: 'completed.gif', icon: 'completed.gif',
text: "Release ${tag}") text: "Release ${tag}")
def tagNoV = tag.substring(1) def tagNoV = tagModule.getTagNoV()
sh "cd ${TARGET_FOLDER}; echo '${tagNoV}' > ${DEPLOY_VERSION_VAR}"; sh "mkdir ${tagNoV}"
// sh "cd ${TARGET_FOLDER} ; echo 'mkdir ${tagNoV}; mv ./${branchName}/* ./${tagNoV}; rm -r -d ./${branchName}; rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}" sh "mv ${TARGET_FOLDER}/* ${tagNoV}"
archiveArtifacts artifacts: "${tagNoV}/*/**"
} else { } else {
echo 'tag not found' echo 'tag not found'
addBadge( addBadge(
icon: 'info.gif', icon: 'info.gif',
text: "Сборка в master") text: "Сборка в ${branchName}")
sh "cd ${TARGET_FOLDER}; echo '${branchName}' > ${DEPLOY_VERSION_VAR}" // sh "cd ${TARGET_FOLDER}; echo '${branchName}' > ${DEPLOY_VERSION_VAR}"
sh "mkdir ${branchName}"
sh "mv ${TARGET_FOLDER}/* ${branchName}"
// sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}" // sh "cd ${TARGET_FOLDER} ; echo 'rm ${DEPLOY_VERSION_VAR}' > ${DEPLOY_VERSION_VAR}"
archiveArtifacts artifacts: "${branchName}/*/**"
} }
} }
} }
stage ('archiving') { // stage ('archiving') {
// Archive the build output artifacts. // // Archive the build output artifacts.
script { // script {
archiveArtifacts artifacts: "${TARGET_FOLDER}/*/**" // archiveArtifacts artifacts: "${TARGET_FOLDER}/*/**"
} // }
} // }

6
stats/Jenkinsfile vendored
View File

@@ -2,8 +2,8 @@ stage('stats') {
echo 'checking node and npm versions' echo 'checking node and npm versions'
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'
} }