Skip to content

Commit

Permalink
add china rsync jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
eufebius committed May 15, 2023
1 parent ea770f3 commit 8f1c11f
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
42 changes: 42 additions & 0 deletions build/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env groovy

@Library("[email protected]") _

String projectName = 'pf-podtemplate-library'
String podTemplateName = projectName
String pfRepo = "[email protected]:pixelfederation/${projectName}.git"
String pfChinaRepo = "devops/${projectName}.git"
String cnGitServer = "[email protected]"

podTemplateConf = [ name: "${podTemplateName}", label: "${podTemplateName}", inheritFrom: 'default-jnlp-util']

echo "podTemplateConf is : ${podTemplateConf}"

podTemplate( podTemplateConf ) {
node( podTemplateConf.name ) {
try {
ansiColor('xterm') {
stage('Clone Repositories and sync') {
container('util') {
sh """
git clone ${cnGitServer}:${pfChinaRepo} china
git clone ${pfRepo} upstream
cd china
for tag in \$(git tag --sort=creatordate| tail -n 10| awk '{ print \$1}')
do
git push --delete origin \$tag &
done
for job in \$(jobs -p);do wait \$job;done
cd ../upstream
git remote set-url origin ${cnGitServer}:${pfChinaRepo}
git push --all --force
git push --tags --force
"""
}
}
}
} catch(e) {
throw e
}
}
}
59 changes: 59 additions & 0 deletions build/job_def/deploy_pflib_china.job
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
pipelineJob("deploy-pfpodtemplatelib-china") {
description()
keepDependencies(false)
properties {
disableConcurrentBuilds()
pipelineTriggers{
triggers {
genericTrigger {
genericVariables {
genericVariable {
key("ref")
value("\$.ref")
}
genericVariable {
key("pusher")
value("\$.pusher.name")
}
}
token('aqmQO0oQQIu96nP50daTP1krj7MbEC8d')
causeString("Started by GitHub push by \$pusher")
regexpFilterText("\$ref")
regexpFilterExpression("^(refs/tags/.+)")
}
}
}
}
configure {
it / 'properties' / 'com.coravy.hudson.plugins.github.GithubProjectProperty' {
'projectUrl'('https://github.com/pixelfederation/pf-podtemplate-library.git/')
displayName()
}
}
definition {
cpsScm {
scm {
git {
remote {
url("https://github.com/pixelfederation/pf-podtemplate-library.git")
credentials("jenkins-github-token")
}
branch("master")
}
}
scriptPath("build/Jenkinsfile")
lightweight(true)
}
}
disabled(false)
configure {
it / 'properties' / 'jenkins.model.BuildDiscarderProperty' {
strategy {
'daysToKeep'('-1')
'numToKeep'('25')
'artifactDaysToKeep'('-1')
'artifactNumToKeep'('-1')
}
}
}
}

0 comments on commit 8f1c11f

Please sign in to comment.