Skip to content

Commit c76c964

Browse files
pfeufferEduard Heimbuch
and
Eduard Heimbuch
committed
Migrate SCM-Manager from GitHub to Cloudogu EcoSystem
Co-authored-by: Eduard Heimbuch <eduard.heimbuch@cloudogu.com>
1 parent 3c93cd7 commit c76c964

File tree

1 file changed

+33
-32
lines changed

1 file changed

+33
-32
lines changed

Jenkinsfile

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ pipeline {
4141
script {
4242
if (isReleaseBuild()) {
4343
// checkout, reset and merge
44-
sh 'git checkout master'
45-
sh 'git reset --hard origin/master'
44+
sh 'git checkout main'
45+
sh 'git reset --hard origin/main'
4646
sh "git merge --ff-only ${env.BRANCH_NAME}"
4747
}
4848
}
@@ -81,7 +81,7 @@ pipeline {
8181
}
8282
}
8383

84-
stage('SonarQube') {
84+
stage('SonarQube') {
8585
steps {
8686
sh 'git config --replace-all "remote.origin.fetch" "+refs/heads/*:refs/remotes/origin/*"'
8787
sh 'git fetch origin develop'
@@ -146,7 +146,7 @@ pipeline {
146146
script {
147147
def imageVersion = readFile 'scm-packaging/docker/build/docker.tag'
148148

149-
build job: 'scm-manager/next-scm.cloudogu.com', propagate: false, wait: false, parameters: [
149+
build job: 'scm-manager/scm-manager/next-scm.cloudogu.com/master', propagate: false, wait: false, parameters: [
150150
string(name: 'imageTag', value: imageVersion)
151151
]
152152
}
@@ -165,11 +165,11 @@ pipeline {
165165
script {
166166
// push changes back to remote repository
167167
if (isReleaseBuild()) {
168-
authGit 'cesmarvin-github', 'push origin master --tags'
168+
authGit 'cesmarvin', 'push origin main--tags'
169169
} else {
170-
authGit 'cesmarvin-github', "push origin ${env.BRANCH_NAME} --tags"
170+
authGit 'cesmarvin', "push origin ${env.BRANCH_NAME} --tags"
171171
}
172-
authGit 'cesmarvin-github', 'push origin --tags'
172+
authGit 'cesmarvin', 'push origin --tags'
173173
}
174174
}
175175
}
@@ -182,13 +182,13 @@ pipeline {
182182
steps {
183183
sh returnStatus: true, script: "git branch -D develop"
184184
sh "git checkout develop"
185-
sh "git -c user.name='CES Marvin' -c user.email='cesmarvin@cloudogu.com' merge master"
185+
sh "git -c user.name='CES Marvin' -c user.email='cesmarvin@cloudogu.com' merge main"
186186

187187
gradle "setVersionToNextSnapshot"
188188

189189
sh "git add gradle.properties '**.json'"
190190
commit 'Prepare for next development iteration'
191-
authGit 'cesmarvin-github', 'push origin develop'
191+
authGit 'cesmarvin', 'push origin develop'
192192
}
193193
}
194194

@@ -198,7 +198,22 @@ pipeline {
198198
expression { return isBuildSuccess() }
199199
}
200200
steps {
201-
authGit 'cesmarvin-github', "push origin :${env.BRANCH_NAME}"
201+
authGit 'cesmarvin', "push origin :${env.BRANCH_NAME}"
202+
}
203+
}
204+
205+
stage('Push to GitHub') {
206+
when {
207+
anyOf {
208+
branch pattern: 'develop', comparator: 'GLOB'
209+
branch pattern: 'main', comparator: 'GLOB'
210+
branch pattern: 'support/*', comparator: 'GLOB'
211+
}
212+
expression { return isBuildSuccess() }
213+
}
214+
steps {
215+
authGit 'cesmarvin', "push https://github.com/scm-manager/scm-manager HEAD:${env.BRANCH_NAME}"
216+
authGit 'cesmarvin', "push --tags https://github.com/scm-manager/scm-manager"
202217
}
203218
}
204219

@@ -211,8 +226,8 @@ pipeline {
211226
mail to: "scm-team@cloudogu.com",
212227
subject: "Jenkins Job ${JOB_NAME} - Merge Hotfix Release #${env.BRANCH_NAME}!",
213228
body: """Please,
214-
- merge the hotfix release branch ${env.BRANCH_NAME} into master (keep versions of master, merge changelog to keep both versions),
215-
- merge master into develop (the changelog should have no conflicts),
229+
- merge the hotfix release branch ${env.BRANCH_NAME} into main (keep versions of main, merge changelog to keep both versions),
230+
- merge main into develop (the changelog should have no conflicts),
216231
- if needed, increase version."""
217232
}
218233
}
@@ -268,33 +283,19 @@ boolean isBuildSuccess() {
268283
}
269284

270285
void withCheckEnvironment(Closure<Void> closure) {
271-
// surround call withChromaticEnvironment to enable chromatic analyzation
272286
closure.call()
273287
}
274288

275-
void withChromaticEnvironment(Closure<Void> closure) {
276-
// apply chromatic environment only if we are on a pr build or on the develop branch
277-
if (env.CHANGE_ID || env.BRANCH_NAME == 'develop') {
278-
withCredentials([
279-
usernamePassword(credentialsId: 'chromatic-scm-manager', usernameVariable: 'CHROMATIC_USERANAME', passwordVariable: 'CHROMATIC_PROJECT_TOKEN'),
280-
]) {
281-
closure.call()
282-
}
283-
} else {
284-
closure.call()
285-
}
286-
}
287-
288289
void withPublishEnivronment(Closure<Void> closure) {
289290
withCredentials([
290-
usernamePassword(credentialsId: 'maven.scm-manager.org', usernameVariable: 'ORG_GRADLE_PROJECT_packagesScmManagerUsername', passwordVariable: 'ORG_GRADLE_PROJECT_packagesScmManagerPassword'),
291-
usernamePassword(credentialsId: 'cesmarvin-github', usernameVariable: 'ORG_GRADLE_PROJECT_gitHubUsername', passwordVariable: 'ORG_GRADLE_PROJECT_gitHubApiToken'),
292-
string(credentialsId: 'cesmarvin_npm_token', variable: 'ORG_GRADLE_PROJECT_npmToken'),
293-
file(credentialsId: 'oss-gpg-secring', variable: 'GPG_KEY_RING'),
294-
usernamePassword(credentialsId: 'oss-keyid-and-passphrase', usernameVariable: 'GPG_KEY_ID', passwordVariable: 'GPG_KEY_PASSWORD')
291+
usernamePassword(credentialsId: 'packages-scm-manager-org', usernameVariable: 'ORG_GRADLE_PROJECT_packagesScmManagerUsername', passwordVariable: 'ORG_GRADLE_PROJECT_packagesScmManagerPassword'),
292+
usernamePassword(credentialsId: 'cesmarvin', usernameVariable: 'ORG_GRADLE_PROJECT_gitHubUsername', passwordVariable: 'ORG_GRADLE_PROJECT_gitHubApiToken'),
293+
string(credentialsId: 'npm-token-scm-manager', variable: 'ORG_GRADLE_PROJECT_npmToken'),
294+
file(credentialsId: 'gpg_packages-scm-manager-org', variable: 'GPG_KEY_RING'),
295+
usernamePassword(credentialsId: 'gpg_packages-scm-manager-org-credentials', usernameVariable: 'GPG_KEY_ID', passwordVariable: 'GPG_KEY_PASSWORD')
295296
]) {
296297
withEnv(["ORG_GRADLE_PROJECT_npmEmail=cesmarvin@cloudogu.com"]) {
297-
docker.withRegistry('', 'hub.docker.com-cesmarvin') {
298+
docker.withRegistry('', 'cesmarvin-dockerhub-access-token') {
298299
closure.call()
299300
}
300301
}

0 commit comments

Comments
 (0)