Add step for marking quay.io repos as public

This commit is contained in:
aptalca 2024-07-26 12:06:11 -04:00
parent 6cf1f9a41d
commit bb0ce2c1ef
No known key found for this signature in database
GPG Key ID: BE36CFFB9FD85548
2 changed files with 29 additions and 0 deletions

15
Jenkinsfile vendored
View File

@ -17,6 +17,7 @@ pipeline {
GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0')
GITLAB_NAMESPACE=credentials('gitlab-namespace-id')
DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat')
QUAYIO_API_TOKEN=credentials('quayio-repo-api-token')
BUILD_VERSION_ARG='BUILDER_VERSION'
LS_USER='linuxserver'
LS_REPO='docker-jenkins-builder'
@ -39,6 +40,7 @@ pipeline {
// Setup all the basic environment variables needed for the build
stage("Set ENV Variables base"){
steps{
echo "Running on node: ${NODE_NAME}"
sh '''#! /bin/bash
containers=$(docker ps -aq)
if [[ -n "${containers}" ]]; then
@ -480,6 +482,19 @@ pipeline {
-d "mirror=true&import_url=https://github.com/linuxserver/${LS_REPO}.git" '''
}
}
/* #######################
Quay.io Repo Visibility
####################### */
// Mark this repo on Quay.io as public
stage("Quay.io Repo Visibility"){
when {
environment name: 'EXIT_STATUS', value: ''
}
steps{
sh '''curl -H "Content-Type: application/json" -H "Authorization: Bearer ${QUAYIO_API_TOKEN}" -X POST "https://quay.io/api/v1/repository${QUAYIMAGE/quay.io/}/changevisibility" \
-d '{"visibility":"public"}' ||: '''
}
}
/* ###############
Build Container
############### */

View File

@ -17,6 +17,7 @@ pipeline {
GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0')
GITLAB_NAMESPACE=credentials('gitlab-namespace-id')
DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat')
QUAYIO_API_TOKEN=credentials('quayio-repo-api-token')
{% for repo_var in repo_vars %}
{{ repo_var }}
{% endfor %}
@ -710,6 +711,19 @@ pipeline {
-d "mirror=true&import_url=https://github.com/linuxserver/${LS_REPO}.git" '''
}{{ ' ' }}
}
/* #######################
Quay.io Repo Visibility
####################### */
// Mark this repo on Quay.io as public
stage("Quay.io Repo Visibility"){
when {
environment name: 'EXIT_STATUS', value: ''
}
steps{
sh '''curl -H "Content-Type: application/json" -H "Authorization: Bearer ${QUAYIO_API_TOKEN}" -X POST "https://quay.io/api/v1/repository${QUAYIMAGE/quay.io/}/changevisibility" \
-d '{"visibility":"public"}' ||: '''
}{{ ' ' }}
}
/* ###############
Build Container
############### */