OP#200 add gitea step and push over
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
||||
Gemfile.lock
|
||||
FileList
|
||||
.scannerwork
|
||||
.vscode
|
||||
|
||||
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -13,6 +13,7 @@
|
||||
"ecdh",
|
||||
"fdatasync",
|
||||
"geqo",
|
||||
"GITEA",
|
||||
"hashagg",
|
||||
"hashjoin",
|
||||
"hostnossl",
|
||||
|
||||
31
Jenkinsfile
vendored
31
Jenkinsfile
vendored
@@ -69,7 +69,7 @@ pipeline {
|
||||
withCredentials([string(credentialsId: 'sonar-token', variable: 'SONAR_TOKEN')]) {
|
||||
sh '''
|
||||
/opt/sonar-scanner/bin/sonar-scanner \
|
||||
-Dsonar.projectKey=postgresql_cd \
|
||||
-Dsonar.projectKey=confdroid_postgresql \
|
||||
-Dsonar.sources=. \
|
||||
-Dsonar.host.url=https://sonarqube.confdroid.com \
|
||||
-Dsonar.token=$SONAR_TOKEN
|
||||
@@ -91,15 +91,32 @@ pipeline {
|
||||
git config user.name "Jenkins Server"
|
||||
git config user.email jenkins@confdroid.com
|
||||
git add -A && git commit -am "Recommit for updates in build $BUILD_NUMBER" || echo "No changes to commit"
|
||||
git push -o merge_request.create \
|
||||
-o merge_request.target=master \
|
||||
-o merge_request.title="Auto-merge for build $BUILD_NUMBER" \
|
||||
-o merge_request.description="Automated changes from Jenkins build $BUILD_NUMBER" \
|
||||
-o merge_request.merge_when_pipeline_succeeds=true \
|
||||
origin jenkins-build-$BUILD_NUMBER
|
||||
git push origin HEAD:master
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Mirror to Gitea') {
|
||||
steps {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'Jenkins-gitea',
|
||||
usernameVariable: 'GITEA_USER',
|
||||
passwordVariable: 'GITEA_TOKEN')]) {
|
||||
script {
|
||||
// Checkout from GitLab (already done implicitly)
|
||||
sh '''
|
||||
git checkout master
|
||||
git pull origin master
|
||||
git branch -D development
|
||||
git branch -D jenkins-build-$BUILD_NUMBER
|
||||
git rm -f Jenkinsfile
|
||||
git commit --amend --no-edit --allow-empty
|
||||
git remote add master https://gitea.confdroid.com/confdroid/confdroid_postgresql.git
|
||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
||||
push master --mirror
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user