|
|
@ -2,6 +2,10 @@ pipeline {
|
|
|
|
agent {
|
|
|
|
agent {
|
|
|
|
label 'X86-64-MULTI'
|
|
|
|
label 'X86-64-MULTI'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
|
|
|
|
buildDiscarder(logRotator(numToKeepStr: '10', daysToKeepStr: '60'))
|
|
|
|
|
|
|
|
parallelsAlwaysFailFast()
|
|
|
|
|
|
|
|
}
|
|
|
|
// Input to determine if this is a package check
|
|
|
|
// Input to determine if this is a package check
|
|
|
|
parameters {
|
|
|
|
parameters {
|
|
|
|
string(defaultValue: 'false', description: 'package check run', name: 'PACKAGE_CHECK')
|
|
|
|
string(defaultValue: 'false', description: 'package check run', name: 'PACKAGE_CHECK')
|
|
|
@ -49,22 +53,7 @@ pipeline {
|
|
|
|
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
|
|
|
|
env.CODE_URL = 'https://github.com/' + env.LS_USER + '/' + env.LS_REPO + '/commit/' + env.GIT_COMMIT
|
|
|
|
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
|
|
|
|
env.DOCKERHUB_LINK = 'https://hub.docker.com/r/' + env.DOCKERHUB_IMAGE + '/tags/'
|
|
|
|
env.PULL_REQUEST = env.CHANGE_ID
|
|
|
|
env.PULL_REQUEST = env.CHANGE_ID
|
|
|
|
env.LICENSE_TAG = sh(
|
|
|
|
env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE.md ./.github/PULL_REQUEST_TEMPLATE.md'
|
|
|
|
script: '''#!/bin/bash
|
|
|
|
|
|
|
|
if [ -e LICENSE ] ; then
|
|
|
|
|
|
|
|
cat LICENSE | md5sum | cut -c1-8
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo none
|
|
|
|
|
|
|
|
fi''',
|
|
|
|
|
|
|
|
returnStdout: true).trim()
|
|
|
|
|
|
|
|
env.FUNDING_TAG = sh(
|
|
|
|
|
|
|
|
script: '''#!/bin/bash
|
|
|
|
|
|
|
|
if [ -e ./.github/FUNDING.yml ] ; then
|
|
|
|
|
|
|
|
cat ./.github/FUNDING.yml | md5sum | cut -c1-8
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
echo none
|
|
|
|
|
|
|
|
fi''',
|
|
|
|
|
|
|
|
returnStdout: true).trim()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
script{
|
|
|
|
script{
|
|
|
|
env.LS_RELEASE_NUMBER = sh(
|
|
|
|
env.LS_RELEASE_NUMBER = sh(
|
|
|
@ -228,35 +217,32 @@ pipeline {
|
|
|
|
TEMPDIR=$(mktemp -d)
|
|
|
|
TEMPDIR=$(mktemp -d)
|
|
|
|
docker pull linuxserver/jenkins-builder:latest
|
|
|
|
docker pull linuxserver/jenkins-builder:latest
|
|
|
|
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/jenkins linuxserver/jenkins-builder:latest
|
|
|
|
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/jenkins linuxserver/jenkins-builder:latest
|
|
|
|
docker pull linuxserver/doc-builder:latest
|
|
|
|
CURRENTHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
|
|
|
|
docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/readme linuxserver/doc-builder:latest
|
|
|
|
cd ${TEMPDIR}/docker-${CONTAINER_NAME}
|
|
|
|
if [ "$(md5sum ${TEMPDIR}/${LS_REPO}/Jenkinsfile | awk '{ print $1 }')" != "$(md5sum Jenkinsfile | awk '{ print $1 }')" ] || \
|
|
|
|
NEWHASH=$(grep -hs ^ ${TEMPLATED_FILES} | md5sum | cut -c1-8)
|
|
|
|
[ "$(md5sum ${TEMPDIR}/${CONTAINER_NAME}/README.md | awk '{ print $1 }')" != "$(md5sum README.md | awk '{ print $1 }')" ] || \
|
|
|
|
if [[ "${CURRENTHASH}" != "${NEWHASH}" ]]; then
|
|
|
|
[ "$(cat ${TEMPDIR}/${LS_REPO}/LICENSE | md5sum | cut -c1-8)" != "${LICENSE_TAG}" ] || \
|
|
|
|
|
|
|
|
[ "$(cat ${TEMPDIR}/${LS_REPO}/.github/FUNDING.yml | md5sum | cut -c1-8)" != "${FUNDING_TAG}" ]; then
|
|
|
|
|
|
|
|
mkdir -p ${TEMPDIR}/repo
|
|
|
|
mkdir -p ${TEMPDIR}/repo
|
|
|
|
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
|
|
|
|
git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO}
|
|
|
|
git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git checkout -f master
|
|
|
|
cd ${TEMPDIR}/repo/${LS_REPO}
|
|
|
|
cp ${TEMPDIR}/${CONTAINER_NAME}/README.md ${TEMPDIR}/repo/${LS_REPO}/
|
|
|
|
git checkout -f master
|
|
|
|
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/
|
|
|
|
cd ${TEMPDIR}/docker-${CONTAINER_NAME}
|
|
|
|
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/LICENSE ${TEMPDIR}/repo/${LS_REPO}/
|
|
|
|
|
|
|
|
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github
|
|
|
|
mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github
|
|
|
|
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.github/FUNDING.yml ${TEMPDIR}/repo/${LS_REPO}/.github/FUNDING.yml
|
|
|
|
cp --parents ${TEMPLATED_FILES} ${TEMPDIR}/repo/${LS_REPO}/
|
|
|
|
cd ${TEMPDIR}/repo/${LS_REPO}/
|
|
|
|
cd ${TEMPDIR}/repo/${LS_REPO}/
|
|
|
|
git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git add Jenkinsfile README.md LICENSE ./.github/FUNDING.yml
|
|
|
|
git add ${TEMPLATED_FILES}
|
|
|
|
git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git commit -m 'Bot Updating Templated Files'
|
|
|
|
git commit -m 'Bot Updating Templated Files'
|
|
|
|
git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
|
|
|
|
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all
|
|
|
|
echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
|
|
|
|
echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
|
|
|
|
echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER}
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
mkdir -p ${TEMPDIR}/gitbook
|
|
|
|
mkdir -p ${TEMPDIR}/gitbook
|
|
|
|
git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/gitbook/docker-documentation
|
|
|
|
git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/gitbook/docker-documentation
|
|
|
|
if [[ "${BRANCH_NAME}" == "master" ]] && [[ (! -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}/${CONTAINER_NAME}/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then
|
|
|
|
if [[ "${BRANCH_NAME}" == "master" ]] && [[ (! -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}/docker-${CONTAINER_NAME}.md | awk '{ print $1 }')") ]]; then
|
|
|
|
cp ${TEMPDIR}/${CONTAINER_NAME}/docker-${CONTAINER_NAME}.md ${TEMPDIR}/gitbook/docker-documentation/images/
|
|
|
|
cp ${TEMPDIR}/docker-${CONTAINER_NAME}/docker-${CONTAINER_NAME}.md ${TEMPDIR}/gitbook/docker-documentation/images/
|
|
|
|
cd ${TEMPDIR}/gitbook/docker-documentation/
|
|
|
|
cd ${TEMPDIR}/gitbook/docker-documentation/
|
|
|
|
git add images/docker-${CONTAINER_NAME}.md
|
|
|
|
git add images/docker-${CONTAINER_NAME}.md
|
|
|
|
git commit -m 'Bot Updating Templated Files'
|
|
|
|
git commit -m 'Bot Updating Documentation'
|
|
|
|
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all
|
|
|
|
git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
rm -Rf ${TEMPDIR}'''
|
|
|
|
rm -Rf ${TEMPDIR}'''
|
|
|
|