Skip to content

Commit

Permalink
Merge pull request #3639 from saschagrunert/skip-first-commit
Browse files Browse the repository at this point in the history
release-notes: add `--skip-first-commit`/`-s` option
  • Loading branch information
k8s-ci-robot authored Jun 10, 2024
2 parents 09c6ce2 + 45a9b7a commit 6583af3
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 52 deletions.
47 changes: 24 additions & 23 deletions cmd/release-notes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:<template-string> go-template:<file.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:<template-string> go-template:<file.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

Expand Down
11 changes: 11 additions & 0 deletions cmd/release-notes/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 6583af3

Please sign in to comment.