From f67b9a01fee6eb641a3f77987eaa494e257d9c81 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 12 Jun 2020 17:20:01 -0400 Subject: [PATCH] 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/' )"