Merge build 11 into master
This commit is contained in:
32
Jenkinsfile
vendored
32
Jenkinsfile
vendored
@@ -107,35 +107,24 @@ pipeline {
|
|||||||
}
|
}
|
||||||
stage('Mirror to Gitea') {
|
stage('Mirror to Gitea') {
|
||||||
steps {
|
steps {
|
||||||
|
sshagent(['edd05eb6-26b5-4c7b-a5cc-ea2ab899f4fa']) {
|
||||||
withCredentials([usernamePassword(
|
withCredentials([usernamePassword(
|
||||||
credentialsId: 'Jenkins-gitea',
|
credentialsId: 'Jenkins-gitea',
|
||||||
usernameVariable: 'GITEA_USER',
|
usernameVariable: 'GITEA_USER',
|
||||||
passwordVariable: 'GITEA_TOKEN')]) {
|
passwordVariable: 'GITEA_TOKEN')]) {
|
||||||
script {
|
script {
|
||||||
|
// Checkout from GitLab (already done implicitly)
|
||||||
sh '''
|
sh '''
|
||||||
git fetch --tags origin
|
git checkout master
|
||||||
git checkout -B gitea-mirror-$BUILD_NUMBER origin/master
|
git pull origin master
|
||||||
|
git branch -D development
|
||||||
|
git branch -D jenkins-build-$BUILD_NUMBER
|
||||||
git rm -f Jenkinsfile
|
git rm -f Jenkinsfile
|
||||||
git commit -m "Remove Jenkinsfile for Gitea mirror" || echo "No changes to commit"
|
git rm -r --cached .vscode || echo "No .vscode to remove from git"
|
||||||
git remote get-url master >/dev/null 2>&1 \
|
git commit --amend --no-edit --allow-empty
|
||||||
&& git remote set-url master https://sourcecode.confdroid.com/confdroid/confdroid_java.git \
|
git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_java.git
|
||||||
|| git remote add master https://sourcecode.confdroid.com/confdroid/confdroid_java.git
|
|
||||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
||||||
push --force master HEAD:refs/heads/master
|
push master --mirror
|
||||||
git ls-remote --heads master | awk '{print $2}' | sed 's#refs/heads/##' | while read branch; do
|
|
||||||
if [ -n "$branch" ] && [ "$branch" != "master" ]; then
|
|
||||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
|
||||||
push master --delete "$branch"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
|
||||||
push master --tags
|
|
||||||
git ls-remote --tags master | awk '{print $2}' | sed 's#refs/tags/##' | cut -d'^' -f1 | sort -u | while read tag; do
|
|
||||||
if [ -n "$tag" ] && ! git show-ref --tags --verify --quiet "refs/tags/$tag"; then
|
|
||||||
git -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \
|
|
||||||
push master ":refs/tags/$tag"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,3 +132,4 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user