add step to push to gitea
This commit is contained in:
17
Jenkinsfile
vendored
17
Jenkinsfile
vendored
@@ -91,19 +91,14 @@ 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') {
|
||||
when { branch 'master' }
|
||||
steps {
|
||||
withCredentials([usernamePassword(
|
||||
credentialsId: 'Jenkins-gitea',
|
||||
@@ -113,16 +108,14 @@ pipeline {
|
||||
// Checkout from GitLab (already done implicitly)
|
||||
sh '''
|
||||
git remote remove gitea || true
|
||||
git remote add gitea https://gitea.confdroid.com/confdroid/puppet_cd.git
|
||||
git checkout master
|
||||
git remote add master https://gitea.confdroid.com/confdroid/puppet_cd.git
|
||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
||||
push gitea refs/heads/master:refs/heads/master --tags
|
||||
git push origin HEAD:master --tags
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
when { branch 'master' } // Only on main branch to avoid noise
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user