Skip to content

Commit 0e4a56b

Browse files
committed
Auto merge of #61772 - alexcrichton:pr-and-master-builds, r=pietroalbini
ci: Enable toolstate tracking on Azure Currently just run it through its paces but don't actually push to official locations. Instead let's just push to a separate fork (mine) as well as open issues in a separate fork (mine). Make sure that people aren't pinged for these issues as well! This should hopefully ensure that everything is working on Azure and give us a chance to work through any issues that come up. Fixes #61790 Fixes #61371
2 parents 57a3300 + 521edee commit 0e4a56b

File tree

7 files changed

+39
-19
lines changed

7 files changed

+39
-19
lines changed

.azure-pipelines/auto.yml

-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ jobs:
140140
IMAGE: x86_64-gnu-aux
141141
x86_64-gnu-tools:
142142
IMAGE: x86_64-gnu-tools
143-
# FIXME if: branch = auto OR (type = pull_request AND commit_message =~ /(?i:^update.*\b(rls|rustfmt|clippy|miri|cargo)\b)/)
144143
x86_64-gnu-debug:
145144
IMAGE: x86_64-gnu-debug
146145
x86_64-gnu-nopt:

.azure-pipelines/master.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ pr: none
66
trigger:
77
- master
88

9+
variables:
10+
- group: prod-credentials
11+
912
pool:
1013
vmImage: ubuntu-16.04
1114

@@ -16,9 +19,7 @@ steps:
1619
- script: |
1720
export MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
1821
. src/ci/docker/x86_64-gnu-tools/repo.sh
19-
# FIXME(pietro): committing is disabled until we switch to Azure Pipelines
20-
# as the source of truth, or until we setup a separate test repo.
21-
#commit_toolstate_change "$MESSAGE_FILE" "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "$MESSAGE_FILE" "$TOOLSTATE_REPO_ACCESS_TOKEN"
22+
commit_toolstate_change "$MESSAGE_FILE" "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "$MESSAGE_FILE" "$TOOLSTATE_REPO_ACCESS_TOKEN"
2223
displayName: Publish toolstate
2324
env:
24-
TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN_SECRET)
25+
TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)

.azure-pipelines/pr.yml

+16-5
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,30 @@
44

55
trigger: none
66
pr:
7-
- master # FIXME: really just want any branch, but want an explicit "pr" property set so it's clear
7+
- master
88

99
jobs:
1010
- job: Linux
11+
timeoutInMinutes: 600
1112
pool:
1213
vmImage: ubuntu-16.04
1314
steps:
1415
- template: steps/run.yml
1516
strategy:
1617
matrix:
1718
x86_64-gnu-llvm-6.0:
18-
RUST_BACKTRACE: 1
19+
IMAGE: x86_64-gnu-llvm-6.0
20+
mingw-check:
21+
IMAGE: mingw-check
1922

20-
# x86_64-gnu-tools: {}
21-
# # if: branch = auto OR (type = pull_request AND commit_message =~ /(?i:^update.*\b(rls|rustfmt|clippy|miri|cargo)\b)/)
22-
# mingw-check: {}
23+
# TODO: enable this job if the commit message matches this regex, need tools
24+
# figure out how to get the current commit message on azure and stick it in a
25+
# condition somewhere
26+
# if: commit_message =~ /(?i:^update.*\b(rls|rustfmt|clippy|miri|cargo)\b)/
27+
# - job: Linux-x86_64-gnu-tools
28+
# pool:
29+
# vmImage: ubuntu-16.04
30+
# steps:
31+
# - template: steps/run.yml
32+
# variables:
33+
# IMAGE: x86_64-gnu-tools

.azure-pipelines/steps/run.yml

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ steps:
124124
CI: true
125125
SRC: .
126126
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
127+
TOOLSTATE_REPO_ACCESS_TOKEN: $(TOOLSTATE_REPO_ACCESS_TOKEN)
127128
displayName: Run build
128129

