Skip to content

Commit 1a41303

Browse files
authored
Merge pull request #5628 from antoooks/release-helper-script
Release helper script
2 parents 7cbaf78 + b1a9bff commit 1a41303

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

CONTRIBUTING.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,39 @@ cd kustomize
7575
git push origin myfeature
7676
```
7777

78+
### Pull Request Rules
79+
80+
We are using [Conventional Commits v1.0.0](https://www.conventionalcommits.org/en/v1.0.0/) as the main guideline of making PR. This guideline serves to help contributor and maintainer to classify their changes, thus providing better insight on type of release will be covered on each Kustomize release cycle.
81+
82+
1. Please add these keywords on your PR titles accordingly
83+
84+
| Keyword | Description | Example |
85+
| ------------- | ------------- | ------------- |
86+
| fix | Patching or fixing bugs or improvements introduction from previous release. This type of change will mark a `PATCH` release. | fix: fix null value when generating yaml |
87+
| feat | New features. This change will mark a `MINOR` release. | feat: new transformer and generator for ACME API CRD. |
88+
| chore | Minor improvement outside main code base | chore: add exclusion for transformer test. |
89+
| ci | CI/CD related changes (e.g. github workflow, scripts, CI steps). | ci: remove blocking tests |
90+
| docs | Changes related to documentation. | docs: add rules documentation for PR. |
91+
92+
93+
2. Add `BREAKING CHANGE:` on your commit message as footer to signify breaking changes. This will help maintainers identify `MAJOR` releases.
94+
95+
Example:
96+
97+
```
98+
feat: change YAML parser from `yaml/v1` to `yaml/v2`
99+
100+
BREAKING CHANGE: parse() function now works with 2 arguments.
101+
```
102+
78103
### Create a Pull Request
104+
79105
1. Visit your fork at `https://github.com/<user>/kustomize`
80106
2. Click the **Compare & Pull Request** button next to your `myfeature` branch.
81107
3. Check out the pull request [process](https://github.com/kubernetes/community/blob/master/contributors/guide/pull-requests.md) for more details and advice.
82108

83109
If you ran `git push` in the previous step, GitHub will return a useful link to create a Pull Request.
84110

85-
86111
### Build Kustomize
87112
The [Kustomize Architecture] document describes the respository organization and the kustomize build process.
88113
```bash

releasing/check-release-helper.sh

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2024 The Kubernetes Authors.
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
6+
declare PATCH=false
7+
declare MINOR=false
8+
declare MAJOR=false
9+
declare rc=0
10+
11+
ORIGIN_MASTER="origin/master"
12+
LATEST_TAG=$(git describe --tags --abbrev=0)
13+
14+
git log "${LATEST_TAG}..HEAD" --oneline | tee /tmp/release-changelogs.txt
15+
16+
count=$(cat /tmp/release-changelogs.txt | wc -l)
17+
18+
if [[ $(cat /tmp/release-changelogs.txt | grep fix) || $(cat /tmp/release-changelogs.txt | grep patch) || $(cat /tmp/release-changelogs.txt | grep chore) || $(cat /tmp/release-changelogs.txt | grep docs) ]]; then
19+
PATCH=true
20+
fi
21+
22+
if [[ $(cat /tmp/release-changelogs.txt | grep feat) ]]; then
23+
MINOR=true
24+
fi
25+
26+
for commit in $(cut -d' ' -f1 /tmp/release-changelogs.txt); do
27+
git log --format=%B -n 1 $commit | grep "BREAKING CHANGE"
28+
if [ $? -eq 0 ]; then
29+
MAJOR=true
30+
fi
31+
done
32+
33+
for f in $(find api); do
34+
git diff "${LATEST_TAG}...${ORIGIN_MASTER}" --exit-code -- "${f}"
35+
if [ $? -eq 1 ]; then
36+
echo "Found changes on api dir at ${f}"
37+
MAJOR=true
38+
fi
39+
done
40+
41+
echo -e "\n"
42+
echo -e "================================================================================="
43+
echo "Change counter: $(echo $count | tr -s ' ')"
44+
if [[ $MAJOR == false && $MINOR == false ]]; then
45+
echo "Recommended release type: patch"
46+
elif [[ $MAJOR == false && $MINOR == true ]]; then
47+
echo "Recommended release type: minor"
48+
else
49+
echo "Recommended release type: major"
50+
fi

0 commit comments

Comments
 (0)