Skip to content

Commit e78d2f2

Browse files
author
Jiri Benc
committed
Merge branch 'detect-wrong-files' into 'main'
Delete mistakenly committed binary and prevent this from happening See merge request redhat/centos-stream/src/kernel/documentation!651
2 parents f4df8be + 07c9947 commit e78d2f2

File tree

3 files changed

+80
-51
lines changed

3 files changed

+80
-51
lines changed

Makefile

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,7 @@ all:
77
scripts/yaml2RHMAINTAINERS info/owners.yaml > info/RHMAINTAINERS
88
scripts/yaml2CODEOWNERS info/owners.yaml > info/CODEOWNERS
99
scripts/verifySubsystems info/owners.yaml
10-
@if ! git rev-parse --verify main >& /dev/null; then \
11-
git fetch origin main; \
12-
git checkout -b main --track origin/main -b main; \
13-
fi
14-
@if test -n "$$(git diff --name-status main | grep owners.yaml)" && \
15-
test "$$(git config --get owners.warning)" != "false"; then \
16-
echo "======================================================="; \
17-
echo "These changes include owners.yaml modifications. Please"; \
18-
echo "review these Merge Request Approval Rules. The Merge Request"; \
19-
echo "author must add the appropriate engineers as reviewers on"; \
20-
echo "the submitted documentation project Merge Request."; \
21-
echo " "; \
22-
echo "* Included and excluded file changes can be merged if the"; \
23-
echo "MR author is a subsystem maintainer. If the author is not a"; \
24-
echo "subsystem maintainer, then the subsystem maintainer must"; \
25-
echo "provide an approve."; \
26-
echo " "; \
27-
echo "* Any MR adding an engineer in a role must be authored by"; \
28-
echo "or approved by the added engineer. An additional approve from a"; \
29-
echo "subsystem maintainer is required, unless the maintainer is the"; \
30-
echo "author of the MR."; \
31-
echo " "; \
32-
echo "* Any MR removing an engineer in a role must be authored by"; \
33-
echo "or approved by the removed engineer, except in the case when"; \
34-
echo "the removed engineer is no longer with Red Hat. While removals"; \
35-
echo "from roles do not require the approve of the maintainer, MR"; \
36-
echo "authors are encouraged to add the maintainer for an approve."; \
37-
echo " "; \
38-
echo "* Any MR adding or modifying a devel-sst field requires the"; \
39-
echo "approval from the subsystem maintainer."; \
40-
echo " "; \
41-
echo "This warning can be disabled by executing:"; \
42-
echo " git config --add owners.warning false"; \
43-
echo "======================================================="; \
44-
fi
45-
@if test -n "$$(git diff main | grep "^+" | grep "\s\- rhel-sst-null" )"; then \
46-
echo "ERROR: New entries cannot set devel-sst to rhel-sst-null."; \
47-
exit 1; \
48-
fi
49-
@if test -n "$$(git diff --name-status main | grep validSSTNames.go)" && \
50-
test "$$(git config --get validsstnames.warning)" != "false"; then \
51-
echo "======================================================="; \
52-
echo "These changes include validSSTNames.go changes. You must ensure"; \
53-
echo "the SST names themselves, and the SST name changes in the file are"; \
54-
echo "approved by RHEL management. Changes to this file that have"; \
55-
echo "not been verified by management will be removed by reverting commits."; \
56-
echo " "; \
57-
echo "This warning can be disabled by executing:"; \
58-
echo " git config --add validsstnames.warning false"; \
59-
echo "======================================================="; \
60-
fi
10+
scripts/checks.sh
6111

6212
clean:
6313
@$(MAKE) -C scripts clean

scripts/RHMAINTAINERS_parser

-1.93 MB
Binary file not shown.

scripts/checks.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash
2+
set -e
3+
4+
function in_names()
5+
{
6+
local name
7+
for name in "${names[@]}"; do
8+
[[ $1 != "$name" ]] || return 0
9+
done
10+
return 1
11+
}
12+
13+
if ! git rev-parse --verify main >& /dev/null; then
14+
git fetch origin main
15+
git branch --track main origin/main
16+
fi
17+
IFS=$'\n' names=($(git diff --name-only main))
18+
if in_names info/owners.yaml; then
19+
for name in "${names[@]}"; do
20+
[[ $name != info/owners.yaml && $name != info/RHMAINTAINERS &&
21+
$name != info/CODEOWNERS ]] || continue
22+
echo "======================================================="
23+
echo "These changes include owners.yaml modifications together with other"
24+
echo "changes. As a safeguard against mistakes, this is not allowed."
25+
echo
26+
echo "If you need to do infrastructure changes please submit two separate"
27+
echo "merge requests, one for owners.yaml and one for the rest."
28+
echo "======================================================="
29+
exit 1
30+
done
31+
fi
32+
if in_names info/owners.yaml && \
33+
test "$(git config --get owners.warning)" != "false"; then
34+
echo "======================================================="
35+
echo "These changes include owners.yaml modifications. Please"
36+
echo "review these Merge Request Approval Rules. The Merge Request"
37+
echo "author must add the appropriate engineers as reviewers on"
38+
echo "the submitted documentation project Merge Request."
39+
echo " "
40+
echo "* Included and excluded file changes can be merged if the"
41+
echo "MR author is a subsystem maintainer. If the author is not a"
42+
echo "subsystem maintainer, then the subsystem maintainer must"
43+
echo "provide an approve."
44+
echo " "
45+
echo "* Any MR adding an engineer in a role must be authored by"
46+
echo "or approved by the added engineer. An additional approve from a"
47+
echo "subsystem maintainer is required, unless the maintainer is the"
48+
echo "author of the MR."
49+
echo " "
50+
echo "* Any MR removing an engineer in a role must be authored by"
51+
echo "or approved by the removed engineer, except in the case when"
52+
echo "the removed engineer is no longer with Red Hat. While removals"
53+
echo "from roles do not require the approve of the maintainer, MR"
54+
echo "authors are encouraged to add the maintainer for an approve."
55+
echo " "
56+
echo "* Any MR adding or modifying a devel-sst field requires the"
57+
echo "approval from the subsystem maintainer."
58+
echo " "
59+
echo "This warning can be disabled by executing:"
60+
echo " git config --add owners.warning false"
61+
echo "======================================================="
62+
fi
63+
if test -n "$(git diff main | grep "^+" | grep "\s\- rhel-sst-null" )"; then
64+
echo "ERROR: New entries cannot set devel-sst to rhel-sst-null."
65+
exit 1
66+
fi
67+
if in_names scripts/validSSTNames.go && \
68+
test "$(git config --get validsstnames.warning)" != "false"; then
69+
echo "======================================================="
70+
echo "These changes include validSSTNames.go changes. You must ensure"
71+
echo "the SST names themselves, and the SST name changes in the file are"
72+
echo "approved by RHEL management. Changes to this file that have"
73+
echo "not been verified by management will be removed by reverting commits."
74+
echo " "
75+
echo "This warning can be disabled by executing:"
76+
echo " git config --add validsstnames.warning false"
77+
echo "======================================================="
78+
fi
79+
exit 0

0 commit comments

Comments
 (0)