@@ -16,7 +16,6 @@ pipeline {
16
16
GITHUB_TOKEN = credentials(' 498b4638-2d02-4ce5-832d-8a57d01d97ab' )
17
17
GITLAB_TOKEN = credentials(' b6f0f1dd-6952-4cf6-95d1-9c06380283f0' )
18
18
GITLAB_NAMESPACE = credentials(' gitlab-namespace-id' )
19
- SCARF_TOKEN = credentials(' scarf_api_key' )
20
19
EXT_RELEASE_TYPE = ' pip_version'
21
20
EXT_PIP = ' python-ldap'
22
21
BUILD_VERSION_ARG = ' LDAP_VERSION'
@@ -330,12 +329,12 @@ pipeline {
330
329
else
331
330
echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
332
331
fi
333
- mkdir -p ${TEMPDIR}/gitbook
334
- git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/gitbook /docker-documentation
335
- 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
336
- cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/gitbook /docker-documentation/images/
337
- cd ${TEMPDIR}/gitbook /docker-documentation/
338
- git add images/docker-${CONTAINER_NAME}.md
332
+ mkdir -p ${TEMPDIR}/docs
333
+ git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/docs /docker-documentation
334
+ 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
335
+ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/docs /docker-documentation/docs /images/
336
+ cd ${TEMPDIR}/docs /docker-documentation
337
+ git add docs/ images/docker-${CONTAINER_NAME}.md
339
338
git commit -m 'Bot Updating Documentation'
340
339
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all
341
340
fi
@@ -426,35 +425,6 @@ pipeline {
426
425
"visibility":"public"}' '''
427
426
}
428
427
}
429
- /* #######################
430
- Scarf.sh package registry
431
- ####################### */
432
- // Add package to Scarf.sh and set permissions
433
- stage(" Scarf.sh package registry" ){
434
- when {
435
- branch " master"
436
- environment name : ' EXIT_STATUS' , value : ' '
437
- }
438
- steps{
439
- sh ''' #! /bin/bash
440
- PACKAGE_UUID=$(curl -X GET -H "Authorization: Bearer ${SCARF_TOKEN}" https://scarf.sh/api/v1/organizations/linuxserver-ci/packages | jq -r '.[] | select(.name=="linuxserver/ldap-auth") | .uuid' || :)
441
- if [ -z "${PACKAGE_UUID}" ]; then
442
- echo "Adding package to Scarf.sh"
443
- curl -sX POST https://scarf.sh/api/v1/organizations/linuxserver-ci/packages \
444
- -H "Authorization: Bearer ${SCARF_TOKEN}" \
445
- -H "Content-Type: application/json" \
446
- -d '{"name":"linuxserver/ldap-auth",\
447
- "shortDescription":"example description",\
448
- "libraryType":"docker",\
449
- "website":"https://github.com/linuxserver/docker-ldap-auth",\
450
- "backendUrl":"https://ghcr.io/linuxserver/ldap-auth",\
451
- "publicUrl":"https://lscr.io/linuxserver/ldap-auth"}' || :
452
- else
453
- echo "Package already exists on Scarf.sh"
454
- fi
455
- '''
456
- }
457
- }
458
428
/* ###############
459
429
Build Container
460
430
############### */
@@ -850,6 +820,41 @@ pipeline {
850
820
curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done'''
851
821
}
852
822
}
823
+ // Add protection to the release branch
824
+ stage(' Github-Release-Branch-Protection' ) {
825
+ when {
826
+ branch " master"
827
+ environment name : ' CHANGE_ID' , value : ' '
828
+ environment name : ' EXIT_STATUS' , value : ' '
829
+ }
830
+ steps {
831
+ echo " Setting up protection for release branch master"
832
+ sh ''' #! /bin/bash
833
+ curl -H "Authorization: token ${GITHUB_TOKEN}" -X PUT https://api.github.com/repos/${LS_USER}/${LS_REPO}/branches/master/protection \
834
+ -d $(jq -c . << EOF
835
+ {
836
+ "required_status_checks": null,
837
+ "enforce_admins": false,
838
+ "required_pull_request_reviews": {
839
+ "dismiss_stale_reviews": false,
840
+ "require_code_owner_reviews": false,
841
+ "require_last_push_approval": false,
842
+ "required_approving_review_count": 1
843
+ },
844
+ "restrictions": null,
845
+ "required_linear_history": false,
846
+ "allow_force_pushes": false,
847
+ "allow_deletions": false,
848
+ "block_creations": false,
849
+ "required_conversation_resolution": true,
850
+ "lock_branch": false,
851
+ "allow_fork_syncing": false,
852
+ "required_signatures": false
853
+ }
854
+ EOF
855
+ ) '''
856
+ }
857
+ }
853
858
// Use helper container to sync the current README on master to the dockerhub endpoint
854
859
stage(' Sync-README' ) {
855
860
when {
0 commit comments