Skip to content

Commit d2b5b76

Browse files
committed
Do not push a commit if the toolstate is unchanged.
This should greatly reduce the commits on the rust-toolstate repository. `publish_toolstate.py` defaults to keep the old status if a new one is not found, so nothing needs to be changed to that file.
1 parent 14d50bf commit d2b5b76

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

src/ci/docker/x86_64-gnu-tools/checkregression.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
os_name = sys.argv[1]
1919
toolstate_file = sys.argv[2]
2020
current_state = sys.argv[3]
21+
verb = sys.argv[4] # 'regressed' or 'changed'
2122

2223
with open(toolstate_file, 'r') as f:
2324
toolstate = json.load(f)
@@ -29,10 +30,17 @@
2930
tool = cur['tool']
3031
state = cur[os_name]
3132
new_state = toolstate.get(tool, '')
32-
if new_state < state:
33+
if verb == 'regressed':
34+
updated = new_state < state
35+
elif verb == 'changed':
36+
updated = new_state != state
37+
else:
38+
print('Unknown verb {}'.format(updated))
39+
sys.exit(2)
40+
if updated:
3341
print(
34-
'Error: The state of "{}" has regressed from "{}" to "{}"'
35-
.format(tool, state, new_state)
42+
'The state of "{}" has {} from "{}" to "{}"'
43+
.format(tool, verb, state, new_state)
3644
)
3745
regressed = True
3846

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,26 @@ status_check() {
9191

9292
status_check "submodule_changed"
9393

94-
if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
95-
. "$(dirname $0)/repo.sh"
96-
MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
97-
echo "($OS CI update)" > "$MESSAGE_FILE"
98-
commit_toolstate_change "$MESSAGE_FILE" \
94+
CHECK_NOT="$(dirname $0)/checkregression.py"
95+
change_toolstate() {
96+
# only update the history
97+
if python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" changed; then
98+
echo 'Toolstate is not changed. Not updating.'
99+
else
100+
if [ $SIX_WEEK_CYCLE -eq 5 ]; then
101+
python2.7 "$CHECK_NOT" "$OS" "$TOOLSTATE_FILE" "_data/latest.json" regressed
102+
fi
99103
sed -i "1 a\\
100104
$COMMIT\t$(cat "$TOOLSTATE_FILE")
101105
" "history/$OS.tsv"
102-
# if we are at the last week in the 6-week release cycle, reject any kind of regression.
103-
if [ $SIX_WEEK_CYCLE -eq 5 ]; then
104-
python2.7 "$(dirname $0)/checkregression.py" \
105-
"$OS" "$TOOLSTATE_FILE" "rust-toolstate/_data/latest.json"
106106
fi
107+
}
108+
109+
if [ "$RUST_RELEASE_CHANNEL" = nightly -a -n "${TOOLSTATE_REPO_ACCESS_TOKEN+is_set}" ]; then
110+
. "$(dirname $0)/repo.sh"
111+
MESSAGE_FILE=$(mktemp -t msg.XXXXXX)
112+
echo "($OS CI update)" > "$MESSAGE_FILE"
113+
commit_toolstate_change "$MESSAGE_FILE" change_toolstate
107114
rm -f "$MESSAGE_FILE"
108115
exit 0
109116
fi

0 commit comments

Comments
 (0)