From 0d38a54e2a41f3c7f1c7dfc4a306da85a8337edf Mon Sep 17 00:00:00 2001 From: LinuxServer-CI Date: Mon, 4 Nov 2019 13:56:02 +0000 Subject: [PATCH] Bot Updating Templated Files --- Jenkinsfile | 162 +++++++++++++++++++++++++++++++++++++++------------- README.md | 16 ++++-- 2 files changed, 133 insertions(+), 45 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6a599a0..cb38a91 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -14,6 +14,8 @@ pipeline { environment { BUILDS_DISCORD=credentials('build_webhook_url') GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab') + GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0') + GITLAB_NAMESPACE=credentials('gitlab-namespace-id') EXT_GIT_BRANCH = 'master' EXT_USER = 'janeczku' EXT_REPO = 'calibre-web' @@ -136,6 +138,9 @@ pipeline { steps { script{ env.IMAGE = env.DOCKERHUB_IMAGE + env.QUAYIMAGE = 'quay.io/linuxserver.io/' + env.CONTAINER_NAME + env.GITHUBIMAGE = 'docker.pkg.github.com/' + env.LS_USER + '/' + env.LS_REPO + '/' + env.CONTAINER_NAME + env.GITLABIMAGE = 'registry.gitlab.com/linuxserver.io/' + env.LS_REPO + '/' + env.CONTAINER_NAME if (env.MULTIARCH == 'true') { env.CI_TAGS = 'amd64-' + env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER + '|arm32v7-' + env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER + '|arm64v8-' + env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER } else { @@ -154,6 +159,9 @@ pipeline { steps { script{ env.IMAGE = env.DEV_DOCKERHUB_IMAGE + env.QUAYIMAGE = 'quay.io/linuxserver.io/lsiodev-' + env.CONTAINER_NAME + env.GITHUBIMAGE = 'docker.pkg.github.com/' + env.LS_USER + '/' + env.LS_REPO + '/lsiodev-' + env.CONTAINER_NAME + env.GITLABIMAGE = 'registry.gitlab.com/linuxserver.io/' + env.LS_REPO + '/lsiodev-' + env.CONTAINER_NAME if (env.MULTIARCH == 'true') { env.CI_TAGS = 'amd64-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + '|arm32v7-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA + '|arm64v8-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-dev-' + env.COMMIT_SHA } else { @@ -172,6 +180,9 @@ pipeline { steps { script{ env.IMAGE = env.PR_DOCKERHUB_IMAGE + env.QUAYIMAGE = 'quay.io/linuxserver.io/lspipepr-' + env.CONTAINER_NAME + env.GITHUBIMAGE = 'docker.pkg.github.com/' + env.LS_USER + '/' + env.LS_REPO + '/lspipepr-' + env.CONTAINER_NAME + env.GITLABIMAGE = 'registry.gitlab.com/linuxserver.io/' + env.LS_REPO + '/lspipepr-' + env.CONTAINER_NAME if (env.MULTIARCH == 'true') { env.CI_TAGS = 'amd64-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + '|arm32v7-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST + '|arm64v8-' + env.EXT_RELEASE_CLEAN + '-pkg-' + env.PACKAGE_TAG + '-pr-' + env.PULL_REQUEST } else { @@ -279,6 +290,26 @@ pipeline { } } } + /* ####################### + GitLab Mirroring + ####################### */ + // Ping into Gitlab to mirror this repo and have a registry endpoint + stage("GitLab Mirror"){ + when { + environment name: 'EXIT_STATUS', value: '' + } + steps{ + sh '''curl -H "Content-Type: application/json" -H "Private-Token: ${GITLAB_TOKEN}" -X POST https://gitlab.com/api/v4/projects \ + -d '{"namespace_id":'${GITLAB_NAMESPACE}',\ + "name":"'${LS_REPO}'", + "mirror":true,\ + "import_url":"https://github.com/linuxserver/'${LS_REPO}'.git",\ + "issues_access_level":"disabled",\ + "merge_requests_access_level":"disabled",\ + "repository_access_level":"enabled",\ + "visibility":"public"}' ''' + } + } /* ############### Build Container ############### */ @@ -510,19 +541,32 @@ pipeline { credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', usernameVariable: 'DOCKERUSER', passwordVariable: 'DOCKERPASS' + ], + [ + $class: 'UsernamePasswordMultiBinding', + credentialsId: 'Quay.io-Robot', + usernameVariable: 'QUAYUSER', + passwordVariable: 'QUAYPASS' ] ]) { - echo 'Logging into DockerHub' sh '''#! /bin/bash - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + set -e + echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin + echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + echo $GITHUB_TOKEN | docker login docker.pkg.github.com -u LinuxServer-CI --password-stdin + echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin + for PUSHIMAGE in "${QUAYIMAGE}" "${GITHUBIMAGE}" "${GITLABIMAGE}" "${IMAGE}"; do + docker tag ${IMAGE}:${META_TAG} ${PUSHIMAGE}:${META_TAG} + docker tag ${PUSHIMAGE}:${META_TAG} ${PUSHIMAGE}:latest + docker push ${PUSHIMAGE}:latest + docker push ${PUSHIMAGE}:${META_TAG} + done + for DELETEIMAGE in "${QUAYIMAGE}" "${GITHUBIMAGE}" "{GITLABIMAGE}" "${IMAGE}"; do + docker rmi \ + ${DELETEIMAGE}:${META_TAG} \ + ${DELETEIMAGE}:latest || : + done ''' - sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest" - sh "docker push ${IMAGE}:latest" - sh "docker push ${IMAGE}:${META_TAG}" - sh '''docker rmi \ - ${IMAGE}:${META_TAG} \ - ${IMAGE}:latest || :''' - } } } @@ -539,46 +583,81 @@ pipeline { credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', usernameVariable: 'DOCKERUSER', passwordVariable: 'DOCKERPASS' + ], + [ + $class: 'UsernamePasswordMultiBinding', + credentialsId: 'Quay.io-Robot', + usernameVariable: 'QUAYUSER', + passwordVariable: 'QUAYPASS' ] ]) { sh '''#! /bin/bash - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin - ''' - sh '''#! /bin/bash + set -e + echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin + echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + echo $GITHUB_TOKEN | docker login docker.pkg.github.com -u LinuxServer-CI --password-stdin + echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin if [ "${CI}" == "false" ]; then docker pull lsiodev/buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} docker pull lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} docker tag lsiodev/buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm32v7-${META_TAG} docker tag lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm64v8-${META_TAG} - fi''' - sh "docker tag ${IMAGE}:amd64-${META_TAG} ${IMAGE}:amd64-latest" - sh "docker tag ${IMAGE}:arm32v7-${META_TAG} ${IMAGE}:arm32v7-latest" - sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ${IMAGE}:arm64v8-latest" - sh "docker push ${IMAGE}:amd64-${META_TAG}" - sh "docker push ${IMAGE}:arm32v7-${META_TAG}" - sh "docker push ${IMAGE}:arm64v8-${META_TAG}" - sh "docker push ${IMAGE}:amd64-latest" - sh "docker push ${IMAGE}:arm32v7-latest" - sh "docker push ${IMAGE}:arm64v8-latest" - sh "docker manifest push --purge ${IMAGE}:latest || :" - sh "docker manifest create ${IMAGE}:latest ${IMAGE}:amd64-latest ${IMAGE}:arm32v7-latest ${IMAGE}:arm64v8-latest" - sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm32v7-latest --os linux --arch arm" - sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm64v8-latest --os linux --arch arm64 --variant v8" - sh "docker manifest push --purge ${IMAGE}:${META_TAG} || :" - sh "docker manifest create ${IMAGE}:${META_TAG} ${IMAGE}:amd64-${META_TAG} ${IMAGE}:arm32v7-${META_TAG} ${IMAGE}:arm64v8-${META_TAG}" - sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm32v7-${META_TAG} --os linux --arch arm" - sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8" - sh "docker manifest push --purge ${IMAGE}:latest" - sh "docker manifest push --purge ${IMAGE}:${META_TAG}" - sh '''docker rmi \ - ${IMAGE}:amd64-${META_TAG} \ - ${IMAGE}:amd64-latest \ - ${IMAGE}:arm32v7-${META_TAG} \ - ${IMAGE}:arm32v7-latest \ - ${IMAGE}:arm64v8-${META_TAG} \ - ${IMAGE}:arm64v8-latest \ + fi + for MANIFESTIMAGE in "${IMAGE}" "${GITLABIMAGE}"; do + docker tag ${IMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:amd64-${META_TAG} + docker tag ${IMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm32v7-${META_TAG} + docker tag ${IMAGE}:arm64v8-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG} + docker tag ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:amd64-latest + docker tag ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm32v7-latest + docker tag ${MANIFESTIMAGE}:arm64v8-${META_TAG} ${MANIFESTIMAGE}:arm64v8-latest + docker push ${MANIFESTIMAGE}:amd64-${META_TAG} + docker push ${MANIFESTIMAGE}:arm32v7-${META_TAG} + docker push ${MANIFESTIMAGE}:arm64v8-${META_TAG} + docker push ${MANIFESTIMAGE}:amd64-latest + docker push ${MANIFESTIMAGE}:arm32v7-latest + docker push ${MANIFESTIMAGE}:arm64v8-latest + docker manifest push --purge ${MANIFESTIMAGE}:latest || : + docker manifest create ${MANIFESTIMAGE}:latest ${MANIFESTIMAGE}:amd64-latest ${MANIFESTIMAGE}:arm32v7-latest ${MANIFESTIMAGE}:arm64v8-latest + docker manifest annotate ${MANIFESTIMAGE}:latest ${MANIFESTIMAGE}:arm32v7-latest --os linux --arch arm + docker manifest annotate ${MANIFESTIMAGE}:latest ${MANIFESTIMAGE}:arm64v8-latest --os linux --arch arm64 --variant v8 + docker manifest push --purge ${MANIFESTIMAGE}:${META_TAG} || : + docker manifest create ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:amd64-${META_TAG} ${MANIFESTIMAGE}:arm32v7-${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG} + docker manifest annotate ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:arm32v7-${META_TAG} --os linux --arch arm + docker manifest annotate ${MANIFESTIMAGE}:${META_TAG} ${MANIFESTIMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8 + docker manifest push --purge ${MANIFESTIMAGE}:latest + docker manifest push --purge ${MANIFESTIMAGE}:${META_TAG} + done + for LEGACYIMAGE in "${QUAYIMAGE}" "${GITHUBIMAGE}"; do + docker tag ${IMAGE}:amd64-${META_TAG} ${LEGACYIMAGE}:amd64-${META_TAG} + docker tag ${IMAGE}:arm32v7-${META_TAG} ${LEGACYIMAGE}:arm32v7-${META_TAG} + docker tag ${IMAGE}:arm64v8-${META_TAG} ${LEGACYIMAGE}:arm64v8-${META_TAG} + docker tag ${LEGACYIMAGE}:amd64-${META_TAG} ${LEGACYIMAGE}:latest + docker tag ${LEGACYIMAGE}:amd64-${META_TAG} ${LEGACYIMAGE}:${META_TAG} + docker tag ${LEGACYIMAGE}:arm32v7-${META_TAG} ${LEGACYIMAGE}:arm32v7-latest + docker tag ${LEGACYIMAGE}:arm64v8-${META_TAG} ${LEGACYIMAGE}:arm64v8-latest + docker push ${LEGACYIMAGE}:amd64-${META_TAG} + docker push ${LEGACYIMAGE}:arm32v7-${META_TAG} + docker push ${LEGACYIMAGE}:arm64v8-${META_TAG} + docker push ${LEGACYIMAGE}:latest + docker push ${LEGACYIMAGE}:${META_TAG} + docker push ${LEGACYIMAGE}:arm32v7-latest + docker push ${LEGACYIMAGE}:arm64v8-latest + done + ''' + sh '''#! /bin/bash + for DELETEIMAGE in "${QUAYIMAGE}" "${GITHUBIMAGE}" "${GITLABIMAGE}" "${IMAGE}"; do + docker rmi \ + ${DELETEIMAGE}:amd64-${META_TAG} \ + ${DELETEIMAGE}:amd64-latest \ + ${DELETEIMAGE}:arm32v7-${META_TAG} \ + ${DELETEIMAGE}:arm32v7-latest \ + ${DELETEIMAGE}:arm64v8-${META_TAG} \ + ${DELETEIMAGE}:arm64v8-latest || : + done + docker rmi \ lsiodev/buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} \ - lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} || :''' + lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} || : + ''' } } } @@ -673,5 +752,8 @@ pipeline { } } } + cleanup { + cleanWs() + } } } diff --git a/README.md b/README.md index d67876d..def81c5 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,9 @@ [![Discord](https://img.shields.io/discord/354974912613449730.svg?style=flat-square&color=E68523&label=Discord&logo=discord&logoColor=FFFFFF)](https://discord.gg/YWrKVTn "realtime support / chat with the community and the team.") [![Discourse](https://img.shields.io/discourse/https/discourse.linuxserver.io/topics.svg?style=flat-square&color=E68523&logo=discourse&logoColor=FFFFFF)](https://discourse.linuxserver.io "post on our community forum.") [![Fleet](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Fleet)](https://fleet.linuxserver.io "an online web interface which displays all of our maintained images.") +[![GitHub](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=GitHub&logo=github&logoColor=FFFFFF)](https://github.com/linuxserver "view the source for all of our repositories.") [![Podcast](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Podcast)](https://anchor.fm/linuxserverio "on hiatus. Coming back soon (late 2018).") -[![Open Collective](https://img.shields.io/opencollective/all/linuxserver.svg?style=flat-square&color=E68523&label=Open%20Collective%20Supporters)](https://opencollective.com/linuxserver "please consider helping us by either donating or contributing to our budget") +[![Open Collective](https://img.shields.io/opencollective/all/linuxserver.svg?style=flat-square&color=E68523&label=Supporters&logo=open%20collective&logoColor=FFFFFF)](https://opencollective.com/linuxserver "please consider helping us by either donating or contributing to our budget") The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring :- @@ -20,15 +21,20 @@ Find us at: * [Discord](https://discord.gg/YWrKVTn) - realtime support / chat with the community and the team. * [Discourse](https://discourse.linuxserver.io) - post on our community forum. * [Fleet](https://fleet.linuxserver.io) - an online web interface which displays all of our maintained images. +* [GitHub](https://github.com/linuxserver) - view the source for all of our repositories. * [Podcast](https://anchor.fm/linuxserverio) - on hiatus. Coming back soon (late 2018). * [Open Collective](https://opencollective.com/linuxserver) - please consider helping us by either donating or contributing to our budget # [linuxserver/calibre-web](https://github.com/linuxserver/docker-calibre-web) -[![GitHub Release](https://img.shields.io/github/release/linuxserver/docker-calibre-web.svg?style=flat-square&color=E68523)](https://github.com/linuxserver/docker-calibre-web/releases) + +[![GitHub Stars](https://img.shields.io/github/stars/linuxserver/docker-calibre-web.svg?style=flat-square&color=E68523&logo=github&logoColor=FFFFFF)](https://github.com/linuxserver/docker-calibre-web) +[![GitHub Release](https://img.shields.io/github/release/linuxserver/docker-calibre-web.svg?style=flat-square&color=E68523&logo=github&logoColor=FFFFFF)](https://github.com/linuxserver/docker-calibre-web/releases) +[![GitHub Package Repository](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=GitHub%20Package&logo=github&logoColor=FFFFFF)](https://github.com/linuxserver/docker-calibre-web/packages) +[![GitLab Container Registry](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=GitLab%20Registry&logo=gitlab&logoColor=FFFFFF)](https://gitlab.com/Linuxserver.io/docker-calibre-web/container_registry) +[![Quay.io](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Quay.io)](https://quay.io/repository/linuxserver.io/calibre-web) [![MicroBadger Layers](https://img.shields.io/microbadger/layers/linuxserver/calibre-web.svg?style=flat-square&color=E68523)](https://microbadger.com/images/linuxserver/calibre-web "Get your own version badge on microbadger.com") -[![MicroBadger Size](https://img.shields.io/microbadger/image-size/linuxserver/calibre-web.svg?style=flat-square&color=E68523)](https://microbadger.com/images/linuxserver/calibre-web "Get your own version badge on microbadger.com") -[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/calibre-web.svg?style=flat-square&color=E68523)](https://hub.docker.com/r/linuxserver/calibre-web) -[![Docker Stars](https://img.shields.io/docker/stars/linuxserver/calibre-web.svg?style=flat-square&color=E68523)](https://hub.docker.com/r/linuxserver/calibre-web) +[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/calibre-web.svg?style=flat-square&color=E68523&label=pulls&logo=docker&logoColor=FFFFFF)](https://hub.docker.com/r/linuxserver/calibre-web) +[![Docker Stars](https://img.shields.io/docker/stars/linuxserver/calibre-web.svg?style=flat-square&color=E68523&label=stars&logo=docker&logoColor=FFFFFF)](https://hub.docker.com/r/linuxserver/calibre-web) [![Build Status](https://ci.linuxserver.io/view/all/job/Docker-Pipeline-Builders/job/docker-calibre-web/job/master/badge/icon?style=flat-square)](https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-calibre-web/job/master/) [![](https://lsio-ci.ams3.digitaloceanspaces.com/linuxserver/calibre-web/latest/badge.svg)](https://lsio-ci.ams3.digitaloceanspaces.com/linuxserver/calibre-web/latest/index.html)