Revert "refactor ci jobs: add setvar to ci/lib.sh (#6708)" (#6732)

This reverts commit 61e9df3eaf.

This interacts very badly with the fact that we check out old commits
for releases. While we could fix it for this particular issue, I don’t
think this buys us enough to make this worth doing and it makes it
easy to introduce issues in the future if we modify lib.sh

changelog_begin
changelog_end
This commit is contained in:
Moritz Kiefer 2020-07-14 23:53:49 +02:00 committed by GitHub
parent 4ac0a47c81
commit 52b9eabbcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 29 additions and 54 deletions

View File

@ -29,17 +29,14 @@ jobs:
steps: steps:
- bash: | - bash: |
set -euo pipefail set -euo pipefail
source ci/lib.sh
if [ "$(Build.Reason)" == "PullRequest" ]; then if [ "$(Build.Reason)" == "PullRequest" ]; then
setvar branch $(git rev-parse HEAD^2) echo "##vso[task.setvariable variable=branch;isOutput=true]$(git rev-parse HEAD^2)"
setvar master $(git rev-parse HEAD^1) echo "##vso[task.setvariable variable=master;isOutput=true]$(git rev-parse HEAD^1)"
setvar fork_point $(git merge-base $(git rev-parse HEAD^1) $(git rev-parse HEAD^2)) echo "##vso[task.setvariable variable=fork_point;isOutput=true]$(git merge-base $(git rev-parse HEAD^1) $(git rev-parse HEAD^2))"
else else
setvar branch $(git rev-parse HEAD) echo "##vso[task.setvariable variable=branch;isOutput=true]$(git rev-parse HEAD)"
setvar master $(git rev-parse HEAD^1) echo "##vso[task.setvariable variable=master;isOutput=true]$(git rev-parse HEAD^1)"
setvar fork_point $(git rev-parse HEAD^1) echo "##vso[task.setvariable variable=fork_point;isOutput=true]$(git rev-parse HEAD^1)"
fi fi
name: out name: out
@ -103,8 +100,8 @@ jobs:
name: 'linux-pool' name: 'linux-pool'
demands: assignment -equals default demands: assignment -equals default
steps: steps:
- checkout: self
- template: ci/report-start.yml - template: ci/report-start.yml
- checkout: self
- bash: | - bash: |
set -euo pipefail set -euo pipefail
git checkout $(release_sha) git checkout $(release_sha)
@ -140,9 +137,9 @@ jobs:
trigger_sha: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ] trigger_sha: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ]
is_release: $[ dependencies.check_for_release.outputs['out.is_release'] ] is_release: $[ dependencies.check_for_release.outputs['out.is_release'] ]
steps: steps:
- checkout: self
- template: ci/report-start.yml - template: ci/report-start.yml
- template: ci/clear-shared-segments-macos.yml - template: ci/clear-shared-segments-macos.yml
- checkout: self
- bash: | - bash: |
set -euo pipefail set -euo pipefail
git checkout $(release_sha) git checkout $(release_sha)
@ -178,8 +175,8 @@ jobs:
name: 'windows-pool' name: 'windows-pool'
demands: assignment -equals default demands: assignment -equals default
steps: steps:
- checkout: self
- template: ci/report-start.yml - template: ci/report-start.yml
- checkout: self
- bash: | - bash: |
set -euo pipefail set -euo pipefail
git checkout $(release_sha) git checkout $(release_sha)
@ -209,8 +206,8 @@ jobs:
name: linux-pool name: linux-pool
demands: assignment -equals default demands: assignment -equals default
steps: steps:
- checkout: self
- template: ci/report-start.yml - template: ci/report-start.yml
- checkout: self
- template: ci/compatibility_ts_libs.yml - template: ci/compatibility_ts_libs.yml
- template: ci/tell-slack-failed.yml - template: ci/tell-slack-failed.yml
- template: ci/report-end.yml - template: ci/report-end.yml
@ -225,8 +222,8 @@ jobs:
name: linux-pool name: linux-pool
demands: assignment -equals default demands: assignment -equals default
steps: steps:
- checkout: self
- template: ci/report-start.yml - template: ci/report-start.yml
- checkout: self
- template: ci/compatibility.yml - template: ci/compatibility.yml
parameters: parameters:
test_flags: '--quick' test_flags: '--quick'
@ -242,9 +239,9 @@ jobs:
pool: pool:
name: macOS-pool name: macOS-pool
steps: steps:
- checkout: self
- template: ci/report-start.yml - template: ci/report-start.yml
- template: ci/clear-shared-segments-macos.yml - template: ci/clear-shared-segments-macos.yml
- checkout: self
- template: ci/compatibility.yml - template: ci/compatibility.yml
parameters: parameters:
test_flags: '--quick' test_flags: '--quick'
@ -262,8 +259,8 @@ jobs:
name: 'windows-pool' name: 'windows-pool'
demands: assignment -equals default demands: assignment -equals default
steps: steps:
- checkout: self
- template: ci/report-start.yml - template: ci/report-start.yml
- checkout: self
- template: ci/compatibility-windows.yml - template: ci/compatibility-windows.yml
parameters: parameters:
test_flags: '--quick' test_flags: '--quick'
@ -288,8 +285,6 @@ jobs:
- bash: | - bash: |
set -euo pipefail set -euo pipefail
source ci/lib.sh
./release.sh check ./release.sh check
changes_release_files() { changes_release_files() {
@ -306,6 +301,11 @@ jobs:
[[ "$add_one" == "$changed" || "$change_one" == "$changed" ]] [[ "$add_one" == "$changed" || "$change_one" == "$changed" ]]
} }
setvar() {
echo "Setting '$1' to '$2'"
echo "##vso[task.setvariable variable=$1;isOutput=true]$2"
}
added_line() { added_line() {
echo "$(git diff $(fork_sha) $(branch_sha) -- LATEST | tail -n+6 | grep '^\+' | cut -c2-)" echo "$(git diff $(fork_sha) $(branch_sha) -- LATEST | tail -n+6 | grep '^\+' | cut -c2-)"
} }
@ -369,20 +369,17 @@ jobs:
release_tag: $[ dependencies.check_for_release.outputs['out.release_tag'] ] release_tag: $[ dependencies.check_for_release.outputs['out.release_tag'] ]
trigger_sha: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ] trigger_sha: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ]
steps: steps:
- template: ci/report-start.yml
- checkout: self - checkout: self
persistCredentials: true persistCredentials: true
- template: ci/report-start.yml
- bash: | - bash: |
set -euxo pipefail set -euxo pipefail
source ci/lib.sh
if git tag v$(release_tag) $(release_sha); then if git tag v$(release_tag) $(release_sha); then
git push origin v$(release_tag) git push origin v$(release_tag)
mkdir $(Build.StagingDirectory)/release mkdir $(Build.StagingDirectory)/release
mkdir $(Build.StagingDirectory)/bucket mkdir $(Build.StagingDirectory)/bucket
else else
setvar skip-github TRUE echo "##vso[task.setvariable variable=skip-github]TRUE"
fi fi
- task: DownloadPipelineArtifact@0 - task: DownloadPipelineArtifact@0
inputs: inputs:
@ -501,9 +498,6 @@ jobs:
- bash: ci/dev-env-install.sh - bash: ci/dev-env-install.sh
- bash: | - bash: |
set -euo pipefail set -euo pipefail
source ci/lib.sh
eval "$(./dev-env/bin/dade-assist)" eval "$(./dev-env/bin/dade-assist)"
DELAY=1 DELAY=1

