From 8fffb1da8da86352260ba031c594bbea2d2c89ce Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 23 Dec 2023 18:11:19 -0600 Subject: [PATCH 1/3] Rebase to Alpine 3.19 Signed-off-by: Eric Nemchik --- .github/workflows/external_trigger.yml | 4 +- Dockerfile | 68 +++++++++++++------------- Dockerfile.aarch64 | 68 +++++++++++++------------- jenkins-vars.yml | 4 +- readme-vars.yml | 3 +- 5 files changed, 74 insertions(+), 73 deletions(-) diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index e3a5e5a..ae05652 100755 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -20,7 +20,7 @@ jobs: echo "**** External trigger running off of master branch. To disable this trigger, set a Github secret named \"PAUSE_EXTERNAL_TRIGGER_NGINX_MASTER\". ****" echo "External trigger running off of master branch. To disable this trigger, set a Github secret named \`PAUSE_EXTERNAL_TRIGGER_NGINX_MASTER\`" >> $GITHUB_STEP_SUMMARY echo "**** Retrieving external version ****" - EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ + EXT_RELEASE=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ && awk '/^P:'"nginx"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then echo "**** Can't retrieve external version, exiting ****" @@ -74,7 +74,7 @@ jobs: echo "**** Version ${EXT_RELEASE} already pushed, exiting ****" echo "Version ${EXT_RELEASE} already pushed, exiting" >> $GITHUB_STEP_SUMMARY exit 0 - elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.18/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"nginx"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then + elif [[ $(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.19/main/aarch64/APKINDEX.tar.gz" | tar -xz -C /tmp && awk '/^P:'"nginx"'$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://') != "${EXT_RELEASE}" ]]; then echo "**** New version ${EXT_RELEASE} found; but not all arch repos updated yet; exiting ****" echo "New version ${EXT_RELEASE} found; but not all arch repos updated yet; exiting" >> $GITHUB_STEP_SUMMARY FAILURE_REASON="New version ${EXT_RELEASE} for nginx tag latest is detected, however not all arch repos are updated yet. Will try again later." diff --git a/Dockerfile b/Dockerfile index 3b38a38..4281d8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.18 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:3.19 # set version label ARG BUILD_DATE @@ -13,7 +13,7 @@ LABEL maintainer="aptalca" # install packages RUN \ if [ -z ${NGINX_VERSION+x} ]; then \ - NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ + NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ && awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ fi && \ apk add --no-cache \ @@ -38,38 +38,38 @@ RUN \ nginx-mod-stream-geoip==${NGINX_VERSION} \ nginx-mod-stream-geoip2==${NGINX_VERSION} \ nginx-vim==${NGINX_VERSION} \ - php82-bcmath \ - php82-bz2 \ - php82-dom \ - php82-exif \ - php82-ftp \ - php82-gd \ - php82-gmp \ - php82-imap \ - php82-intl \ - php82-ldap \ - php82-mysqli \ - php82-mysqlnd \ - php82-opcache \ - php82-pdo_mysql \ - php82-pdo_odbc \ - php82-pdo_pgsql \ - php82-pdo_sqlite \ - php82-pear \ - php82-pecl-apcu \ - php82-pecl-memcached \ - php82-pecl-redis \ - php82-pgsql \ - php82-posix \ - php82-soap \ - php82-sockets \ - php82-sodium \ - php82-sqlite3 \ - php82-tokenizer \ - php82-xmlreader \ - php82-xsl && \ - apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \ - php82-pecl-mcrypt + php83-bcmath \ + php83-bz2 \ + php83-dom \ + php83-exif \ + php83-ftp \ + php83-gd \ + php83-gmp \ + php83-imap \ + php83-intl \ + php83-ldap \ + php83-mysqli \ + php83-mysqlnd \ + php83-opcache \ + php83-pdo_mysql \ + php83-pdo_odbc \ + php83-pdo_pgsql \ + php83-pdo_sqlite \ + php83-pear \ + php83-pecl-apcu \ + php83-pecl-memcached \ + php83-pecl-redis \ + php83-pgsql \ + php83-posix \ + php83-soap \ + php83-sockets \ + php83-sodium \ + php83-sqlite3 \ + php83-tokenizer \ + php83-xmlreader \ + php83-xsl && \ + apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + php83-pecl-mcrypt # ports and volumes EXPOSE 80 443 diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 6eb3fb7..2bda777 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.18 +FROM ghcr.io/linuxserver/baseimage-alpine-nginx:arm64v8-3.19 # set version label ARG BUILD_DATE @@ -13,7 +13,7 @@ LABEL maintainer="aptalca" # install packages RUN \ if [ -z ${NGINX_VERSION+x} ]; then \ - NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ + NGINX_VERSION=$(curl -sL "http://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz" | tar -xz -C /tmp \ && awk '/^P:nginx$/,/V:/' /tmp/APKINDEX | sed -n 2p | sed 's/^V://'); \ fi && \ apk add --no-cache \ @@ -38,38 +38,38 @@ RUN \ nginx-mod-stream-geoip==${NGINX_VERSION} \ nginx-mod-stream-geoip2==${NGINX_VERSION} \ nginx-vim==${NGINX_VERSION} \ - php82-bcmath \ - php82-bz2 \ - php82-dom \ - php82-exif \ - php82-ftp \ - php82-gd \ - php82-gmp \ - php82-imap \ - php82-intl \ - php82-ldap \ - php82-mysqli \ - php82-mysqlnd \ - php82-opcache \ - php82-pdo_mysql \ - php82-pdo_odbc \ - php82-pdo_pgsql \ - php82-pdo_sqlite \ - php82-pear \ - php82-pecl-apcu \ - php82-pecl-memcached \ - php82-pecl-redis \ - php82-pgsql \ - php82-posix \ - php82-soap \ - php82-sockets \ - php82-sodium \ - php82-sqlite3 \ - php82-tokenizer \ - php82-xmlreader \ - php82-xsl && \ - apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \ - php82-pecl-mcrypt + php83-bcmath \ + php83-bz2 \ + php83-dom \ + php83-exif \ + php83-ftp \ + php83-gd \ + php83-gmp \ + php83-imap \ + php83-intl \ + php83-ldap \ + php83-mysqli \ + php83-mysqlnd \ + php83-opcache \ + php83-pdo_mysql \ + php83-pdo_odbc \ + php83-pdo_pgsql \ + php83-pdo_sqlite \ + php83-pear \ + php83-pecl-apcu \ + php83-pecl-memcached \ + php83-pecl-redis \ + php83-pgsql \ + php83-posix \ + php83-soap \ + php83-sockets \ + php83-sodium \ + php83-sqlite3 \ + php83-tokenizer \ + php83-xmlreader \ + php83-xsl && \ + apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ + php83-pecl-mcrypt # ports and volumes EXPOSE 80 443 diff --git a/jenkins-vars.yml b/jenkins-vars.yml index ec35302..3474c8c 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -16,8 +16,8 @@ repo_vars: - DEV_DOCKERHUB_IMAGE = 'lsiodev/nginx' - PR_DOCKERHUB_IMAGE = 'lspipepr/nginx' - DIST_IMAGE = 'alpine' - - DIST_TAG = '3.18' - - DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.18/main/' + - DIST_TAG = '3.19' + - DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.19/main/' - DIST_REPO_PACKAGES = 'nginx' - MULTIARCH='true' - CI='true' diff --git a/readme-vars.yml b/readme-vars.yml index f2bc56d..a111c23 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -17,7 +17,7 @@ common_param_env_vars_enabled: true param_container_name: "{{ project_name }}" param_usage_include_vols: true param_volumes: - - { vol_path: "/config", vol_host_path: "", desc: "Contains your www content and all relevant configuration files." } + - { vol_path: "/config", vol_host_path: "/path/to/{{ project_name }}/config", desc: "Persistent config files" } param_usage_include_ports: true param_ports: - { external_port: "80", internal_port: "80", port_desc: "http" } @@ -39,6 +39,7 @@ app_setup_block: | # changelog changelogs: + - { date: "23.12.23:", desc: "Rebase to Alpine 3.19 with php 8.3."} - { date: "25.05.23:", desc: "Rebase to Alpine 3.18, deprecate armhf." } - { date: "16.01.23:", desc: "Remove nchan module because it keeps causing crashes." } - { date: "22.12.22:", desc: "Rebase to Alpine 3.17 with PHP 8.1, migrate to s6v3." } From 85b21e43dd9d35e49b18d06919aa109c5a5a31a2 Mon Sep 17 00:00:00 2001 From: Eric Nemchik Date: Sat, 23 Dec 2023 20:09:28 -0600 Subject: [PATCH 2/3] Run jenkins Signed-off-by: Eric Nemchik --- Jenkinsfile | 4 ++-- README.md | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 54a42cc..b2b91f1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,8 +24,8 @@ pipeline { DEV_DOCKERHUB_IMAGE = 'lsiodev/nginx' PR_DOCKERHUB_IMAGE = 'lspipepr/nginx' DIST_IMAGE = 'alpine' - DIST_TAG = '3.18' - DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.18/main/' + DIST_TAG = '3.19' + DIST_REPO = 'http://dl-cdn.alpinelinux.org/alpine/v3.19/main/' DIST_REPO_PACKAGES = 'nginx' MULTIARCH='true' CI='true' diff --git a/README.md b/README.md index 7c4d06a..1de952f 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ services: - PGID=1000 - TZ=Etc/UTC volumes: - - :/config + - /path/to/nginx/config:/config ports: - 80:80 - 443:443 @@ -98,7 +98,7 @@ docker run -d \ -e TZ=Etc/UTC \ -p 80:80 \ -p 443:443 \ - -v :/config \ + -v /path/to/nginx/config:/config \ --restart unless-stopped \ lscr.io/linuxserver/nginx:latest ``` @@ -114,7 +114,7 @@ Containers are configured using parameters passed at runtime (such as those abov | `-e PUID=1000` | for UserID - see below for explanation | | `-e PGID=1000` | for GroupID - see below for explanation | | `-e TZ=Etc/UTC` | specify a timezone to use, see this [list](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List). | -| `-v /config` | Contains your www content and all relevant configuration files. | +| `-v /config` | Persistent config files | ## Environment variables from files (Docker secrets) @@ -292,6 +292,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions +* **23.12.23:** - Rebase to Alpine 3.19 with php 8.3. * **25.05.23:** - Rebase to Alpine 3.18, deprecate armhf. * **16.01.23:** - Remove nchan module because it keeps causing crashes. * **22.12.22:** - Rebase to Alpine 3.17 with PHP 8.1, migrate to s6v3. From a4b7bd5f896a2733e122593656560a02c6807f57 Mon Sep 17 00:00:00 2001 From: aptalca <541623+aptalca@users.noreply.github.com> Date: Tue, 5 Mar 2024 19:32:39 -0500 Subject: [PATCH 3/3] update edge repo, remove stream.conf --- .github/ISSUE_TEMPLATE/issue.bug.yml | 4 +- .github/workflows/external_trigger.yml | 2 +- .../workflows/external_trigger_scheduler.yml | 2 +- .github/workflows/package_trigger.yml | 2 +- .../workflows/package_trigger_scheduler.yml | 2 +- Dockerfile | 7 +- Dockerfile.aarch64 | 7 +- Jenkinsfile | 118 +++++++++--------- README.md | 20 +-- readme-vars.yml | 2 +- 10 files changed, 75 insertions(+), 91 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/issue.bug.yml b/.github/ISSUE_TEMPLATE/issue.bug.yml index ce3d19a..33f8b46 100755 --- a/.github/ISSUE_TEMPLATE/issue.bug.yml +++ b/.github/ISSUE_TEMPLATE/issue.bug.yml @@ -67,10 +67,10 @@ body: - type: textarea attributes: description: | - Provide a full docker log, output of "docker logs linuxserver.io" + Provide a full docker log, output of "docker logs nginx" label: Container logs placeholder: | - Output of `docker logs linuxserver.io` + Output of `docker logs nginx` render: bash validations: required: true diff --git a/.github/workflows/external_trigger.yml b/.github/workflows/external_trigger.yml index ae05652..96949f1 100755 --- a/.github/workflows/external_trigger.yml +++ b/.github/workflows/external_trigger.yml @@ -7,7 +7,7 @@ jobs: external-trigger-master: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.1.0 + - uses: actions/checkout@v4.1.1 - name: External Trigger if: github.ref == 'refs/heads/master' diff --git a/.github/workflows/external_trigger_scheduler.yml b/.github/workflows/external_trigger_scheduler.yml index e52a170..c70259e 100755 --- a/.github/workflows/external_trigger_scheduler.yml +++ b/.github/workflows/external_trigger_scheduler.yml @@ -9,7 +9,7 @@ jobs: external-trigger-scheduler: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.1.0 + - uses: actions/checkout@v4.1.1 with: fetch-depth: '0' diff --git a/.github/workflows/package_trigger.yml b/.github/workflows/package_trigger.yml index 9a39748..cedb444 100755 --- a/.github/workflows/package_trigger.yml +++ b/.github/workflows/package_trigger.yml @@ -7,7 +7,7 @@ jobs: package-trigger-master: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.1.0 + - uses: actions/checkout@v4.1.1 - name: Package Trigger if: github.ref == 'refs/heads/master' diff --git a/.github/workflows/package_trigger_scheduler.yml b/.github/workflows/package_trigger_scheduler.yml index 9b10474..e7a640e 100755 --- a/.github/workflows/package_trigger_scheduler.yml +++ b/.github/workflows/package_trigger_scheduler.yml @@ -9,7 +9,7 @@ jobs: package-trigger-scheduler: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.1.0 + - uses: actions/checkout@v4.1.1 with: fetch-depth: '0' diff --git a/Dockerfile b/Dockerfile index 4281d8a..7ca4633 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ ARG BUILD_DATE ARG VERSION ARG NGINX_VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="aptalca" +LABEL maintainer="nemchik" # install packages @@ -68,8 +68,9 @@ RUN \ php83-tokenizer \ php83-xmlreader \ php83-xsl && \ - apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - php83-pecl-mcrypt + apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \ + php83-pecl-mcrypt && \ + rm -f /etc/nginx/conf.d/stream.conf # ports and volumes EXPOSE 80 443 diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 2bda777..87098bd 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -7,7 +7,7 @@ ARG BUILD_DATE ARG VERSION ARG NGINX_VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -LABEL maintainer="aptalca" +LABEL maintainer="nemchik" # install packages @@ -68,8 +68,9 @@ RUN \ php83-tokenizer \ php83-xmlreader \ php83-xsl && \ - apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - php83-pecl-mcrypt + apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \ + php83-pecl-mcrypt && \ + rm -f /etc/nginx/conf.d/stream.conf # ports and volumes EXPOSE 80 443 diff --git a/Jenkinsfile b/Jenkinsfile index b2b91f1..730f479 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,6 +16,7 @@ pipeline { GITHUB_TOKEN=credentials('498b4638-2d02-4ce5-832d-8a57d01d97ab') GITLAB_TOKEN=credentials('b6f0f1dd-6952-4cf6-95d1-9c06380283f0') GITLAB_NAMESPACE=credentials('gitlab-namespace-id') + DOCKERHUB_TOKEN=credentials('docker-hub-ci-pat') BUILD_VERSION_ARG = 'NGINX_VERSION' LS_USER = 'linuxserver' LS_REPO = 'docker-nginx' @@ -61,11 +62,16 @@ pipeline { env.COMMIT_SHA = sh( script: '''git rev-parse HEAD''', returnStdout: true).trim() + env.GH_DEFAULT_BRANCH = sh( + script: '''git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||' ''', + returnStdout: true).trim() 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.PULL_REQUEST = env.CHANGE_ID env.TEMPLATED_FILES = 'Jenkinsfile README.md LICENSE .editorconfig ./.github/CONTRIBUTING.md ./.github/FUNDING.yml ./.github/ISSUE_TEMPLATE/config.yml ./.github/ISSUE_TEMPLATE/issue.bug.yml ./.github/ISSUE_TEMPLATE/issue.feature.yml ./.github/PULL_REQUEST_TEMPLATE.md ./.github/workflows/external_trigger_scheduler.yml ./.github/workflows/greetings.yml ./.github/workflows/package_trigger_scheduler.yml ./.github/workflows/call_issue_pr_tracker.yml ./.github/workflows/call_issues_cron.yml ./.github/workflows/permissions.yml ./.github/workflows/external_trigger.yml ./.github/workflows/package_trigger.yml' } + sh '''#! /bin/bash + echo "The default github branch detected as ${GH_DEFAULT_BRANCH}" ''' script{ env.LS_RELEASE_NUMBER = sh( script: '''echo ${LS_RELEASE} |sed 's/^.*-ls//g' ''', @@ -124,7 +130,7 @@ pipeline { steps{ script{ env.EXT_RELEASE_CLEAN = sh( - script: '''echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g' ''', + script: '''echo ${EXT_RELEASE} | sed 's/[~,%@+;:/ ]//g' ''', returnStdout: true).trim() def semver = env.EXT_RELEASE_CLEAN =~ /(\d+)\.(\d+)\.(\d+)/ @@ -142,7 +148,7 @@ pipeline { } if (env.SEMVER != null) { - if (BRANCH_NAME != "master" && BRANCH_NAME != "main") { + if (BRANCH_NAME != "${env.GH_DEFAULT_BRANCH}") { env.SEMVER = "${env.SEMVER}-${BRANCH_NAME}" } println("SEMVER: ${env.SEMVER}") @@ -243,9 +249,11 @@ pipeline { -v ${WORKSPACE}:/mnt \ -e AWS_ACCESS_KEY_ID=\"${S3_KEY}\" \ -e AWS_SECRET_ACCESS_KEY=\"${S3_SECRET}\" \ - ghcr.io/linuxserver/baseimage-alpine:3.17 s6-envdir -fn -- /var/run/s6/container_environment /bin/bash -c "\ - apk add --no-cache py3-pip && \ - pip install s3cmd && \ + ghcr.io/linuxserver/baseimage-alpine:3.19 s6-envdir -fn -- /var/run/s6/container_environment /bin/bash -c "\ + apk add --no-cache python3 && \ + python3 -m venv /lsiopy && \ + pip install --no-cache-dir -U pip && \ + pip install --no-cache-dir s3cmd && \ s3cmd put --no-preserve --acl-public -m text/xml /mnt/shellcheck-result.xml s3://ci-tests.linuxserver.io/${IMAGE}/${META_TAG}/shellcheck-result.xml" || :''' } } @@ -274,7 +282,8 @@ pipeline { cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/ git add Jenkinsfile git commit -m 'Bot Updating Templated Files' - git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all + git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master + git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} echo "Updating Jenkinsfile" rm -Rf ${TEMPDIR} @@ -298,7 +307,8 @@ pipeline { git rm "${i}" done git commit -m 'Bot Updating Templated Files' - git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all + git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master + git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} echo "Deleting old and deprecated templates" rm -Rf ${TEMPDIR} @@ -327,19 +337,26 @@ pipeline { fi git add readme-vars.yml ${TEMPLATED_FILES} git commit -m 'Bot Updating Templated Files' - git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all + git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master + git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} else echo "false" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} fi mkdir -p ${TEMPDIR}/docs git clone https://github.com/linuxserver/docker-documentation.git ${TEMPDIR}/docs/docker-documentation - 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 + if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]] && [[ (! -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 cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/docker-${CONTAINER_NAME}.md ${TEMPDIR}/docs/docker-documentation/docs/images/ cd ${TEMPDIR}/docs/docker-documentation + GH_DOCS_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||') git add docs/images/docker-${CONTAINER_NAME}.md git commit -m 'Bot Updating Documentation' - git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git --all + git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase + git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} || \ + (MAXWAIT="10" && echo "Push to docs failed, trying again in ${MAXWAIT} seconds" && \ + sleep $((RANDOM % MAXWAIT)) && \ + git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH} --rebase && \ + git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/docker-documentation.git ${GH_DOCS_DEFAULT_BRANCH}) fi mkdir -p ${TEMPDIR}/unraid git clone https://github.com/linuxserver/docker-templates.git ${TEMPDIR}/unraid/docker-templates @@ -349,8 +366,9 @@ pipeline { elif [[ -f ${TEMPDIR}/unraid/docker-templates/linuxserver.io/img/${CONTAINER_NAME}-icon.png ]]; then sed -i "s|master/linuxserver.io/img/linuxserver-ls-logo.png|master/linuxserver.io/img/${CONTAINER_NAME}-icon.png|" ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml fi - if [[ ("${BRANCH_NAME}" == "master") || ("${BRANCH_NAME}" == "main") ]] && [[ (! -f ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml) || ("$(md5sum ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml | awk '{ print $1 }')") ]]; then + if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]] && [[ (! -f ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml) || ("$(md5sum ${TEMPDIR}/unraid/templates/unraid/${CONTAINER_NAME}.xml | awk '{ print $1 }')" != "$(md5sum ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml | awk '{ print $1 }')") ]]; then cd ${TEMPDIR}/unraid/templates/ + GH_TEMPLATES_DEFAULT_BRANCH=$(git remote show origin | grep "HEAD branch:" | sed 's|.*HEAD branch: ||') if grep -wq "${CONTAINER_NAME}" ${TEMPDIR}/unraid/templates/unraid/ignore.list; then echo "Image is on the ignore list, marking Unraid template as deprecated" cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/${CONTAINER_NAME}.xml ${TEMPDIR}/unraid/templates/unraid/ @@ -362,7 +380,31 @@ pipeline { git add unraid/${CONTAINER_NAME}.xml git commit -m 'Bot Updating Unraid Template' fi - git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git --all + git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git ${GH_TEMPLATES_DEFAULT_BRANCH} --rebase + git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git ${GH_TEMPLATES_DEFAULT_BRANCH} || \ + (MAXWAIT="10" && echo "Push to unraid templates failed, trying again in ${MAXWAIT} seconds" && \ + sleep $((RANDOM % MAXWAIT)) && \ + git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git ${GH_TEMPLATES_DEFAULT_BRANCH} --rebase && \ + git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/linuxserver/templates.git ${GH_TEMPLATES_DEFAULT_BRANCH}) + fi + # Stage 4 - Sync Readme to Docker Hub + if [[ "${BRANCH_NAME}" == "${GH_DEFAULT_BRANCH}" ]]; then + if [[ $(cat ${TEMPDIR}/docker-${CONTAINER_NAME}/README.md | wc -m) > 25000 ]]; then + echo "Readme is longer than 25,000 characters. Syncing the lite version to Docker Hub" + DH_README_SYNC_PATH="${TEMPDIR}/docker-${CONTAINER_NAME}/.jenkins-external/README.lite" + else + echo "Syncing readme to Docker Hub" + DH_README_SYNC_PATH="${TEMPDIR}/docker-${CONTAINER_NAME}/README.md" + fi + DH_TOKEN=$(curl -d '{"username":"linuxserverci", "password":"'${DOCKERHUB_TOKEN}'"}' -H "Content-Type: application/json" -X POST https://hub.docker.com/v2/users/login | jq -r '.token') + curl -s \ + -H "Authorization: JWT ${DH_TOKEN}" \ + -H "Content-Type: application/json" \ + -X PATCH \ + -d "{\\"full_description\\":$(jq -Rsa . ${DH_README_SYNC_PATH})}" \ + https://hub.docker.com/v2/repositories/${DOCKERHUB_IMAGE} || : + else + echo "Not the default Github branch. Skipping readme sync to Docker Hub." fi rm -Rf ${TEMPDIR}''' script{ @@ -562,7 +604,8 @@ pipeline { wait git add package_versions.txt git commit -m 'Bot Updating Package Versions' - git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all + git pull https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master + git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git master echo "true" > /tmp/packages-${COMMIT_SHA}-${BUILD_NUMBER} echo "Package tag updated, stopping build process" else @@ -665,12 +708,6 @@ pipeline { } steps { withCredentials([ - [ - $class: 'UsernamePasswordMultiBinding', - credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', - usernameVariable: 'DOCKERUSER', - passwordVariable: 'DOCKERPASS' - ], [ $class: 'UsernamePasswordMultiBinding', credentialsId: 'Quay.io-Robot', @@ -681,7 +718,7 @@ pipeline { retry(5) { sh '''#! /bin/bash set -e - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin @@ -712,12 +749,6 @@ pipeline { } steps { withCredentials([ - [ - $class: 'UsernamePasswordMultiBinding', - credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', - usernameVariable: 'DOCKERUSER', - passwordVariable: 'DOCKERPASS' - ], [ $class: 'UsernamePasswordMultiBinding', credentialsId: 'Quay.io-Robot', @@ -728,7 +759,7 @@ pipeline { retry(5) { sh '''#! /bin/bash set -e - echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin + echo $DOCKERHUB_TOKEN | docker login -u linuxserverci --password-stdin echo $GITHUB_TOKEN | docker login ghcr.io -u LinuxServer-CI --password-stdin echo $GITLAB_TOKEN | docker login registry.gitlab.com -u LinuxServer.io --password-stdin echo $QUAYPASS | docker login quay.io -u $QUAYUSER --password-stdin @@ -858,39 +889,6 @@ EOF ) ''' } } - // Use helper container to sync the current README on master to the dockerhub endpoint - stage('Sync-README') { - when { - environment name: 'CHANGE_ID', value: '' - environment name: 'EXIT_STATUS', value: '' - } - steps { - withCredentials([ - [ - $class: 'UsernamePasswordMultiBinding', - credentialsId: '3f9ba4d5-100d-45b0-a3c4-633fd6061207', - usernameVariable: 'DOCKERUSER', - passwordVariable: 'DOCKERPASS' - ] - ]) { - sh '''#! /bin/bash - set -e - TEMPDIR=$(mktemp -d) - docker pull ghcr.io/linuxserver/jenkins-builder:latest - docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH="${BRANCH_NAME}" -v ${TEMPDIR}:/ansible/jenkins ghcr.io/linuxserver/jenkins-builder:latest - docker pull ghcr.io/linuxserver/readme-sync - docker run --rm=true \ - -e DOCKERHUB_USERNAME=$DOCKERUSER \ - -e DOCKERHUB_PASSWORD=$DOCKERPASS \ - -e GIT_REPOSITORY=${LS_USER}/${LS_REPO} \ - -e DOCKER_REPOSITORY=${IMAGE} \ - -e GIT_BRANCH=master \ - -v ${TEMPDIR}/docker-${CONTAINER_NAME}:/mnt \ - ghcr.io/linuxserver/readme-sync bash -c 'node sync' - rm -Rf ${TEMPDIR} ''' - } - } - } // If this is a Pull request send the CI link as a comment on it stage('Pull Request Comment') { when { diff --git a/README.md b/README.md index 1de952f..4317a01 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,6 @@ To help you get started creating a container from this image you can either use ```yaml --- -version: "2.1" services: nginx: image: lscr.io/linuxserver/nginx:latest @@ -185,7 +184,7 @@ We publish various [Docker Mods](https://github.com/linuxserver/docker-mods) to ## Updating Info -Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (ie. nextcloud, plex), we do not recommend or support updating apps inside the container. Please consult the [Application Setup](#application-setup) section above to see if it is recommended for the image. +Most of our images are static, versioned, and require an image update and container recreation to update the app inside. With some exceptions (noted in the relevant readme.md), we do not recommend or support updating apps inside the container. Please consult the [Application Setup](#application-setup) section above to see if it is recommended for the image. Below are the instructions for updating containers: @@ -250,21 +249,6 @@ Below are the instructions for updating containers: docker image prune ``` -### Via Watchtower auto-updater (only use if you don't remember the original parameters) - -* Pull the latest image at its tag and replace it with the same env variables in one run: - - ```bash - docker run --rm \ - -v /var/run/docker.sock:/var/run/docker.sock \ - containrrr/watchtower \ - --run-once nginx - ``` - -* You can also remove the old dangling images: `docker image prune` - -**warning**: We do not endorse the use of Watchtower as a solution to automated updates of existing Docker containers. In fact we generally discourage automated updates. However, this is a useful tool for one-time manual updates of containers where you have forgotten the original parameters. In the long term, we highly recommend using [Docker Compose](https://docs.linuxserver.io/general/docker-compose). - ### Image Update Notifications - Diun (Docker Image Update Notifier) **tip**: We recommend [Diun](https://crazymax.dev/diun/) for update notifications. Other tools that automatically update containers unattended are not recommended or supported. @@ -292,7 +276,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64 ## Versions -* **23.12.23:** - Rebase to Alpine 3.19 with php 8.3. +* **05.03.24:** - Rebase to Alpine 3.19 with php 8.3. * **25.05.23:** - Rebase to Alpine 3.18, deprecate armhf. * **16.01.23:** - Remove nchan module because it keeps causing crashes. * **22.12.22:** - Rebase to Alpine 3.17 with PHP 8.1, migrate to s6v3. diff --git a/readme-vars.yml b/readme-vars.yml index a111c23..89e4006 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -39,7 +39,7 @@ app_setup_block: | # changelog changelogs: - - { date: "23.12.23:", desc: "Rebase to Alpine 3.19 with php 8.3."} + - { date: "05.03.24:", desc: "Rebase to Alpine 3.19 with php 8.3."} - { date: "25.05.23:", desc: "Rebase to Alpine 3.18, deprecate armhf." } - { date: "16.01.23:", desc: "Remove nchan module because it keeps causing crashes." } - { date: "22.12.22:", desc: "Rebase to Alpine 3.17 with PHP 8.1, migrate to s6v3." }