diff --git a/Jenkinsfile b/Jenkinsfile index febb0f7..8647b2c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -113,15 +113,30 @@ pipeline { passwordVariable: 'GITEA_TOKEN')]) { script { sh ''' - git fetch origin - git checkout master - git reset --hard origin/master + git fetch --tags origin + git checkout -B gitea-mirror-$BUILD_NUMBER origin/master + git rm -f Jenkinsfile + git commit -m "Remove Jenkinsfile for Gitea mirror" || echo "No changes to commit" git remote get-url master >/dev/null 2>&1 \ && 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 -c credential.helper="!f() { echo username=${GITEA_USER}; echo password=${GITEA_TOKEN}; }; f" \ - push --force master refs/heads/master:refs/heads/master - ''' + push --force master HEAD:refs/heads/master + 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 + ''' } } } diff --git a/README.md b/README.md index 8e29bc1..23ced6b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # Readme [](https://jenkins.confdroid.com/job/confdroid_java/) +[](https://sonarqube.confdroid.com/dashboard?id=confdroid_java) - [Readme](#readme) - [Synopsis](#synopsis) diff --git a/doc/file.README.html b/doc/file.README.html index 7c2b3e3..ba3936d 100644 --- a/doc/file.README.html +++ b/doc/file.README.html @@ -60,7 +60,7 @@