From f9797c065870eb5be170179fb9efc2c8edd739fb Mon Sep 17 00:00:00 2001 From: dkanada Date: Sat, 13 Jun 2020 00:18:20 +0900 Subject: [PATCH 01/18] add packaging step on azure and refactor pipelines --- .ci/azure-pipelines-build.yml | 57 ++++++++++++ .ci/azure-pipelines-lint.yml | 29 ++++++ .ci/azure-pipelines-package.yml | 30 +++++++ .ci/azure-pipelines.yml | 88 +------------------ ...ockerfile.centos.all => Dockerfile.centos} | 16 ++-- ...ockerfile.debian.all => Dockerfile.debian} | 10 ++- ...ockerfile.fedora.all => Dockerfile.fedora} | 10 ++- deployment/Dockerfile.portable | 9 +- deployment/{build.centos.all => build.centos} | 10 +-- deployment/{build.debian.all => build.debian} | 12 ++- deployment/{build.fedora.all => build.fedora} | 12 ++- deployment/build.portable | 22 +++-- fedora/jellyfin-web.spec | 2 +- 13 files changed, 170 insertions(+), 137 deletions(-) create mode 100644 .ci/azure-pipelines-build.yml create mode 100644 .ci/azure-pipelines-lint.yml create mode 100644 .ci/azure-pipelines-package.yml rename deployment/{Dockerfile.centos.all => Dockerfile.centos} (51%) rename deployment/{Dockerfile.debian.all => Dockerfile.debian} (69%) rename deployment/{Dockerfile.fedora.all => Dockerfile.fedora} (56%) rename deployment/{build.centos.all => build.centos} (74%) rename deployment/{build.debian.all => build.debian} (64%) rename deployment/{build.fedora.all => build.fedora} (66%) diff --git a/.ci/azure-pipelines-build.yml b/.ci/azure-pipelines-build.yml new file mode 100644 index 0000000000..026afe76a6 --- /dev/null +++ b/.ci/azure-pipelines-build.yml @@ -0,0 +1,57 @@ +jobs: +- job: Build + displayName: 'Build' + + strategy: + matrix: + Development: + BuildConfiguration: development + Production: + BuildConfiguration: production + + pool: + vmImage: 'ubuntu-latest' + + steps: + - task: NodeTool@0 + displayName: 'Install Node' + inputs: + versionSpec: '12.x' + + - task: Cache@2 + displayName: 'Check Cache' + inputs: + key: 'yarn | yarn.lock' + path: 'node_modules' + cacheHitVar: CACHE_RESTORED + + - script: 'yarn install --frozen-lockfile' + displayName: 'Install Dependencies' + condition: ne(variables.CACHE_RESTORED, 'true') + + - script: 'yarn build:development' + displayName: 'Build Development' + condition: eq(variables['BuildConfiguration'], 'development') + + - script: 'yarn build:production' + displayName: 'Build Production' + condition: eq(variables['BuildConfiguration'], 'production') + + - script: 'test -d dist' + displayName: 'Check Build' + + - script: 'mv dist jellyfin-web' + displayName: 'Rename Directory' + + - task: ArchiveFiles@2 + displayName: 'Archive Directory' + inputs: + rootFolderOrFile: 'jellyfin-web' + includeRootFolder: true + archiveFile: 'jellyfin-web-$(BuildConfiguration)' + + - task: PublishPipelineArtifact@1 + displayName: 'Publish Release' + inputs: + targetPath: '$(Build.SourcesDirectory)/jellyfin-web-$(BuildConfiguration).zip' + artifactName: 'jellyfin-web-$(BuildConfiguration)' diff --git a/.ci/azure-pipelines-lint.yml b/.ci/azure-pipelines-lint.yml new file mode 100644 index 0000000000..1e4bddbd04 --- /dev/null +++ b/.ci/azure-pipelines-lint.yml @@ -0,0 +1,29 @@ +jobs: +- job: Lint + displayName: 'Lint' + + pool: + vmImage: 'ubuntu-latest' + + steps: + - task: NodeTool@0 + displayName: 'Install Node' + inputs: + versionSpec: '12.x' + + - task: Cache@2 + displayName: 'Check Cache' + inputs: + key: 'yarn | yarn.lock' + path: 'node_modules' + cacheHitVar: CACHE_RESTORED + + - script: 'yarn install --frozen-lockfile' + displayName: 'Install Dependencies' + condition: ne(variables.CACHE_RESTORED, 'true') + + - script: 'yarn run lint --quiet' + displayName: 'Run ESLint' + + - script: 'yarn run stylelint' + displayName: 'Run Stylelint' diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml new file mode 100644 index 0000000000..e5776935a6 --- /dev/null +++ b/.ci/azure-pipelines-package.yml @@ -0,0 +1,30 @@ +jobs: +- job: Package + displayName: 'Package' + + strategy: + matrix: + CentOS: + BuildConfiguration: centos + Debian: + BuildConfiguration: debian + Fedora: + BuildConfiguration: fedora + Portable: + BuildConfiguration: portable + + pool: + vmImage: 'ubuntu-latest' + + steps: + - script: 'docker build -f deployment/Dockerfile.$(BuildConfiguration) -t jellyfin-web-$(BuildConfiguration) deployment' + displayName: 'Build Dockerfile' + + - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin jellyfin-web-$(BuildConfiguration)' + displayName: 'Run Dockerfile' + + - task: PublishPipelineArtifact@1 + displayName: 'Publish Release' + inputs: + targetPath: '$(Build.SourcesDirectory)/deployment/dist' + artifactName: 'jellyfin-web-$(BuildConfiguration)' diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 059c39aa56..3d7a5f1cde 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -12,88 +12,6 @@ pr: - '*' jobs: -- job: Build - displayName: 'Build' - - strategy: - matrix: - Development: - BuildConfiguration: development - Production: - BuildConfiguration: production - - pool: - vmImage: 'ubuntu-latest' - - steps: - - task: NodeTool@0 - displayName: 'Install Node' - inputs: - versionSpec: '12.x' - - - task: Cache@2 - displayName: 'Check Cache' - inputs: - key: 'yarn | yarn.lock' - path: 'node_modules' - cacheHitVar: CACHE_RESTORED - - - script: 'yarn install --frozen-lockfile' - displayName: 'Install Dependencies' - condition: ne(variables.CACHE_RESTORED, 'true') - - - script: 'yarn build:development' - displayName: 'Build Development' - condition: eq(variables['BuildConfiguration'], 'development') - - - script: 'yarn build:production' - displayName: 'Build Production' - condition: eq(variables['BuildConfiguration'], 'production') - - - script: 'test -d dist' - displayName: 'Check Build' - - - script: 'mv dist jellyfin-web' - displayName: 'Rename Directory' - - - task: ArchiveFiles@2 - displayName: 'Archive Directory' - inputs: - rootFolderOrFile: 'jellyfin-web' - includeRootFolder: true - archiveFile: 'jellyfin-web-$(BuildConfiguration)' - - - task: PublishPipelineArtifact@1 - displayName: 'Publish Release' - inputs: - targetPath: '$(Build.SourcesDirectory)/jellyfin-web-$(BuildConfiguration).zip' - artifactName: 'jellyfin-web-$(BuildConfiguration)' - -- job: Lint - displayName: 'Lint' - - pool: - vmImage: 'ubuntu-latest' - - steps: - - task: NodeTool@0 - displayName: 'Install Node' - inputs: - versionSpec: '12.x' - - - task: Cache@2 - displayName: 'Check Cache' - inputs: - key: 'yarn | yarn.lock' - path: 'node_modules' - cacheHitVar: CACHE_RESTORED - - - script: 'yarn install --frozen-lockfile' - displayName: 'Install Dependencies' - condition: ne(variables.CACHE_RESTORED, 'true') - - - script: 'yarn run lint --quiet' - displayName: 'Run ESLint' - - - script: 'yarn run stylelint' - displayName: 'Run Stylelint' +- template: azure-pipelines-build.yml +- template: azure-pipelines-lint.yml +- template: azure-pipelines-package.yml diff --git a/deployment/Dockerfile.centos.all b/deployment/Dockerfile.centos similarity index 51% rename from deployment/Dockerfile.centos.all rename to deployment/Dockerfile.centos index 93bf8d6988..64cffc7eed 100644 --- a/deployment/Dockerfile.centos.all +++ b/deployment/Dockerfile.centos @@ -1,7 +1,9 @@ FROM centos:7 + # Docker build arguments ARG SOURCE_DIR=/jellyfin ARG ARTIFACT_DIR=/dist + # Docker run environment ENV SOURCE_DIR=/jellyfin ENV ARTIFACT_DIR=/dist @@ -9,19 +11,19 @@ ENV IS_DOCKER=YES # Prepare CentOS environment RUN yum update -y \ - && yum install -y epel-release \ - && yum install -y @buildsys-build rpmdevtools git yum-plugins-core nodejs-yarn autoconf automake glibc-devel + && yum install -y epel-release \ + && yum install -y @buildsys-build rpmdevtools git yum-plugins-core nodejs-yarn autoconf automake glibc-devel # Install recent NodeJS and Yarn RUN curl -fSsLo /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo \ - && rpm -i https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm \ - && yum install -y yarn + && rpm -i https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm \ + && yum install -y yarn # Link to build script -RUN ln -sf ${SOURCE_DIR}/deployment/build.centos.all /build.sh +RUN ln -sf ${SOURCE_DIR}/deployment/build.centos /build.sh -VOLUME ${SOURCE_DIR}/ +VOLUME ${SOURCE_DIR} -VOLUME ${ARTIFACT_DIR}/ +VOLUME ${ARTIFACT_DIR} ENTRYPOINT ["/build.sh"] diff --git a/deployment/Dockerfile.debian.all b/deployment/Dockerfile.debian similarity index 69% rename from deployment/Dockerfile.debian.all rename to deployment/Dockerfile.debian index 54281a5eb4..80ea103b92 100644 --- a/deployment/Dockerfile.debian.all +++ b/deployment/Dockerfile.debian @@ -1,7 +1,9 @@ FROM debian:10 + # Docker build arguments ARG SOURCE_DIR=/jellyfin ARG ARTIFACT_DIR=/dist + # Docker run environment ENV SOURCE_DIR=/jellyfin ENV ARTIFACT_DIR=/dist @@ -10,16 +12,16 @@ ENV IS_DOCKER=YES # Prepare Debian build environment RUN apt-get update \ - && apt-get install -y debhelper mmv npm git + && apt-get install -y debhelper mmv npm git # Prepare Yarn RUN npm install -g yarn # Link to build script -RUN ln -sf ${SOURCE_DIR}/deployment/build.debian.all /build.sh +RUN ln -sf ${SOURCE_DIR}/deployment/build.debian /build.sh -VOLUME ${SOURCE_DIR}/ +VOLUME ${SOURCE_DIR} -VOLUME ${ARTIFACT_DIR}/ +VOLUME ${ARTIFACT_DIR} ENTRYPOINT ["/build.sh"] diff --git a/deployment/Dockerfile.fedora.all b/deployment/Dockerfile.fedora similarity index 56% rename from deployment/Dockerfile.fedora.all rename to deployment/Dockerfile.fedora index d47f4ff4da..e6026985d1 100644 --- a/deployment/Dockerfile.fedora.all +++ b/deployment/Dockerfile.fedora @@ -1,7 +1,9 @@ FROM fedora:31 + # Docker build arguments ARG SOURCE_DIR=/jellyfin ARG ARTIFACT_DIR=/dist + # Docker run environment ENV SOURCE_DIR=/jellyfin ENV ARTIFACT_DIR=/dist @@ -9,13 +11,13 @@ ENV IS_DOCKER=YES # Prepare Fedora environment RUN dnf update -y \ - && dnf install -y @buildsys-build rpmdevtools git dnf-plugins-core nodejs-yarn autoconf automake glibc-devel + && dnf install -y @buildsys-build rpmdevtools git dnf-plugins-core nodejs-yarn autoconf automake glibc-devel # Link to build script -RUN ln -sf ${SOURCE_DIR}/deployment/build.fedora.all /build.sh +RUN ln -sf ${SOURCE_DIR}/deployment/build.fedora /build.sh -VOLUME ${SOURCE_DIR}/ +VOLUME ${SOURCE_DIR} -VOLUME ${ARTIFACT_DIR}/ +VOLUME ${ARTIFACT_DIR} ENTRYPOINT ["/build.sh"] diff --git a/deployment/Dockerfile.portable b/deployment/Dockerfile.portable index e0d1f45265..0d4c79bb2f 100644 --- a/deployment/Dockerfile.portable +++ b/deployment/Dockerfile.portable @@ -1,16 +1,17 @@ FROM debian:10 + # Docker build arguments ARG SOURCE_DIR=/jellyfin ARG ARTIFACT_DIR=/dist + # Docker run environment ENV SOURCE_DIR=/jellyfin ENV ARTIFACT_DIR=/dist -ENV DEB_BUILD_OPTIONS=noddebs ENV IS_DOCKER=YES # Prepare Debian build environment RUN apt-get update \ - && apt-get install -y mmv npm git + && apt-get install -y mmv npm git # Prepare Yarn RUN npm install -g yarn @@ -18,8 +19,8 @@ RUN npm install -g yarn # Link to build script RUN ln -sf ${SOURCE_DIR}/deployment/build.portable /build.sh -VOLUME ${SOURCE_DIR}/ +VOLUME ${SOURCE_DIR} -VOLUME ${ARTIFACT_DIR}/ +VOLUME ${ARTIFACT_DIR} ENTRYPOINT ["/build.sh"] diff --git a/deployment/build.centos.all b/deployment/build.centos similarity index 74% rename from deployment/build.centos.all rename to deployment/build.centos index 8c2cec6d33..7dd0343c1f 100755 --- a/deployment/build.centos.all +++ b/deployment/build.centos @@ -1,24 +1,22 @@ #!/bin/bash -#= CentOS 7 all .rpm - set -o errexit set -o xtrace -# Move to source directory +# move to source directory pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock -# Build RPM +# build rpm make -f fedora/Makefile srpm outdir=/root/rpmbuild/SRPMS rpmbuild --rebuild -bb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm -# Move the artifacts out +# move the artifacts mv /root/rpmbuild/RPMS/noarch/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR}/ if [[ ${IS_DOCKER} == YES ]]; then - chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} + chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} fi rm -f fedora/jellyfin*.tar.gz diff --git a/deployment/build.debian.all b/deployment/build.debian similarity index 64% rename from deployment/build.debian.all rename to deployment/build.debian index 8d617a288e..15ae321662 100755 --- a/deployment/build.debian.all +++ b/deployment/build.debian @@ -1,25 +1,23 @@ #!/bin/bash -#= Debian/Ubuntu all .deb - set -o errexit set -o xtrace -# Move to source directory +# move to source directory pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock -# Build DEB +# build deb dpkg-buildpackage -us -uc --pre-clean --post-clean -mkdir -p ${ARTIFACT_DIR}/ -mv ../jellyfin*.{deb,dsc,tar.gz,buildinfo,changes} ${ARTIFACT_DIR}/ +mkdir -p ${ARTIFACT_DIR} +mv ../jellyfin*.{deb,dsc,tar.gz,buildinfo,changes} ${ARTIFACT_DIR} cp -a /tmp/yarn.lock yarn.lock if [[ ${IS_DOCKER} == YES ]]; then - chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} + chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} fi popd diff --git a/deployment/build.fedora.all b/deployment/build.fedora similarity index 66% rename from deployment/build.fedora.all rename to deployment/build.fedora index 4ba12f35ea..249403b9e7 100755 --- a/deployment/build.fedora.all +++ b/deployment/build.fedora @@ -1,24 +1,22 @@ #!/bin/bash -#= Fedora 29+ all .rpm - set -o errexit set -o xtrace -# Move to source directory +# move to source directory pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock -# Build RPM +# build rpm make -f fedora/Makefile srpm outdir=/root/rpmbuild/SRPMS rpmbuild -rb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm -# Move the artifacts out -mv /root/rpmbuild/RPMS/noarch/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR}/ +# move the artifacts +mv /root/rpmbuild/RPMS/noarch/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR} if [[ ${IS_DOCKER} == YES ]]; then - chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} + chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} fi rm -f fedora/jellyfin*.tar.gz diff --git a/deployment/build.portable b/deployment/build.portable index c4cbe927e4..272b80e857 100755 --- a/deployment/build.portable +++ b/deployment/build.portable @@ -1,28 +1,26 @@ #!/bin/bash -#= Portable .NET DLL .tar.gz - set -o errexit set -o xtrace -# Move to source directory +# move to source directory pushd ${SOURCE_DIR} -# Get version +# get version version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" -# Build archives +# build archives npx yarn install -mv dist/ jellyfin-web_${version} -tar -czf jellyfin-web_${version}_portable.tar.gz jellyfin-web_${version} -rm -rf dist/ +mv dist jellyfin-web-${version} +tar -czf jellyfin-web-${version}-portable.tar.gz jellyfin-web-${version} +rm -rf dist -# Move the artifacts out -mkdir -p ${ARTIFACT_DIR}/ -mv jellyfin[-_]*.tar.gz ${ARTIFACT_DIR}/ +# move the artifacts +mkdir -p ${ARTIFACT_DIR} +mv jellyfin[-_]*.tar.gz ${ARTIFACT_DIR} if [[ ${IS_DOCKER} == YES ]]; then - chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} + chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} fi popd diff --git a/fedora/jellyfin-web.spec b/fedora/jellyfin-web.spec index dbc0bd0efa..dcc9d9d2ab 100644 --- a/fedora/jellyfin-web.spec +++ b/fedora/jellyfin-web.spec @@ -12,7 +12,7 @@ Source0: jellyfin-web-%{version}.tar.gz %if 0%{?centos} BuildRequires: yarn %else -BuildRequires nodejs-yarn +BuildRequires: nodejs-yarn %endif BuildArch: noarch From 346e1b0dc77ef2d9480b6c7fae0ceadc581a6613 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 14:22:08 -0400 Subject: [PATCH 02/18] Add special changelog/version for unstable builds --- .ci/azure-pipelines-package.yml | 2 +- deployment/build.debian | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index e5776935a6..c6b90fdde5 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -20,7 +20,7 @@ jobs: - script: 'docker build -f deployment/Dockerfile.$(BuildConfiguration) -t jellyfin-web-$(BuildConfiguration) deployment' displayName: 'Build Dockerfile' - - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin jellyfin-web-$(BuildConfiguration)' + - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e GIT_BRANCH=$(Build.SourceBranch) -e BUILD_ID=$(Build.BuildNumber) jellyfin-web-$(BuildConfiguration)' displayName: 'Run Dockerfile' - task: PublishPipelineArtifact@1 diff --git a/deployment/build.debian b/deployment/build.debian index 15ae321662..2f58a49d20 100755 --- a/deployment/build.debian +++ b/deployment/build.debian @@ -8,6 +8,21 @@ pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock +# modify changelog to unstable configuration if IS_UNSTABLE +if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then + pushd debian/ + # get the last PR ID + PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) + cat <changelog +jellyfin-web (${BUILD_ID}-unstable) unstable; urgency=medium + + * Jellyfin unstable build ${BUILD_ID} for merged PR #${PR_ID} + + -- Jellyfin Packaging Team $( date --rfc-2822 ) +EOF + popd +fi + # build deb dpkg-buildpackage -us -uc --pre-clean --post-clean From ceacedd6fd01aaac661d46a31441de22f4ec36ef Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 15:09:23 -0400 Subject: [PATCH 03/18] Copy artifacts over to build server --- .ci/azure-pipelines-package.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index c6b90fdde5..2866b0e44a 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -28,3 +28,11 @@ jobs: inputs: targetPath: '$(Build.SourcesDirectory)/deployment/dist' artifactName: 'jellyfin-web-$(BuildConfiguration)' + + - task: CopyFilesOverSSH@0 + displayName: 'Upload artifacts to repository server' + inputs: + sshEndpoint: repository + sourceFolder: '$(Build.SourcesDirectory)/deployment/dist' + contents: '**' + targetFolder: '/srv/repository/incoming/azure' From 9e3d792f62968b24325493e509af14bfec539ae4 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 16:05:05 -0400 Subject: [PATCH 04/18] Add build_id versioning to portable build --- deployment/build.portable | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deployment/build.portable b/deployment/build.portable index 272b80e857..363c8aae06 100755 --- a/deployment/build.portable +++ b/deployment/build.portable @@ -7,7 +7,11 @@ set -o xtrace pushd ${SOURCE_DIR} # get version -version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" +if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then + version="${BUILD_ID}" +else + version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" +fi # build archives npx yarn install From 1affef1208cb839ae61c59e3213e21907b21103c Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 16:12:00 -0400 Subject: [PATCH 05/18] Add build_id versioning to FC/COS builds --- deployment/build.centos | 14 ++++++++++++++ deployment/build.fedora | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/deployment/build.centos b/deployment/build.centos index 7dd0343c1f..0bf0323cee 100755 --- a/deployment/build.centos +++ b/deployment/build.centos @@ -8,6 +8,20 @@ pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock +# modify changelog to unstable configuration if IS_UNSTABLE +if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then + pushd fedora/ + # get the last PR ID + PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) + sed -i "/Version:.*/Version: ${BUILD_ID}" + sed -i "/%changelog/q" jellyfin-web.spec + cat <>jellyfin-web.spec +* $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team +- Jellyfin Web unstable build ${BUILD_ID} for merged PR #${PR_ID} +EOF + popd +fi + # build rpm make -f fedora/Makefile srpm outdir=/root/rpmbuild/SRPMS rpmbuild --rebuild -bb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm diff --git a/deployment/build.fedora b/deployment/build.fedora index 249403b9e7..9ffb5d5343 100755 --- a/deployment/build.fedora +++ b/deployment/build.fedora @@ -8,6 +8,20 @@ pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock +# modify changelog to unstable configuration if IS_UNSTABLE +if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then + pushd fedora/ + # get the last PR ID + PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) + sed -i "/Version:.*/Version: ${BUILD_ID}" + sed -i "/%changelog/q" jellyfin-web.spec + cat <>jellyfin-web.spec +* $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team +- Jellyfin Web unstable build ${BUILD_ID} for merged PR #${PR_ID} +EOF + popd +fi + # build rpm make -f fedora/Makefile srpm outdir=/root/rpmbuild/SRPMS rpmbuild -rb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm From b796e6b807e4adaf542d72b561c51276f629bcb7 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 16:12:30 -0400 Subject: [PATCH 06/18] Correct changelog text for Debian unstable build --- deployment/build.debian | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/build.debian b/deployment/build.debian index 2f58a49d20..6b70d1fc8e 100755 --- a/deployment/build.debian +++ b/deployment/build.debian @@ -16,7 +16,7 @@ if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then cat <changelog jellyfin-web (${BUILD_ID}-unstable) unstable; urgency=medium - * Jellyfin unstable build ${BUILD_ID} for merged PR #${PR_ID} + * Jellyfin Web unstable build ${BUILD_ID} for merged PR #${PR_ID} -- Jellyfin Packaging Team $( date --rfc-2822 ) EOF From 8822630f46a4a464fe90f218745e6518370d2191 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 16:14:50 -0400 Subject: [PATCH 07/18] Fix bad sed commands --- deployment/build.centos | 2 +- deployment/build.fedora | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deployment/build.centos b/deployment/build.centos index 0bf0323cee..35b81b520b 100755 --- a/deployment/build.centos +++ b/deployment/build.centos @@ -13,7 +13,7 @@ if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then pushd fedora/ # get the last PR ID PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) - sed -i "/Version:.*/Version: ${BUILD_ID}" + sed -i "s/Version:.*/Version: ${BUILD_ID}/" jellyfin-web.spec sed -i "/%changelog/q" jellyfin-web.spec cat <>jellyfin-web.spec * $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team diff --git a/deployment/build.fedora b/deployment/build.fedora index 9ffb5d5343..620ceaf121 100755 --- a/deployment/build.fedora +++ b/deployment/build.fedora @@ -13,7 +13,7 @@ if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then pushd fedora/ # get the last PR ID PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) - sed -i "/Version:.*/Version: ${BUILD_ID}" + sed -i "s/Version:.*/Version: ${BUILD_ID}/" jellyfin-web.spec sed -i "/%changelog/q" jellyfin-web.spec cat <>jellyfin-web.spec * $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team From 847c9950d75cadedbad849c49ba34f2b53a533c4 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 16:56:45 -0400 Subject: [PATCH 08/18] Add collection script call --- .ci/azure-pipelines-package.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index 2866b0e44a..d92fa986e2 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -35,4 +35,11 @@ jobs: sshEndpoint: repository sourceFolder: '$(Build.SourcesDirectory)/deployment/dist' contents: '**' - targetFolder: '/srv/repository/incoming/azure' + targetFolder: '/srv/repository/incoming/azure/$(BuildConfiguration)' + + - task: SSH@0 + displayName: 'Collect packages into repositories' + inputs: + sshEndpoint: repository + runOptions: 'inline' + inline: '/srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber) unstable' From f67b9a01fee6eb641a3f77987eaa494e257d9c81 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 17:20:01 -0400 Subject: [PATCH 09/18] Use better flags and conditionals in CI itself --- .ci/azure-pipelines-package.yml | 22 ++++++++++++++++++---- deployment/build.centos | 2 +- deployment/build.debian | 2 +- deployment/build.fedora | 2 +- deployment/build.portable | 2 +- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index d92fa986e2..18a0676826 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -20,8 +20,13 @@ jobs: - script: 'docker build -f deployment/Dockerfile.$(BuildConfiguration) -t jellyfin-web-$(BuildConfiguration) deployment' displayName: 'Build Dockerfile' - - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e GIT_BRANCH=$(Build.SourceBranch) -e BUILD_ID=$(Build.BuildNumber) jellyfin-web-$(BuildConfiguration)' - displayName: 'Run Dockerfile' + - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e IS_UNSTABLE="yes" -e BUILD_ID=$(Build.BuildNumber) jellyfin-web-$(BuildConfiguration)' + displayName: 'Run Dockerfile (unstable)' + condition: eq(variables['Build.SourceBranch'], 'refs/heads/package') + + - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e IS_UNSTABLE="no" -e BUILD_ID=$(Build.BuildNumber) jellyfin-web-$(BuildConfiguration)' + displayName: 'Run Dockerfile (stable)' + condition: ne(variables['Build.SourceBranch'], 'refs/heads/package') - task: PublishPipelineArtifact@1 displayName: 'Publish Release' @@ -35,11 +40,20 @@ jobs: sshEndpoint: repository sourceFolder: '$(Build.SourcesDirectory)/deployment/dist' contents: '**' - targetFolder: '/srv/repository/incoming/azure/$(BuildConfiguration)' + targetFolder: '/srv/repository/incoming/azure/$(Build.BuildNumber)/$(BuildConfiguration)' - task: SSH@0 - displayName: 'Collect packages into repositories' + displayName: 'Collect packages into repositories (unstable)' + condition: eq(variables['Build.SourceBranch'], 'refs/heads/package') inputs: sshEndpoint: repository runOptions: 'inline' inline: '/srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber) unstable' + + - task: SSH@0 + displayName: 'Collect packages into repositories (stable)' + condition: ne(variables['Build.SourceBranch'], 'refs/heads/package') + inputs: + sshEndpoint: repository + runOptions: 'inline' + inline: '/srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber)' diff --git a/deployment/build.centos b/deployment/build.centos index 35b81b520b..c01c8a64c7 100755 --- a/deployment/build.centos +++ b/deployment/build.centos @@ -9,7 +9,7 @@ pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock # modify changelog to unstable configuration if IS_UNSTABLE -if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then +if [[ ${IS_UNSTABLE} == 'yes' ]]; then pushd fedora/ # get the last PR ID PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) diff --git a/deployment/build.debian b/deployment/build.debian index 6b70d1fc8e..bc8816851e 100755 --- a/deployment/build.debian +++ b/deployment/build.debian @@ -9,7 +9,7 @@ pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock # modify changelog to unstable configuration if IS_UNSTABLE -if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then +if [[ ${IS_UNSTABLE} == 'yes' ]]; then pushd debian/ # get the last PR ID PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) diff --git a/deployment/build.fedora b/deployment/build.fedora index 620ceaf121..5be2565494 100755 --- a/deployment/build.fedora +++ b/deployment/build.fedora @@ -9,7 +9,7 @@ pushd ${SOURCE_DIR} cp -a yarn.lock /tmp/yarn.lock # modify changelog to unstable configuration if IS_UNSTABLE -if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then +if [[ ${IS_UNSTABLE} == 'yes' ]]; then pushd fedora/ # get the last PR ID PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) diff --git a/deployment/build.portable b/deployment/build.portable index 363c8aae06..fdcfa37c97 100755 --- a/deployment/build.portable +++ b/deployment/build.portable @@ -7,7 +7,7 @@ set -o xtrace pushd ${SOURCE_DIR} # get version -if [[ ${GIT_BRANCH} == 'refs/heads/package' ]]; then +if [[ ${IS_UNSTABLE} == 'yes' ]]; then version="${BUILD_ID}" else version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )" From ce09f0e4e46ff4a5e590b86fb05bd6ab7c3ee417 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 17:31:24 -0400 Subject: [PATCH 10/18] Separate package collection into a separate job --- .ci/azure-pipelines-package.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index 18a0676826..eb1f12a7ff 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -42,6 +42,13 @@ jobs: contents: '**' targetFolder: '/srv/repository/incoming/azure/$(Build.BuildNumber)/$(BuildConfiguration)' +- job: Collect + displayName: 'Collect Artifacts' + + pool: + vmImage: 'ubuntu-latest' + + steps: - task: SSH@0 displayName: 'Collect packages into repositories (unstable)' condition: eq(variables['Build.SourceBranch'], 'refs/heads/package') From 7a5065ba279960b3297298e63e5ae93f6bbcbec7 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 18:16:02 -0400 Subject: [PATCH 11/18] Run the repo include as sudo --- .ci/azure-pipelines-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index eb1f12a7ff..9c048f90ed 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -55,7 +55,7 @@ jobs: inputs: sshEndpoint: repository runOptions: 'inline' - inline: '/srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber) unstable' + inline: 'sudo /srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber) unstable' - task: SSH@0 displayName: 'Collect packages into repositories (stable)' @@ -63,4 +63,4 @@ jobs: inputs: sshEndpoint: repository runOptions: 'inline' - inline: '/srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber)' + inline: 'sudo /srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber)' From e43bb09d60c6eba7af125660d0bf2b23dfec7cbf Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 18:18:11 -0400 Subject: [PATCH 12/18] Update conditionals to final values (master+tag) --- .ci/azure-pipelines-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index 9c048f90ed..5cc3241926 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -22,11 +22,11 @@ jobs: - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e IS_UNSTABLE="yes" -e BUILD_ID=$(Build.BuildNumber) jellyfin-web-$(BuildConfiguration)' displayName: 'Run Dockerfile (unstable)' - condition: eq(variables['Build.SourceBranch'], 'refs/heads/package') + condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master') - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e IS_UNSTABLE="no" -e BUILD_ID=$(Build.BuildNumber) jellyfin-web-$(BuildConfiguration)' displayName: 'Run Dockerfile (stable)' - condition: ne(variables['Build.SourceBranch'], 'refs/heads/package') + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - task: PublishPipelineArtifact@1 displayName: 'Publish Release' @@ -51,7 +51,7 @@ jobs: steps: - task: SSH@0 displayName: 'Collect packages into repositories (unstable)' - condition: eq(variables['Build.SourceBranch'], 'refs/heads/package') + condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master') inputs: sshEndpoint: repository runOptions: 'inline' @@ -59,7 +59,7 @@ jobs: - task: SSH@0 displayName: 'Collect packages into repositories (stable)' - condition: ne(variables['Build.SourceBranch'], 'refs/heads/package') + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') inputs: sshEndpoint: repository runOptions: 'inline' From 4e4c5b1400b5dec26a37fd9f40eb6847085c86b4 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 14 Jun 2020 13:39:00 -0400 Subject: [PATCH 13/18] Only run remaining package steps conditionally Prevents these steps from failing if the build is skipped. --- .ci/azure-pipelines-package.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index 5cc3241926..d8319f021b 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -19,6 +19,7 @@ jobs: steps: - script: 'docker build -f deployment/Dockerfile.$(BuildConfiguration) -t jellyfin-web-$(BuildConfiguration) deployment' displayName: 'Build Dockerfile' + condition: or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master')) - script: 'docker image ls -a && docker run -v $(pwd)/deployment/dist:/dist -v $(pwd):/jellyfin -e IS_UNSTABLE="yes" -e BUILD_ID=$(Build.BuildNumber) jellyfin-web-$(BuildConfiguration)' displayName: 'Run Dockerfile (unstable)' @@ -30,12 +31,14 @@ jobs: - task: PublishPipelineArtifact@1 displayName: 'Publish Release' + condition: or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master')) inputs: targetPath: '$(Build.SourcesDirectory)/deployment/dist' artifactName: 'jellyfin-web-$(BuildConfiguration)' - task: CopyFilesOverSSH@0 displayName: 'Upload artifacts to repository server' + condition: or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), startsWith(variables['Build.SourceBranch'], 'refs/heads/master')) inputs: sshEndpoint: repository sourceFolder: '$(Build.SourcesDirectory)/deployment/dist' From 95be2ba211da1d3575a82d18574be03647e9027d Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 14 Jun 2020 19:23:27 -0400 Subject: [PATCH 14/18] Add builder Dockerfile and steps in CI --- .ci/azure-pipelines-package.yml | 51 +++++++++++++++++++++++++++++++-- deployment/Dockerfile.docker | 11 +++++++ 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 deployment/Dockerfile.docker diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index d8319f021b..fd5a2a6e90 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -1,6 +1,6 @@ jobs: -- job: Package - displayName: 'Package' +- job: BuildPackage + displayName: 'Build Packages' strategy: matrix: @@ -45,6 +45,53 @@ jobs: contents: '**' targetFolder: '/srv/repository/incoming/azure/$(Build.BuildNumber)/$(BuildConfiguration)' +- job: BuildDocker + displayName: 'Build Docker' + + pool: + vmImage: 'ubuntu-latest' + + steps: + - script: 'docker build -f deployment/Dockerfile.docker -t jellyfin-web-unstable .' + displayName: 'Build Dockerfile (unstable)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') + + - script: 'docker build -f deployment/Dockerfile.docker -t jellyfin-web-stable .' + displayName: 'Build Dockerfile (stable)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + + - script: 'docker push "jellyfin-web-unstable":"$(Build.BuildNumber)-all"' + displayName: 'Push Docker image (unstable)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') + + - script: 'docker push "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"' + displayName: 'Push Docker image (stable)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + + - script: 'docker manifest create --amend "jellyfin-web-unstable":"$(Build.BuildNumber)" "jellyfin-web-unstable":"$(Build.BuildNumber)"' + displayName: 'Create Docker manifest (unstable)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') + + - script: 'docker manifest create --amend "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )" "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"' + displayName: 'Create Docker manifest (stable, versioned)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + + - script: 'docker manifest create --amend "jellyfin-web-stable":"latest" "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"' + displayName: 'Create Docker manifest (stable, latest)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + + - script: 'docker manifest push --purge "jellyfin-web-unstable":"$(Build.BuildNumber)"' + displayName: 'Push Docker manifest (unstable)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') + + - script: 'docker manifest push --purge "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )"' + displayName: 'Push Docker manifest (stable, versioned)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + + - script: 'docker manifest push --purge "jellyfin-web-stable":"latest"' + displayName: 'Push Docker manifest (stable, latest)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + - job: Collect displayName: 'Collect Artifacts' diff --git a/deployment/Dockerfile.docker b/deployment/Dockerfile.docker new file mode 100644 index 0000000000..e0d0e4210d --- /dev/null +++ b/deployment/Dockerfile.docker @@ -0,0 +1,11 @@ +FROM node:alpine + +ARG SOURCE_DIR=/src +ARG ARTIFACT_DIR=/jellyfin-web + +RUN apk add autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python + +WORKDIR ${SOURCE_DIR}/ +COPY . . + +RUN yarn install && mv dist ${ARTIFACT_DIR} From c4cc669ebf7f4226d93768dd4ced786d3818a65c Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 14 Jun 2020 19:39:09 -0400 Subject: [PATCH 15/18] Revamp naming of Docker images and manifests This is a nicer standardized format using Docker image tags more effectively. --- .ci/azure-pipelines-package.yml | 38 +++++++++++++-------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index fd5a2a6e90..62f73e7f04 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -52,43 +52,35 @@ jobs: vmImage: 'ubuntu-latest' steps: - - script: 'docker build -f deployment/Dockerfile.docker -t jellyfin-web-unstable .' + - script: 'docker build -f deployment/Dockerfile.docker -t "jellyfin-web":"unstable-$(Build.BuildNumber)" .' displayName: 'Build Dockerfile (unstable)' condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') - - script: 'docker build -f deployment/Dockerfile.docker -t jellyfin-web-stable .' - displayName: 'Build Dockerfile (stable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - - - script: 'docker push "jellyfin-web-unstable":"$(Build.BuildNumber)-all"' + - script: 'docker push "jellyfin-web":"unstable-$(Build.BuildNumber)"' displayName: 'Push Docker image (unstable)' condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') - - script: 'docker push "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"' - displayName: 'Push Docker image (stable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - - - script: 'docker manifest create --amend "jellyfin-web-unstable":"$(Build.BuildNumber)" "jellyfin-web-unstable":"$(Build.BuildNumber)"' + - script: 'docker manifest create --amend "jellyfin-web":"unstable" "jellyfin-web":"unstable-$(Build.BuildNumber)"' displayName: 'Create Docker manifest (unstable)' condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') - - script: 'docker manifest create --amend "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )" "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"' - displayName: 'Create Docker manifest (stable, versioned)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - - - script: 'docker manifest create --amend "jellyfin-web-stable":"latest" "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )-all"' - displayName: 'Create Docker manifest (stable, latest)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - - - script: 'docker manifest push --purge "jellyfin-web-unstable":"$(Build.BuildNumber)"' + - script: 'docker manifest push --purge "jellyfin-web":"unstable"' displayName: 'Push Docker manifest (unstable)' condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') - - script: 'docker manifest push --purge "jellyfin-web-stable":"$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )"' - displayName: 'Push Docker manifest (stable, versioned)' + - script: 'docker build -f deployment/Dockerfile.docker -t "jellyfin-web":"stable-$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )" .' + displayName: 'Build Dockerfile (stable)' condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - - script: 'docker manifest push --purge "jellyfin-web-stable":"latest"' + - script: 'docker push "jellyfin-web":"stable-$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )"' + displayName: 'Push Docker image (stable)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + + - script: 'docker manifest create --amend "jellyfin-web":"stable" "jellyfin-web":"stable-$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )"' + displayName: 'Create Docker manifest (stable)' + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + + - script: 'docker manifest push --purge "jellyfin-web-stable":"stable"' displayName: 'Push Docker manifest (stable, latest)' condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') From cbae2f577e4205c7373519c764b8466bd6a93bdd Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Sun, 14 Jun 2020 19:59:32 -0400 Subject: [PATCH 16/18] Attempt to use inbuilt Docker tasks --- .ci/azure-pipelines-package.yml | 52 +++++++++++++++------------------ deployment/Dockerfile.docker | 1 + 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index 62f73e7f04..e48b24eb8b 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -52,37 +52,31 @@ jobs: vmImage: 'ubuntu-latest' steps: - - script: 'docker build -f deployment/Dockerfile.docker -t "jellyfin-web":"unstable-$(Build.BuildNumber)" .' - displayName: 'Build Dockerfile (unstable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') + - task: Docker@2 + displayName: "Build and Push Docker image (unstable)" + condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master') + inputs: + repository: "jellyfin/jellyfin-web" + command: buildAndPush + buildContext: '.' + Dockerfile: "deployment/Dockerfile.docker" + containerRegistry: Docker Hub + tags: | + unstable-$(Build.BuildNumber) + unstable - - script: 'docker push "jellyfin-web":"unstable-$(Build.BuildNumber)"' - displayName: 'Push Docker image (unstable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') - - - script: 'docker manifest create --amend "jellyfin-web":"unstable" "jellyfin-web":"unstable-$(Build.BuildNumber)"' - displayName: 'Create Docker manifest (unstable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') - - - script: 'docker manifest push --purge "jellyfin-web":"unstable"' - displayName: 'Push Docker manifest (unstable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/package') - - - script: 'docker build -f deployment/Dockerfile.docker -t "jellyfin-web":"stable-$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )" .' - displayName: 'Build Dockerfile (stable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - - - script: 'docker push "jellyfin-web":"stable-$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )"' - displayName: 'Push Docker image (stable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - - - script: 'docker manifest create --amend "jellyfin-web":"stable" "jellyfin-web":"stable-$( sed "s|^refs/tags/v||g" <<<"$(Build.SourceBranch)" )"' - displayName: 'Create Docker manifest (stable)' - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') - - - script: 'docker manifest push --purge "jellyfin-web-stable":"stable"' - displayName: 'Push Docker manifest (stable, latest)' + - task: Docker@2 + displayName: "Build and Push Docker image (stable)" condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') + inputs: + repository: "jellyfin/jellyfin-web" + command: buildAndPush + buildContext: '.' + Dockerfile: "deployment/Dockerfile.docker" + containerRegistry: Docker Hub + tags: | + stable-$(Build.BuildNumber) + stable - job: Collect displayName: 'Collect Artifacts' diff --git a/deployment/Dockerfile.docker b/deployment/Dockerfile.docker index e0d0e4210d..1b3e215795 100644 --- a/deployment/Dockerfile.docker +++ b/deployment/Dockerfile.docker @@ -7,5 +7,6 @@ RUN apk add autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool ma WORKDIR ${SOURCE_DIR}/ COPY . . +RUN ls -al . RUN yarn install && mv dist ${ARTIFACT_DIR} From 688516ac336f1fcbc6a55efa09e998cd685caa6e Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 15 Jun 2020 19:49:17 +0900 Subject: [PATCH 17/18] update formatting for azure pipelines --- .ci/azure-pipelines-package.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.ci/azure-pipelines-package.yml b/.ci/azure-pipelines-package.yml index e48b24eb8b..594493e632 100644 --- a/.ci/azure-pipelines-package.yml +++ b/.ci/azure-pipelines-package.yml @@ -53,32 +53,32 @@ jobs: steps: - task: Docker@2 - displayName: "Build and Push Docker image (unstable)" + displayName: 'Push Unstable Image' condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master') inputs: - repository: "jellyfin/jellyfin-web" + repository: 'jellyfin/jellyfin-web' command: buildAndPush buildContext: '.' - Dockerfile: "deployment/Dockerfile.docker" + Dockerfile: 'deployment/Dockerfile.docker' containerRegistry: Docker Hub tags: | unstable-$(Build.BuildNumber) unstable - task: Docker@2 - displayName: "Build and Push Docker image (stable)" + displayName: 'Push Stable Image' condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') inputs: - repository: "jellyfin/jellyfin-web" + repository: 'jellyfin/jellyfin-web' command: buildAndPush buildContext: '.' - Dockerfile: "deployment/Dockerfile.docker" + Dockerfile: 'deployment/Dockerfile.docker' containerRegistry: Docker Hub tags: | stable-$(Build.BuildNumber) stable -- job: Collect +- job: CollectArtifacts displayName: 'Collect Artifacts' pool: @@ -86,7 +86,7 @@ jobs: steps: - task: SSH@0 - displayName: 'Collect packages into repositories (unstable)' + displayName: 'Update Unstable Repository' condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master') inputs: sshEndpoint: repository @@ -94,7 +94,7 @@ jobs: inline: 'sudo /srv/repository/collect-server.azure.sh /srv/repository/incoming/azure $(Build.BuildNumber) unstable' - task: SSH@0 - displayName: 'Collect packages into repositories (stable)' + displayName: 'Update Stable Repository' condition: startsWith(variables['Build.SourceBranch'], 'refs/tags') inputs: sshEndpoint: repository From caf5444000838b3c6a1b58c5bcf98424803f338b Mon Sep 17 00:00:00 2001 From: dkanada Date: Mon, 15 Jun 2020 19:54:00 +0900 Subject: [PATCH 18/18] standardize indentation --- deployment/Dockerfile.docker | 3 +-- deployment/build.centos | 8 +++++--- deployment/build.debian | 7 ++++--- deployment/build.fedora | 8 +++++--- deployment/build.portable | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/deployment/Dockerfile.docker b/deployment/Dockerfile.docker index 1b3e215795..5d12938185 100644 --- a/deployment/Dockerfile.docker +++ b/deployment/Dockerfile.docker @@ -5,8 +5,7 @@ ARG ARTIFACT_DIR=/jellyfin-web RUN apk add autoconf g++ make libpng-dev gifsicle alpine-sdk automake libtool make gcc musl-dev nasm python -WORKDIR ${SOURCE_DIR}/ +WORKDIR ${SOURCE_DIR} COPY . . -RUN ls -al . RUN yarn install && mv dist ${ARTIFACT_DIR} diff --git a/deployment/build.centos b/deployment/build.centos index c01c8a64c7..25d1e8c175 100755 --- a/deployment/build.centos +++ b/deployment/build.centos @@ -10,11 +10,13 @@ cp -a yarn.lock /tmp/yarn.lock # modify changelog to unstable configuration if IS_UNSTABLE if [[ ${IS_UNSTABLE} == 'yes' ]]; then - pushd fedora/ - # get the last PR ID + pushd fedora + PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) + sed -i "s/Version:.*/Version: ${BUILD_ID}/" jellyfin-web.spec sed -i "/%changelog/q" jellyfin-web.spec + cat <>jellyfin-web.spec * $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team - Jellyfin Web unstable build ${BUILD_ID} for merged PR #${PR_ID} @@ -30,7 +32,7 @@ rpmbuild --rebuild -bb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm mv /root/rpmbuild/RPMS/noarch/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR}/ if [[ ${IS_DOCKER} == YES ]]; then - chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} + chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} fi rm -f fedora/jellyfin*.tar.gz diff --git a/deployment/build.debian b/deployment/build.debian index bc8816851e..9fe3fb51e9 100755 --- a/deployment/build.debian +++ b/deployment/build.debian @@ -10,9 +10,10 @@ cp -a yarn.lock /tmp/yarn.lock # modify changelog to unstable configuration if IS_UNSTABLE if [[ ${IS_UNSTABLE} == 'yes' ]]; then - pushd debian/ - # get the last PR ID + pushd debian + PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) + cat <changelog jellyfin-web (${BUILD_ID}-unstable) unstable; urgency=medium @@ -32,7 +33,7 @@ mv ../jellyfin*.{deb,dsc,tar.gz,buildinfo,changes} ${ARTIFACT_DIR} cp -a /tmp/yarn.lock yarn.lock if [[ ${IS_DOCKER} == YES ]]; then - chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} + chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} fi popd diff --git a/deployment/build.fedora b/deployment/build.fedora index 5be2565494..60d270ed6c 100755 --- a/deployment/build.fedora +++ b/deployment/build.fedora @@ -10,11 +10,13 @@ cp -a yarn.lock /tmp/yarn.lock # modify changelog to unstable configuration if IS_UNSTABLE if [[ ${IS_UNSTABLE} == 'yes' ]]; then - pushd fedora/ - # get the last PR ID + pushd fedora + PR_ID=$( git log --grep 'Merge pull request' --oneline --single-worktree --first-parent | head -1 | grep --color=none -Eo '#[0-9]+' | tr -d '#' ) + sed -i "s/Version:.*/Version: ${BUILD_ID}/" jellyfin-web.spec sed -i "/%changelog/q" jellyfin-web.spec + cat <>jellyfin-web.spec * $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team - Jellyfin Web unstable build ${BUILD_ID} for merged PR #${PR_ID} @@ -30,7 +32,7 @@ rpmbuild -rb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm mv /root/rpmbuild/RPMS/noarch/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR} if [[ ${IS_DOCKER} == YES ]]; then - chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} + chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} fi rm -f fedora/jellyfin*.tar.gz diff --git a/deployment/build.portable b/deployment/build.portable index fdcfa37c97..7161ae6c2d 100755 --- a/deployment/build.portable +++ b/deployment/build.portable @@ -24,7 +24,7 @@ mkdir -p ${ARTIFACT_DIR} mv jellyfin[-_]*.tar.gz ${ARTIFACT_DIR} if [[ ${IS_DOCKER} == YES ]]; then - chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} + chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR} fi popd