View File

@ -71,30 +71,27 @@ steps:
eq('${{parameters.name}}', 'linux')) eq('${{parameters.name}}', 'linux'))
- bash: | - bash: |
set -euo pipefail set -euo pipefail
eval "$(./dev-env/bin/dade-assist)" eval "$(./dev-env/bin/dade-assist)"
source ci/lib.sh
TARBALL=daml-sdk-${{parameters.release_tag}}-${{parameters.name}}.tar.gz TARBALL=daml-sdk-${{parameters.release_tag}}-${{parameters.name}}.tar.gz
cp bazel-bin/release/sdk-release-tarball.tar.gz $(Build.StagingDirectory)/$TARBALL cp bazel-bin/release/sdk-release-tarball.tar.gz $(Build.StagingDirectory)/$TARBALL
setvar tarball $TARBALL echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
PROTOS_ZIP=protobufs-${{parameters.release_tag}}.zip PROTOS_ZIP=protobufs-${{parameters.release_tag}}.zip
cp bazel-bin/release/protobufs.zip $(Build.StagingDirectory)/$PROTOS_ZIP cp bazel-bin/release/protobufs.zip $(Build.StagingDirectory)/$PROTOS_ZIP
setvar protos-zip $PROTOS_ZIP echo "##vso[task.setvariable variable=protos-zip;isOutput=true]$PROTOS_ZIP"
DAML_ON_SQL=daml-on-sql-${{parameters.release_tag}}.jar DAML_ON_SQL=daml-on-sql-${{parameters.release_tag}}.jar
## Not built by default ## Not built by default
bazel build //ledger/sandbox:sandbox-binary_deploy.jar bazel build //ledger/sandbox:sandbox-binary_deploy.jar
cp bazel-bin/ledger/sandbox/sandbox-binary_deploy.jar $(Build.StagingDirectory)/$DAML_ON_SQL cp bazel-bin/ledger/sandbox/sandbox-binary_deploy.jar $(Build.StagingDirectory)/$DAML_ON_SQL
setvar daml-on-sql $DAML_ON_SQL echo "##vso[task.setvariable variable=daml-on-sql;isOutput=true]$DAML_ON_SQL"
JSON_API=http-json-${{parameters.release_tag}}.jar JSON_API=http-json-${{parameters.release_tag}}.jar
## Not built by default ## Not built by default
bazel build //ledger-service/http-json:http-json-binary_deploy.jar bazel build //ledger-service/http-json:http-json-binary_deploy.jar
cp bazel-bin/ledger-service/http-json/http-json-binary_deploy.jar $(Build.StagingDirectory)/$JSON_API cp bazel-bin/ledger-service/http-json/http-json-binary_deploy.jar $(Build.StagingDirectory)/$JSON_API
setvar json-api $JSON_API echo "##vso[task.setvariable variable=json-api;isOutput=true]$JSON_API"
env: env:
DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}} DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}}
name: publish name: publish

