@@ -16,7 +16,6 @@ pipeline {
1616 GITHUB_TOKEN = credentials(' 498b4638-2d02-4ce5-832d-8a57d01d97ab' )
1717 GITLAB_TOKEN = credentials(' b6f0f1dd-6952-4cf6-95d1-9c06380283f0' )
1818 GITLAB_NAMESPACE = credentials(' gitlab-namespace-id' )
19- SCARF_TOKEN = credentials(' scarf_api_key' )
2019 EXT_GIT_BRANCH = ' master'
2120 EXT_USER = ' bookstackapp'
2221 EXT_REPO = ' bookstack'
@@ -339,12 +338,12 @@ pipeline {
339338 else
340339 echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
341340 fi
342- mkdir -p ${TEMPDIR}/gitbook
343- git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/gitbook /docker-documentation
344- if [[ ("${BRANCH_NAME}" == "master") || ("${BRANCH_NAME}" == "main") ]] && [[ (! -f ${TEMPDIR}/gitbook /docker-documentation/images/docker-${CONTAINER_NAME}.md) || ("$(md5sum ${TEMPDIR}/gitbook /docker-documentation/images/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then
345- cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/gitbook /docker-documentation/images/
346- cd ${TEMPDIR}/gitbook /docker-documentation/
347- git add images/docker-${CONTAINER_NAME}.md
341+ mkdir -p ${TEMPDIR}/docs
342+ git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/docs /docker-documentation
343+ if [[ ("${BRANCH_NAME}" == "master") || ("${BRANCH_NAME}" == "main") ]] && [[ (! -f ${TEMPDIR}/docs /docker-documentation/docs/ images/docker-${CONTAINER_NAME}.md) || ("$(md5sum ${TEMPDIR}/docs /docker-documentation/docs /images/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then
344+ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/docs /docker-documentation/docs /images/
345+ cd ${TEMPDIR}/docs /docker-documentation
346+ git add docs/ images/docker-${CONTAINER_NAME}.md
348347 git commit -m 'Bot Updating Documentation'
349348 git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all
350349 fi
@@ -435,35 +434,6 @@ pipeline {
435434 "visibility":"public"}' '''
436435 }
437436 }
438- /* #######################
439- Scarf.sh package registry
440- ####################### */
441- // Add package to Scarf.sh and set permissions
442- stage(" Scarf.sh package registry" ){
443- when {
444- branch " master"
445- environment name : ' EXIT_STATUS' , value : ' '
446- }
447- steps{
448- sh ''' #! /bin/bash
449- PACKAGE_UUID=$(curl -X GET -H "Authorization: Bearer ${SCARF_TOKEN}" https://scarf.sh/api/v1/organizations/linuxserver-ci/packages | jq -r '.[] | select(.name=="linuxserver/bookstack") | .uuid' || :)
450- if [ -z "${PACKAGE_UUID}" ]; then
451- echo "Adding package to Scarf.sh"
452- curl -sX POST https://scarf.sh/api/v1/organizations/linuxserver-ci/packages \
453- -H "Authorization: Bearer ${SCARF_TOKEN}" \
454- -H "Content-Type: application/json" \
455- -d '{"name":"linuxserver/bookstack",\
456- "shortDescription":"example description",\
457- "libraryType":"docker",\
458- "website":"https://github.com/linuxserver/docker-bookstack",\
459- "backendUrl":"https://ghcr.io/linuxserver/bookstack",\
460- "publicUrl":"https://lscr.io/linuxserver/bookstack"}' || :
461- else
462- echo "Package already exists on Scarf.sh"
463- fi
464- '''
465- }
466- }
467437 /* ###############
468438 Build Container
469439 ############### */
@@ -859,6 +829,41 @@ pipeline {
859829 curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
860830 }
861831 }
832+ // Add protection to the release branch
833+ stage(' Github-Release-Branch-Protection' ) {
834+ when {
835+ branch " master"
836+ environment name : ' CHANGE_ID' , value : ' '
837+ environment name : ' EXIT_STATUS' , value : ' '
838+ }
839+ steps {
840+ echo " Setting up protection for release branch master"
841+ sh ''' #! /bin/bash
842+ curl -H "Authorization: token ${GITHUB_TOKEN}" -X PUT https://api.github.com/repos/${LS_USER}/${LS_REPO}/branches/master/protection \
843+ -d $(jq -c . << EOF
844+ {
845+ "required_status_checks": null,
846+ "enforce_admins": false,
847+ "required_pull_request_reviews": {
848+ "dismiss_stale_reviews": false,
849+ "require_code_owner_reviews": false,
850+ "require_last_push_approval": false,
851+ "required_approving_review_count": 1
852+ },
853+ "restrictions": null,
854+ "required_linear_history": false,
855+ "allow_force_pushes": false,
856+ "allow_deletions": false,
857+ "block_creations": false,
858+ "required_conversation_resolution": true,
859+ "lock_branch": false,
860+ "allow_fork_syncing": false,
861+ "required_signatures": false
862+ }
863+ EOF
864+ ) '''
865+ }
866+ }
862867 // Use helper container to sync the current README on master to the dockerhub endpoint
863868 stage(' Sync-README' ) {
864869 when {
0 commit comments