diff --git a/cmd/release-notes/README.md b/cmd/release-notes/README.md index e9a9d32a98c..75c846e6488 100644 --- a/cmd/release-notes/README.md +++ b/cmd/release-notes/README.md @@ -69,32 +69,33 @@ level=debug timestamp=2019-07-30T04:02:44.3716249Z caller=notes.go:497 msg="Excl ## Options -| Flag | Env Variable | Default Value | Required | Description | -| ----------------------- | --------------- | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- | +| Flag | Env Variable | Default Value | Required | Description | +| ----------------------- | ----------------- | ------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **GITHUB REPO OPTIONS** | -| | GITHUB_TOKEN | | Yes | A personal GitHub access token | -| org | ORG | kubernetes | Yes | Name of GitHub organization | -| repo | REPO | kubernetes | Yes | Name of GitHub repository | -| required-author | REQUIRED_AUTHOR | k8s-ci-robot | Yes | Only commits from this GitHub user are considered. Set to empty string to include all users | -| branch | BRANCH | master | Yes | The GitHub repository branch to scrape | -| start-sha | START_SHA | | Yes | The commit hash to start processing from (inclusive) | -| end-sha | END_SHA | | Yes | The commit hash to end processing at (inclusive) | -| github-base-url | GITHUB_BASE_URL | | No | The base URL of Github | -| github-upload-url | GITHUB_UPLOAD_URL | | No | The upload URL of enterprise Github | -| repo-path | REPO_PATH | /tmp/k8s-repo | No | Path to a local Kubernetes repository, used only for tag discovery | -| start-rev | START_REV | | No | The git revision to start at. Can be used as alternative to start-sha | -| end-rev | END_REV | | No | The git revision to end at. Can be used as alternative to end-sha | -| discover | DISCOVER | none | No | The revision discovery mode for automatic revision retrieval (options: none, mergebase-to-latest, patch-to-patch, patch-to-latest, minor-to-minor) | -| release-bucket | RELEASE_BUCKET | kubernetes-release | No | Specify gs bucket to point to in generated notes (default "kubernetes-release") | -| release-tars | RELEASE_TARS | | No | Directory of tars to sha512 sum for display | +| | GITHUB_TOKEN | | Yes | A personal GitHub access token | +| org | ORG | kubernetes | Yes | Name of GitHub organization | +| repo | REPO | kubernetes | Yes | Name of GitHub repository | +| required-author | REQUIRED_AUTHOR | k8s-ci-robot | Yes | Only commits from this GitHub user are considered. Set to empty string to include all users | +| branch | BRANCH | master | Yes | The GitHub repository branch to scrape | +| start-sha | START_SHA | | Yes | The commit hash to start processing from (inclusive) | +| end-sha | END_SHA | | Yes | The commit hash to end processing at (inclusive) | +| github-base-url | GITHUB_BASE_URL | | No | The base URL of Github | +| github-upload-url | GITHUB_UPLOAD_URL | | No | The upload URL of enterprise Github | +| repo-path | REPO_PATH | /tmp/k8s-repo | No | Path to a local Kubernetes repository, used only for tag discovery | +| start-rev | START_REV | | No | The git revision to start at. Can be used as alternative to start-sha | +| end-rev | END_REV | | No | The git revision to end at. Can be used as alternative to end-sha | +| skip-first-commit | SKIP_FIRST_COMMIT | false | No | Skip the first commit if --start-rev is being used. This is useful if the --start-rev is a tag which should not be included in the release notes. | +| discover | DISCOVER | none | No | The revision discovery mode for automatic revision retrieval (options: none, mergebase-to-latest, patch-to-patch, patch-to-latest, minor-to-minor) | +| release-bucket | RELEASE_BUCKET | kubernetes-release | No | Specify gs bucket to point to in generated notes (default "kubernetes-release") | +| release-tars | RELEASE_TARS | | No | Directory of tars to sha512 sum for display | | **OUTPUT OPTIONS** | -| output | OUTPUT | | No | The path where the release notes will be written | -| format | FORMAT | markdown | No | The format for notes output (options: json, markdown) | -| markdown-links | MARKDOWN_LINKS | false | No | Add links for PRs and authors in the markdown format. This is useful when the release notes are outputted to a file. When using the GitHub release page to publish release notes, this option should be set to false to take advantage of Github's autolinked references (options: true, false) | -| go-template | GO_TEMPLATE | go-template:default | No | The go template if `--format=markdown` (options: go-template:default, go-template:inline: go-template:) | -| dependencies | | true | No | Add dependency report | +| output | OUTPUT | | No | The path where the release notes will be written | +| format | FORMAT | markdown | No | The format for notes output (options: json, markdown) | +| markdown-links | MARKDOWN_LINKS | false | No | Add links for PRs and authors in the markdown format. This is useful when the release notes are outputted to a file. When using the GitHub release page to publish release notes, this option should be set to false to take advantage of Github's autolinked references (options: true, false) | +| go-template | GO_TEMPLATE | go-template:default | No | The go template if `--format=markdown` (options: go-template:default, go-template:inline: go-template:) | +| dependencies | | true | No | Add dependency report | | **LOG OPTIONS** | -| debug | DEBUG | false | No | Enable debug logging (options: true, false) | +| debug | DEBUG | false | No | Enable debug logging (options: true, false) | ## Building From Source diff --git a/cmd/release-notes/generate.go b/cmd/release-notes/generate.go index 7bec757491d..f2758d83a5d 100644 --- a/cmd/release-notes/generate.go +++ b/cmd/release-notes/generate.go @@ -113,6 +113,17 @@ func addGenerateFlags(subcommand *cobra.Command) { "The git revision to end at. Can be used as alternative to end-sha.", ) + // SkipFirstCommit skips the first commit if StartRev is being used. This + // is useful if StartRev is a tag which should not be included in the + // release notes. + subcommand.PersistentFlags().BoolVarP( + &opts.SkipFirstCommit, + "skip-first-commit", + "s", + env.IsSet("SKIP_FIRST_COMMIT"), + "Skip the first commit if --start-rev is being used. This is useful if the --start-rev is a tag which should not be included in the release notes.", + ) + // repoPath contains the path to a local Kubernetes repository to avoid the // delay during git clone subcommand.PersistentFlags().StringVar( diff --git a/go.mod b/go.mod index 6b11a8c7505..f78b983f419 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/goark/go-cvss v1.6.6 github.com/golang/protobuf v1.5.4 github.com/google/go-containerregistry v0.19.1 - github.com/google/go-github/v58 v58.0.0 + github.com/google/go-github/v60 v60.0.0 github.com/google/safetext v0.0.0-20230106111101-7156a760e523 github.com/google/uuid v1.6.0 github.com/hashicorp/go-multierror v1.1.1 @@ -34,24 +34,23 @@ require ( github.com/tj/go-spin v1.1.0 github.com/yuin/goldmark v1.7.1 golang.org/x/net v0.25.0 - golang.org/x/oauth2 v0.19.0 + golang.org/x/oauth2 v0.21.0 golang.org/x/text v0.15.0 google.golang.org/api v0.172.0 gopkg.in/yaml.v2 v2.4.0 - k8s.io/apimachinery v0.29.3 + k8s.io/apimachinery v0.29.4 k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 sigs.k8s.io/bom v0.6.0 sigs.k8s.io/mdtoc v1.3.0 sigs.k8s.io/promo-tools/v3 v3.6.0 - sigs.k8s.io/release-sdk v0.11.0 + sigs.k8s.io/release-sdk v0.12.0 sigs.k8s.io/release-utils v0.8.3-0.20240529125243-e30fa4b6f720 sigs.k8s.io/yaml v1.4.0 ) require ( cloud.google.com/go v0.112.1 // indirect - cloud.google.com/go/compute v1.25.0 // indirect - cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/compute/metadata v0.3.0 // indirect cloud.google.com/go/iam v1.1.6 // indirect cuelabs.dev/go/oci/ociregistry v0.0.0-20240314152124-224736b49f2e // indirect cuelang.org/go v0.8.1 // indirect @@ -235,7 +234,7 @@ require ( github.com/sigstore/cosign/v2 v2.2.4 // indirect github.com/sigstore/fulcio v1.4.5 // indirect github.com/sigstore/rekor v1.3.6 // indirect - github.com/sigstore/sigstore v1.8.3 // indirect + github.com/sigstore/sigstore v1.8.4 // indirect github.com/sigstore/timestamp-authority v1.2.2 // indirect github.com/skeema/knownhosts v1.2.2 // indirect github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 // indirect diff --git a/go.sum b/go.sum index b8936ceea3c..077fef3c3e3 100644 --- a/go.sum +++ b/go.sum @@ -20,10 +20,8 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.25.0 h1:H1/4SqSUhjPFE7L5ddzHOfY2bCAvjwNRZPNl6Ni5oYU= -cloud.google.com/go/compute v1.25.0/go.mod h1:GR7F0ZPZH8EhChlMo9FkLd7eUTwEymjqQagxzilIxIE= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= +cloud.google.com/go/compute/metadata v0.3.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= @@ -377,8 +375,8 @@ github.com/go-piv/piv-go v1.11.0 h1:5vAaCdRTFSIW4PeqMbnsDlUZ7odMYWnHBDGdmtU/Zhg= github.com/go-piv/piv-go v1.11.0/go.mod h1:NZ2zmjVkfFaL/CF8cVQ/pXdXtuj110zEKGdJM6fJZZM= github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= -github.com/go-rod/rod v0.114.7 h1:h4pimzSOUnw7Eo41zdJA788XsawzHjJMyzCE3BrBww0= -github.com/go-rod/rod v0.114.7/go.mod h1:aiedSEFg5DwG/fnNbUOTPMTTWX3MRj6vIs/a684Mthw= +github.com/go-rod/rod v0.116.0 h1:ypRryjTys3EnqHskJ/TdgodFMvXV0EHvmy4bSkKZgHM= +github.com/go-rod/rod v0.116.0/go.mod h1:aiedSEFg5DwG/fnNbUOTPMTTWX3MRj6vIs/a684Mthw= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= @@ -464,8 +462,8 @@ github.com/google/go-containerregistry v0.19.1 h1:yMQ62Al6/V0Z7CqIrrS1iYoA5/oQCm github.com/google/go-containerregistry v0.19.1/go.mod h1:YCMFNQeeXeLF+dnhhWkqDItx/JSkH01j1Kis4PsjzFI= github.com/google/go-github/v55 v55.0.0 h1:4pp/1tNMB9X/LuAhs5i0KQAE40NmiR/y6prLNb9x9cg= github.com/google/go-github/v55 v55.0.0/go.mod h1:JLahOTA1DnXzhxEymmFF5PP2tSS9JVNj68mSZNDwskA= -github.com/google/go-github/v58 v58.0.0 h1:Una7GGERlF/37XfkPwpzYJe0Vp4dt2k1kCjlxwjIvzw= -github.com/google/go-github/v58 v58.0.0/go.mod h1:k4hxDKEfoWpSqFlc8LTpGd9fu2KrV1YAa6Hi6FmDNY4= +github.com/google/go-github/v60 v60.0.0 h1:oLG98PsLauFvvu4D/YPxq374jhSxFYdzQGNCyONLfn8= +github.com/google/go-github/v60 v60.0.0/go.mod h1:ByhX2dP9XT9o/ll2yXAu2VD8l5eNVg8hD4Cr0S/LmQk= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -753,8 +751,8 @@ github.com/sigstore/fulcio v1.4.5 h1:WWNnrOknD0DbruuZWCbN+86WRROpEl3Xts+WT2Ek1yc github.com/sigstore/fulcio v1.4.5/go.mod h1:oz3Qwlma8dWcSS/IENR/6SjbW4ipN0cxpRVfgdsjMU8= github.com/sigstore/rekor v1.3.6 h1:QvpMMJVWAp69a3CHzdrLelqEqpTM3ByQRt5B5Kspbi8= github.com/sigstore/rekor v1.3.6/go.mod h1:JDTSNNMdQ/PxdsS49DJkJ+pRJCO/83nbR5p3aZQteXc= -github.com/sigstore/sigstore v1.8.3 h1:G7LVXqL+ekgYtYdksBks9B38dPoIsbscjQJX/MGWkA4= -github.com/sigstore/sigstore v1.8.3/go.mod h1:mqbTEariiGA94cn6G3xnDiV6BD8eSLdL/eA7bvJ0fVs= +github.com/sigstore/sigstore v1.8.4 h1:g4ICNpiENFnWxjmBzBDWUn62rNFeny/P77HUC8da32w= +github.com/sigstore/sigstore v1.8.4/go.mod h1:1jIKtkTFEeISen7en+ZPWdDHazqhxco/+v9CNjc7oNg= github.com/sigstore/sigstore/pkg/signature/kms/aws v1.8.3 h1:LTfPadUAo+PDRUbbdqbeSl2OuoFQwUFTnJ4stu+nwWw= github.com/sigstore/sigstore/pkg/signature/kms/aws v1.8.3/go.mod h1:QV/Lxlxm0POyhfyBtIbTWxNeF18clMlkkyL9mu45y18= github.com/sigstore/sigstore/pkg/signature/kms/azure v1.8.3 h1:xgbPRCr2npmmsuVVteJqi/ERw9+I13Wou7kq0Yk4D8g= @@ -796,7 +794,6 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -1010,8 +1007,8 @@ golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4Iltr golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.19.0 h1:9+E/EZBCbTLNrbN35fHv/a/d/mOBatymz1zbtQrXpIg= -golang.org/x/oauth2 v0.19.0/go.mod h1:vYi7skDa1x015PmRRYZ7+s1cWyPgrPiSYRe4rnsexc8= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1297,8 +1294,8 @@ honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= k8s.io/api v0.28.4 h1:8ZBrLjwosLl/NYgv1P7EQLqoO8MGQApnbgH8tu3BMzY= k8s.io/api v0.28.4/go.mod h1:axWTGrY88s/5YE+JSt4uUi6NMM+gur1en2REMR7IRj0= -k8s.io/apimachinery v0.29.3 h1:2tbx+5L7RNvqJjn7RIuIKu9XTsIZ9Z5wX2G22XAa5EU= -k8s.io/apimachinery v0.29.3/go.mod h1:hx/S4V2PNW4OMg3WizRrHutyB5la0iCUbZym+W0EQIU= +k8s.io/apimachinery v0.29.4 h1:RaFdJiDmuKs/8cm1M6Dh1Kvyh59YQFDcFuFTSmXes6Q= +k8s.io/apimachinery v0.29.4/go.mod h1:i3FJVwhvSp/6n8Fl4K97PJEP8C+MM+aoDq4+ZJBf70Y= k8s.io/client-go v0.28.4 h1:Np5ocjlZcTrkyRJ3+T3PkXDpe4UpatQxj85+xjaD2wY= k8s.io/client-go v0.28.4/go.mod h1:0VDZFpgoZfelyP5Wqu0/r/TRYcLYuJ2U1KEeoaPa1N4= k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= @@ -1326,8 +1323,8 @@ sigs.k8s.io/mdtoc v1.3.0 h1:iMJLfMax45vMl3rnwLjEhZ38TS6JqLXSpm0uDNo/zyo= sigs.k8s.io/mdtoc v1.3.0/go.mod h1:8zLWymqzP8oKMm+1m1e5GKnGZq8gbC1MreKfmRelMQA= sigs.k8s.io/promo-tools/v3 v3.6.0 h1:C2L08ezrWm1aZI8Emd3iZPZQserLPRgzuqQVxvI0PUI= sigs.k8s.io/promo-tools/v3 v3.6.0/go.mod h1:XJ3jy0hJYs+hWKt8XsLHFzGQV8PUtvllvbxjN/E5RXI= -sigs.k8s.io/release-sdk v0.11.0 h1:a+zjOO3tHm1NiVZgNcUWq5QrKmv7b63UZXw+XGdPGfk= -sigs.k8s.io/release-sdk v0.11.0/go.mod h1:sjbFpskyVjCXcFBnI3Bj1iGQHGjDYPoHVyld/pT+TvU= +sigs.k8s.io/release-sdk v0.12.0 h1:8rQ/eiXsp2EhRWTdgoCM+JQHplzCqtSZ5ksUJsbSU70= +sigs.k8s.io/release-sdk v0.12.0/go.mod h1:kT7repBLFONEhQxgKa1Ddm4Wy/0oRrQWGIwj4hocyrs= sigs.k8s.io/release-utils v0.8.3-0.20240529125243-e30fa4b6f720 h1:WsA6SydwiSu0sbYwgXpH72xWnxNAhSrcYd3W0LySZLs= sigs.k8s.io/release-utils v0.8.3-0.20240529125243-e30fa4b6f720/go.mod h1:u2Si4cUBWo2KBAL+7WB8d/HtwgqgssDAHepYu5+dpQY= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= diff --git a/pkg/fastforward/fastforward_test.go b/pkg/fastforward/fastforward_test.go index 225df9896fd..fc2fa6ad825 100644 --- a/pkg/fastforward/fastforward_test.go +++ b/pkg/fastforward/fastforward_test.go @@ -22,7 +22,7 @@ import ( "strings" "testing" - gogithub "github.com/google/go-github/v58/github" + gogithub "github.com/google/go-github/v60/github" "github.com/stretchr/testify/require" "k8s.io/release/pkg/fastforward/fastforwardfakes" ) diff --git a/pkg/fastforward/fastforwardfakes/fake_impl.go b/pkg/fastforward/fastforwardfakes/fake_impl.go index 71b7c9620c3..19077b5b906 100644 --- a/pkg/fastforward/fastforwardfakes/fake_impl.go +++ b/pkg/fastforward/fastforwardfakes/fake_impl.go @@ -20,7 +20,7 @@ package fastforwardfakes import ( "sync" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v60/github" "k8s.io/release/pkg/gcp/gcb" "sigs.k8s.io/release-sdk/git" ) diff --git a/pkg/fastforward/impl.go b/pkg/fastforward/impl.go index 5cdf3bdbdb4..4ca06873896 100644 --- a/pkg/fastforward/impl.go +++ b/pkg/fastforward/impl.go @@ -22,7 +22,7 @@ import ( "k8s.io/release/pkg/gcp/gcb" "k8s.io/release/pkg/release" - gogithub "github.com/google/go-github/v58/github" + gogithub "github.com/google/go-github/v60/github" "sigs.k8s.io/release-sdk/git" "sigs.k8s.io/release-sdk/github" "sigs.k8s.io/release-utils/env" diff --git a/pkg/notes/notes.go b/pkg/notes/notes.go index da385180e2d..f4a55ee6392 100644 --- a/pkg/notes/notes.go +++ b/pkg/notes/notes.go @@ -35,7 +35,7 @@ import ( "time" "unicode" - gogithub "github.com/google/go-github/v58/github" + gogithub "github.com/google/go-github/v60/github" "github.com/nozzle/throttler" "github.com/sergi/go-diff/diffmatchpatch" "github.com/sirupsen/logrus" diff --git a/pkg/notes/notes_gatherer_test.go b/pkg/notes/notes_gatherer_test.go index bcfa7068979..ca96016dbef 100644 --- a/pkg/notes/notes_gatherer_test.go +++ b/pkg/notes/notes_gatherer_test.go @@ -28,7 +28,7 @@ import ( "sync/atomic" "testing" - "github.com/google/go-github/v58/github" + "github.com/google/go-github/v60/github" "github.com/sirupsen/logrus" "sigs.k8s.io/release-sdk/git" "sigs.k8s.io/release-sdk/github/githubfakes" diff --git a/pkg/notes/options/options.go b/pkg/notes/options/options.go index 4fc0d583a42..afaa4695bd6 100644 --- a/pkg/notes/options/options.go +++ b/pkg/notes/options/options.go @@ -70,6 +70,11 @@ type Options struct { // valid git revision. Should not be used together with EndSHA. EndRev string + // SkipFirstCommit skips the first commit if StartRev is being used. This + // is useful if StartRev is a tag which should not be included in the + // release notes. + SkipFirstCommit bool + // Format specifies the format of the release notes. Can be either // `json` or `markdown`. Format string @@ -217,6 +222,10 @@ func (o *Options) ValidateAndFinish() (err error) { return errors.New("the ending commit hash must be set via --end-sha, $END_SHA, --end-rev or $END_REV") } + if o.SkipFirstCommit && o.StartRev == "" { + return errors.New("--skip-first-commit/-s can be only used together with --start-rev") + } + // Check if we have to parse a revision if (o.StartRev != "" && o.StartSHA == "") || (o.EndRev != "" && o.EndSHA == "") { repo, err := o.repo() @@ -228,6 +237,15 @@ func (o *Options) ValidateAndFinish() (err error) { if err != nil { return fmt.Errorf("resolving %s: %w", o.StartRev, err) } + + if o.SkipFirstCommit { + logrus.Infof("Skipping first commit: %s", sha) + sha, err = repo.NextCommit(sha, git.DefaultRemote+"/"+o.Branch) + if err != nil { + return fmt.Errorf("getting the next repo commit: %w", err) + } + } + logrus.Infof("Using found start SHA: %s", sha) o.StartSHA = sha }