View File

@ -30,9 +30,6 @@ steps:
- bash: | - bash: |
set -euo pipefail set -euo pipefail
source ci/lib.sh
INSTALLER=daml-sdk-${{parameters.release_tag}}-windows.exe INSTALLER=daml-sdk-${{parameters.release_tag}}-windows.exe
mv "bazel-bin/release/windows-installer/daml-sdk-installer.exe" "$(Build.StagingDirectory)/$INSTALLER" mv "bazel-bin/release/windows-installer/daml-sdk-installer.exe" "$(Build.StagingDirectory)/$INSTALLER"
chmod +wx "$(Build.StagingDirectory)/$INSTALLER" chmod +wx "$(Build.StagingDirectory)/$INSTALLER"
@ -44,10 +41,10 @@ steps:
MSYS_NO_PATHCONV=1 signtool.exe sign '/f' signing_key.pfx '/fd' sha256 '/tr' "http://timestamp.digicert.com" '/v' "$(Build.StagingDirectory)/$INSTALLER" MSYS_NO_PATHCONV=1 signtool.exe sign '/f' signing_key.pfx '/fd' sha256 '/tr' "http://timestamp.digicert.com" '/v' "$(Build.StagingDirectory)/$INSTALLER"
rm signing_key.pfx rm signing_key.pfx
trap - EXIT trap - EXIT
setvar installer $INSTALLER echo "##vso[task.setvariable variable=installer;isOutput=true]$INSTALLER"
TARBALL=daml-sdk-${{parameters.release_tag}}-windows.tar.gz TARBALL=daml-sdk-${{parameters.release_tag}}-windows.tar.gz
cp bazel-bin/release/sdk-release-tarball.tar.gz '$(Build.StagingDirectory)'/$TARBALL cp bazel-bin/release/sdk-release-tarball.tar.gz '$(Build.StagingDirectory)'/$TARBALL
setvar tarball $TARBALL echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
name: publish name: publish
env: env:
SIGNING_KEY: $(microsoft-code-signing) SIGNING_KEY: $(microsoft-code-signing)

View File

@ -1,7 +0,0 @@
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
setvar() {
echo "Setting '$1' to '$2'"
echo "##vso[task.setvariable variable=$1;isOutput=true]$2"
}

View File

@ -4,10 +4,7 @@
steps: steps:
- bash: | - bash: |
set -euo pipefail set -euo pipefail
echo "##vso[task.setvariable variable=time;isOutput=true]$(date -u +"%Y-%m-%dT%H:%M:%S+00:00")"
source ci/lib.sh
setvar time $(date -u +"%Y-%m-%dT%H:%M:%S+00:00")
condition: always() condition: always()
name: end name: end

View File

@ -4,11 +4,8 @@
steps: steps:
- bash: | - bash: |
set -euo pipefail set -euo pipefail
echo "##vso[task.setvariable variable=time;isOutput=true]$(date -u +"%Y-%m-%dT%H:%M:%S+00:00")"
source ci/lib.sh echo "##vso[task.setvariable variable=machine;isOutput=true]$(Agent.MachineName)"
setvar time $(date -u +"%Y-%m-%dT%H:%M:%S+00:00")
setvar machine $(Agent.MachineName)
condition: always() condition: always()
name: start name: start