mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
4a6ab84b69
add default machine capability We semi-regularly need to do work that has the potential to disrupt a machine's local cache, rendering it broken for other streams of work. This can include upgrading nix, upgrading Bazel, debugging caching issues, or anything related to Windows. Right now we do not have any good solution for these situations. We can either not do those streams of work, or we can proceed with them and just accept that all other builds may get affected depending on which machine they get assigned to. Debugging broken nodes is particularly tricky as we do not have any way to force a build to run on a given node. This PR aims at providing a better alternative by (ab)using an Azure Pipelines feature called [capabilities](https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#capabilities). The idea behind capabilities is that you assign a set of tags to a machine, and then a job can express its [demands](https://docs.microsoft.com/en-us/azure/devops/pipelines/process/demands?view=azure-devops&tabs=yaml), i.e. specify a set of tags machines need to have in order to run it. Support for this is fairly badly documented. We can gather from the documentation that a job can specify two things about a capability (through its `demands`): that a given tag exists, and that a given tag has an exact specified value. In particular, a job cannot specify that a capability should _not_ be present, meaning we cannot rely on, say, adding a "broken" tag to broken machines. Documentation on how to set capabilities for an agent is basically nonexistent, but [looking at the code](https://github.com/microsoft/azure-pipelines-agent/blob/master/src/Microsoft.VisualStudio.Services.Agent/Capabilities/UserCapabilitiesProvider.cs) indicates that they can be set by using a simple `key=value`-formatted text file, provided we can find the right place to put this file. This PR adds this file to our Linux, macOS and Windows node init scripts to define an `assignment` capability and adds a demand for a `default` value on each job. From then on, when we hit a case where we want a PR to run on a specific node, and to prevent other PRs from running on that node, we can manually override the capability from the Azure UI and update the demand in the relevant YAML file in the PR. CHANGELOG_BEGIN CHANGELOG_END
53 lines
1.9 KiB
YAML
53 lines
1.9 KiB
YAML
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
# Azure Pipelines file, see https://aka.ms/yaml
|
|
|
|
# Do not run on PRs
|
|
pr: none
|
|
|
|
# Do not run on merge to master
|
|
trigger: none
|
|
|
|
# Run on schedule: first Monday of each month at 6AM UTC
|
|
schedules:
|
|
- cron: '0 6 1-7 * Mon'
|
|
displayName: monthly
|
|
branches:
|
|
include:
|
|
- master
|
|
always: true
|
|
|
|
jobs:
|
|
- job: std_change_notif
|
|
timeoutInMinutes: 20
|
|
pool:
|
|
name: 'linux-pool'
|
|
demands: assignment -equals default
|
|
steps:
|
|
- checkout: self
|
|
- bash: |
|
|
set -euo pipefail
|
|
|
|
eval "$(./dev-env/bin/dade-assist)"
|
|
|
|
A_MONTH_AGO=$(date -I -d "now - 1 month")
|
|
REPORT_MONTH=${A_MONTH_AGO:0:7}
|
|
|
|
./report-std-change.sh $REPORT_MONTH
|
|
|
|
curl -H 'Content-Type: application/json' \
|
|
-i \
|
|
-XPOST \
|
|
$(Slack.team-daml-ci) \
|
|
--data "{\"text\": \"<@U6XMLDZEX> Here is the list of \\\"Standard Changes\\\" for the daml repo, month of ${REPORT_MONTH}. Please forward to security@digitalasset.com.\", \"attachments\": [{\"text\": \"\`\`\`$(cat std-change-report-daml-${REPORT_MONTH}.csv | jq -sR | sed 's/^"//' | sed 's/"$//')\`\`\`\"}]}"
|
|
if [ -f "std-change-report-daml-${REPORT_MONTH}.csv.err" ]; then
|
|
curl -H 'Content-Type: application/json' \
|
|
-i \
|
|
-XPOST \
|
|
$(Slack.team-daml-ci) \
|
|
--data "{\"text\": \"<@U6XMLDZEX> The following commits could not be processed. Please manually check them before sending the report.\", \"attachments\": [{\"text\": \"\`\`\`$(cat std-change-report-daml-${REPORT_MONTH}.csv.err | jq -sR | sed 's/^"//' | sed 's/"$//')\`\`\`\"}]}"
|
|
fi
|
|
env:
|
|
GITHUB_TOKEN: $(GITHUB_TOKEN)
|