mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-04 00:36:58 +03:00
refactor ci jobs: add setvar to ci/lib.sh (#6708)
CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
a0f9eae489
commit
61e9df3eaf
@ -29,14 +29,17 @@ jobs:
|
||||
steps:
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
|
||||
source ci/lib.sh
|
||||
|
||||
if [ "$(Build.Reason)" == "PullRequest" ]; then
|
||||
echo "##vso[task.setvariable variable=branch;isOutput=true]$(git rev-parse HEAD^2)"
|
||||
echo "##vso[task.setvariable variable=master;isOutput=true]$(git rev-parse HEAD^1)"
|
||||
echo "##vso[task.setvariable variable=fork_point;isOutput=true]$(git merge-base $(git rev-parse HEAD^1) $(git rev-parse HEAD^2))"
|
||||
setvar branch $(git rev-parse HEAD^2)
|
||||
setvar master $(git rev-parse HEAD^1)
|
||||
setvar fork_point $(git merge-base $(git rev-parse HEAD^1) $(git rev-parse HEAD^2))
|
||||
else
|
||||
echo "##vso[task.setvariable variable=branch;isOutput=true]$(git rev-parse HEAD)"
|
||||
echo "##vso[task.setvariable variable=master;isOutput=true]$(git rev-parse HEAD^1)"
|
||||
echo "##vso[task.setvariable variable=fork_point;isOutput=true]$(git rev-parse HEAD^1)"
|
||||
setvar branch $(git rev-parse HEAD)
|
||||
setvar master $(git rev-parse HEAD^1)
|
||||
setvar fork_point $(git rev-parse HEAD^1)
|
||||
fi
|
||||
name: out
|
||||
|
||||
@ -100,8 +103,8 @@ jobs:
|
||||
name: 'linux-pool'
|
||||
demands: assignment -equals default
|
||||
steps:
|
||||
- template: ci/report-start.yml
|
||||
- checkout: self
|
||||
- template: ci/report-start.yml
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
git checkout $(release_sha)
|
||||
@ -137,9 +140,9 @@ jobs:
|
||||
trigger_sha: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ]
|
||||
is_release: $[ dependencies.check_for_release.outputs['out.is_release'] ]
|
||||
steps:
|
||||
- checkout: self
|
||||
- template: ci/report-start.yml
|
||||
- template: ci/clear-shared-segments-macos.yml
|
||||
- checkout: self
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
git checkout $(release_sha)
|
||||
@ -175,8 +178,8 @@ jobs:
|
||||
name: 'windows-pool'
|
||||
demands: assignment -equals default
|
||||
steps:
|
||||
- template: ci/report-start.yml
|
||||
- checkout: self
|
||||
- template: ci/report-start.yml
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
git checkout $(release_sha)
|
||||
@ -206,8 +209,8 @@ jobs:
|
||||
name: linux-pool
|
||||
demands: assignment -equals default
|
||||
steps:
|
||||
- template: ci/report-start.yml
|
||||
- checkout: self
|
||||
- template: ci/report-start.yml
|
||||
- template: ci/compatibility_ts_libs.yml
|
||||
- template: ci/tell-slack-failed.yml
|
||||
- template: ci/report-end.yml
|
||||
@ -222,8 +225,8 @@ jobs:
|
||||
name: linux-pool
|
||||
demands: assignment -equals default
|
||||
steps:
|
||||
- template: ci/report-start.yml
|
||||
- checkout: self
|
||||
- template: ci/report-start.yml
|
||||
- template: ci/compatibility.yml
|
||||
parameters:
|
||||
test_flags: '--quick'
|
||||
@ -239,9 +242,9 @@ jobs:
|
||||
pool:
|
||||
name: macOS-pool
|
||||
steps:
|
||||
- checkout: self
|
||||
- template: ci/report-start.yml
|
||||
- template: ci/clear-shared-segments-macos.yml
|
||||
- checkout: self
|
||||
- template: ci/compatibility.yml
|
||||
parameters:
|
||||
test_flags: '--quick'
|
||||
@ -259,8 +262,8 @@ jobs:
|
||||
name: 'windows-pool'
|
||||
demands: assignment -equals default
|
||||
steps:
|
||||
- template: ci/report-start.yml
|
||||
- checkout: self
|
||||
- template: ci/report-start.yml
|
||||
- template: ci/compatibility-windows.yml
|
||||
parameters:
|
||||
test_flags: '--quick'
|
||||
@ -285,6 +288,8 @@ jobs:
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
|
||||
source ci/lib.sh
|
||||
|
||||
./release.sh check
|
||||
|
||||
changes_release_files() {
|
||||
@ -301,11 +306,6 @@ jobs:
|
||||
[[ "$add_one" == "$changed" || "$change_one" == "$changed" ]]
|
||||
}
|
||||
|
||||
setvar() {
|
||||
echo "Setting '$1' to '$2'"
|
||||
echo "##vso[task.setvariable variable=$1;isOutput=true]$2"
|
||||
}
|
||||
|
||||
added_line() {
|
||||
echo "$(git diff $(fork_sha) $(branch_sha) -- LATEST | tail -n+6 | grep '^\+' | cut -c2-)"
|
||||
}
|
||||
@ -369,17 +369,20 @@ jobs:
|
||||
release_tag: $[ dependencies.check_for_release.outputs['out.release_tag'] ]
|
||||
trigger_sha: $[ dependencies.check_for_release.outputs['out.trigger_sha'] ]
|
||||
steps:
|
||||
- template: ci/report-start.yml
|
||||
- checkout: self
|
||||
persistCredentials: true
|
||||
- template: ci/report-start.yml
|
||||
- bash: |
|
||||
set -euxo pipefail
|
||||
|
||||
source ci/lib.sh
|
||||
|
||||
if git tag v$(release_tag) $(release_sha); then
|
||||
git push origin v$(release_tag)
|
||||
mkdir $(Build.StagingDirectory)/release
|
||||
mkdir $(Build.StagingDirectory)/bucket
|
||||
else
|
||||
echo "##vso[task.setvariable variable=skip-github]TRUE"
|
||||
setvar skip-github TRUE
|
||||
fi
|
||||
- task: DownloadPipelineArtifact@0
|
||||
inputs:
|
||||
@ -498,6 +501,9 @@ jobs:
|
||||
- bash: ci/dev-env-install.sh
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
|
||||
source ci/lib.sh
|
||||
|
||||
eval "$(./dev-env/bin/dade-assist)"
|
||||
|
||||
DELAY=1
|
||||
|
@ -71,27 +71,30 @@ steps:
|
||||
eq('${{parameters.name}}', 'linux'))
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
|
||||
eval "$(./dev-env/bin/dade-assist)"
|
||||
|
||||
source ci/lib.sh
|
||||
|
||||
TARBALL=daml-sdk-${{parameters.release_tag}}-${{parameters.name}}.tar.gz
|
||||
cp bazel-bin/release/sdk-release-tarball.tar.gz $(Build.StagingDirectory)/$TARBALL
|
||||
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
|
||||
setvar tarball $TARBALL
|
||||
|
||||
PROTOS_ZIP=protobufs-${{parameters.release_tag}}.zip
|
||||
cp bazel-bin/release/protobufs.zip $(Build.StagingDirectory)/$PROTOS_ZIP
|
||||
echo "##vso[task.setvariable variable=protos-zip;isOutput=true]$PROTOS_ZIP"
|
||||
setvar protos-zip $PROTOS_ZIP
|
||||
|
||||
DAML_ON_SQL=daml-on-sql-${{parameters.release_tag}}.jar
|
||||
## Not built by default
|
||||
bazel build //ledger/sandbox:sandbox-binary_deploy.jar
|
||||
cp bazel-bin/ledger/sandbox/sandbox-binary_deploy.jar $(Build.StagingDirectory)/$DAML_ON_SQL
|
||||
echo "##vso[task.setvariable variable=daml-on-sql;isOutput=true]$DAML_ON_SQL"
|
||||
setvar daml-on-sql $DAML_ON_SQL
|
||||
|
||||
JSON_API=http-json-${{parameters.release_tag}}.jar
|
||||
## Not built by default
|
||||
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
|
||||
echo "##vso[task.setvariable variable=json-api;isOutput=true]$JSON_API"
|
||||
setvar json-api $JSON_API
|
||||
env:
|
||||
DAML_SDK_RELEASE_VERSION: ${{parameters.release_tag}}
|
||||
name: publish
|
||||
|
@ -30,6 +30,9 @@ steps:
|
||||
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
|
||||
source ci/lib.sh
|
||||
|
||||
INSTALLER=daml-sdk-${{parameters.release_tag}}-windows.exe
|
||||
mv "bazel-bin/release/windows-installer/daml-sdk-installer.exe" "$(Build.StagingDirectory)/$INSTALLER"
|
||||
chmod +wx "$(Build.StagingDirectory)/$INSTALLER"
|
||||
@ -41,10 +44,10 @@ steps:
|
||||
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
|
||||
trap - EXIT
|
||||
echo "##vso[task.setvariable variable=installer;isOutput=true]$INSTALLER"
|
||||
setvar installer $INSTALLER
|
||||
TARBALL=daml-sdk-${{parameters.release_tag}}-windows.tar.gz
|
||||
cp bazel-bin/release/sdk-release-tarball.tar.gz '$(Build.StagingDirectory)'/$TARBALL
|
||||
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
|
||||
setvar tarball $TARBALL
|
||||
name: publish
|
||||
env:
|
||||
SIGNING_KEY: $(microsoft-code-signing)
|
||||
|
7
ci/lib.sh
Normal file
7
ci/lib.sh
Normal file
@ -0,0 +1,7 @@
|
||||
# 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"
|
||||
}
|
@ -4,7 +4,10 @@
|
||||
steps:
|
||||
- bash: |
|
||||
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()
|
||||
name: end
|
||||
|
||||
|
@ -4,8 +4,11 @@
|
||||
steps:
|
||||
- bash: |
|
||||
set -euo pipefail
|
||||
echo "##vso[task.setvariable variable=time;isOutput=true]$(date -u +"%Y-%m-%dT%H:%M:%S+00:00")"
|
||||
echo "##vso[task.setvariable variable=machine;isOutput=true]$(Agent.MachineName)"
|
||||
|
||||
source ci/lib.sh
|
||||
|
||||
setvar time $(date -u +"%Y-%m-%dT%H:%M:%S+00:00")
|
||||
setvar machine $(Agent.MachineName)
|
||||
condition: always()
|
||||
name: start
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user