-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} | ||
} | ||
} | ||
} |