mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-11 04:45:57 +03:00
This adds parameters to the "split release" job. At the moment, when run, the job just builds the current commit with a snapshot version. With this change, we'll be able to build a split release for any commit with any version tag. The reason for this change is we want to trigger this job from the assembly repo, to reduce the number of manual interventions needed in the release process. CHANGELOG_BEGIN CHANGELOG_END
81 lines
2.1 KiB
YAML
81 lines
2.1 KiB
YAML
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
pr: none
|
|
trigger: none
|
|
schedules:
|
|
- cron: "0 1 * * *"
|
|
displayName: Daily split snapshot
|
|
branches:
|
|
include:
|
|
- main
|
|
|
|
parameters:
|
|
- name: version
|
|
type: string
|
|
default: snapshot
|
|
- name: commit
|
|
type: string
|
|
default: HEAD
|
|
|
|
jobs:
|
|
- job: check_for_release
|
|
pool:
|
|
name: "ubuntu_20_04"
|
|
demands: assignment -equals default
|
|
steps:
|
|
- template: bash-lib.yml
|
|
parameters:
|
|
var_name: bash-lib
|
|
- bash: |
|
|
set -euo pipefail
|
|
eval "$(./dev-env/bin/dade-assist)"
|
|
source $(bash-lib)
|
|
|
|
prefix=$(cat NIGHTLY_PREFIX)
|
|
if [ "${{ parameters.version }}" = "snapshot" ]; then
|
|
release=$(./release.sh snapshot HEAD $prefix | awk '{print $2}')
|
|
else
|
|
release=${{ parameters.version }}
|
|
fi
|
|
|
|
ERR=$(mktemp)
|
|
OUT=$(curl https://digitalasset.jfrog.io/artifactory/api/storage/assembly/daml/$release \
|
|
-u $AUTH \
|
|
-I \
|
|
2>$ERR)
|
|
STATUS=$(echo "$OUT" | head -1 | sed 's:HTTP/1.1 \([^ ]\+\).*:\1:')
|
|
case "$STATUS" in
|
|
200)
|
|
echo "Version $release already exists on Artifactory, aborting."
|
|
setvar is_release false
|
|
;;
|
|
404)
|
|
setvar is_release true
|
|
setvar trigger_sha $(git rev-parse HEAD)
|
|
setvar release_sha $(git rev-parse ${{ parameters.commit }})
|
|
setvar release_tag $release
|
|
setvar split_release_process true
|
|
;;
|
|
*)
|
|
echo "Unexpected status code: $STATUS"
|
|
echo "curl stdout:"
|
|
echo "--"
|
|
echo "$OUT"
|
|
echo "--"
|
|
echo "curl stderr:"
|
|
echo "--"
|
|
echo "$ERR"
|
|
echo "--"
|
|
exit 1
|
|
;;
|
|
esac
|
|
setvar scala_2_13 true
|
|
name: out
|
|
env:
|
|
AUTH: $(ARTIFACTORY_USERNAME):$(ARTIFACTORY_PASSWORD)
|
|
- template: build.yml
|
|
- template: split-release-job.yml
|
|
- job: release
|
|
condition: false
|