129130
# If we're a deploy builder, use the `aws` command to publish everything to our

src/ci/docker/run.sh

+1
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ exec docker \
149149
--env TF_BUILD \
150150
--env BUILD_SOURCEBRANCHNAME \
151151
--env TOOLSTATE_REPO_ACCESS_TOKEN \
152+
--env TOOLSTATE_REPO \
152153
--env CI_JOB_NAME="${CI_JOB_NAME-$IMAGE}" \
153154
--volume "$HOME/.cargo:/cargo" \
154155
--volume "$HOME/rustsrc:$HOME/rustsrc" \

src/ci/docker/x86_64-gnu-tools/repo.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ commit_toolstate_change() {
5555
git config --global credential.helper store
5656
printf 'https://%s:x-oauth-basic@github.com\n' "$TOOLSTATE_REPO_ACCESS_TOKEN" \
5757
> "$HOME/.git-credentials"
58-
git clone --depth=1 https://github.com/rust-lang-nursery/rust-toolstate.git
58+
git clone --depth=1 $TOOLSTATE_REPO
5959

6060
cd rust-toolstate
6161
FAILURE=1

src/tools/publish_toolstate.py

+15-8
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import sys
55
import re
6+
import os
67
import json
78
import datetime
89
import collections
@@ -53,6 +54,14 @@ def read_current_status(current_commit, path):
5354
return json.loads(status)
5455
return {}
5556

57+
def gh_url():
58+
return os.environ['TOOLSTATE_ISSUES_API_URL']
59+
60+
def maybe_delink(message):
61+
if os.environ.get('TOOLSTATE_SKIP_MENTIONS') is not None:
62+
return message.replace("@", "")
63+
return message
64+
5665
def issue(
5766
tool,
5867
maintainers,
@@ -61,13 +70,12 @@ def issue(
6170
pr_reviewer,
6271
):
6372
# Open an issue about the toolstate failure.
64-
gh_url = 'https://api.github.com/repos/rust-lang/rust/issues'
6573
assignees = [x.strip() for x in maintainers.split('@') if x != '']
6674
assignees.append(relevant_pr_user)
6775
response = urllib2.urlopen(urllib2.Request(
68-
gh_url,
76+
gh_url(),
6977
json.dumps({
70-
'body': textwrap.dedent('''\
78+
'body': maybe_delink(textwrap.dedent('''\
7179
Hello, this is your friendly neighborhood mergebot.
7280
After merging PR {}, I observed that the tool {} no longer builds.
7381
A follow-up PR to the repository {} is needed to fix the fallout.
@@ -77,7 +85,7 @@ def issue(
7785
7886
cc @{}, the PR reviewer, and @rust-lang/compiler -- nominating for prioritization.
7987
80-
''').format(relevant_pr_number, tool, REPOS.get(tool), relevant_pr_user, pr_reviewer),
88+
''').format(relevant_pr_number, tool, REPOS.get(tool), relevant_pr_user, pr_reviewer)),
8189
'title': '`{}` no longer builds after {}'.format(tool, relevant_pr_number),
8290
'assignees': assignees,
8391
'labels': ['T-compiler', 'I-nominated'],
@@ -216,11 +224,10 @@ def update_latest(
216224
f.write(message)
217225

218226
# Write the toolstate comment on the PR as well.
219-
gh_url = 'https://api.github.com/repos/rust-lang/rust/issues/{}/comments' \
220-
.format(number)
227+
issue_url = gh_url() + '/{}/comments'.format(number)
221228
response = urllib2.urlopen(urllib2.Request(
222-
gh_url,
223-
json.dumps({'body': message}),
229+
issue_url,
230+
json.dumps({'body': maybe_delink(message)}),
224231
{
225232
'Authorization': 'token ' + github_token,
226233
'Content-Type': 'application/json',

0 commit comments

Comments
 (0)