Skip to content

Commit b731208

Browse files
authored
Use githubgen tool from go-build-tools (#37412)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description - This PR - switches over all usages of the githubgen tool to the new tool location by adjusting make targets and the check-code-owners pipeline - introduces the new githubgen tool at its latest v0.17.0 version - adds `make gengithub` to the commands to run in the contribution guide - re-generates the codeowners and allowlist files using the new githubgen tool (only cosmetic changes) <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Part of #37294 <!--Please delete paragraphs that you did not use before submitting.--> --------- Signed-off-by: Moritz Wiesinger <[email protected]>
1 parent 4542bbf commit b731208

File tree

11 files changed

+68
-43
lines changed

11 files changed

+68
-43
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: githubgen
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Switch over all usages of githubgen to the new tool location, since the old tool was deprecated
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [37412, 37294]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

.github/ALLOWLIST

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
# Code generated by githubgen. DO NOT EDIT.
22
#####################################################
33
#
4-
# List of components in OpenTelemetry Collector Contrib
4+
# List of components
55
# waiting on owners to be assigned
66
#
77
#####################################################
88
#
9-
# Learn about membership in OpenTelemetry community:
10-
# https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md
11-
#
12-
#
139
# Learn about CODEOWNERS file format:
1410
# https://help.github.com/en/articles/about-code-owners
1511
#

.github/CODEOWNERS

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
# Code generated by githubgen. DO NOT EDIT.
22
#####################################################
33
#
4-
# List of codeowners for OpenTelemetry Collector Contrib
4+
# List of codeowners
55
#
66
#####################################################
77
#
8-
# Learn about membership in OpenTelemetry community:
9-
# https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md
10-
#
11-
#
128
# Learn about CODEOWNERS file format:
139
# https://help.github.com/en/articles/about-code-owners
1410
#
@@ -317,16 +313,18 @@ testbed/mockdatasenders/mockdatadogagentexporter/ @open-telemetry
317313

318314
#####################################################
319315
#
320-
# List of distribution maintainers for OpenTelemetry Collector Contrib
316+
# List of distribution maintainers
321317
#
322318
#####################################################
323319

324320
reports/distributions/core.yaml @open-telemetry/collector-contrib-approvers
325321
reports/distributions/contrib.yaml @open-telemetry/collector-contrib-approvers
326322
reports/distributions/k8s.yaml @open-telemetry/collector-contrib-approvers
327-
323+
#####################################################
324+
#
328325
## UNMAINTAINED components
329-
326+
#
327+
#####################################################
330328
exporter/kineticaexporter/ @open-telemetry/collector-contrib-approvers
331329
exporter/opensearchexporter/ @open-telemetry/collector-contrib-approvers
332330
extension/observer/ecstaskobserver/ @open-telemetry/collector-contrib-approvers

.github/workflows/check-codeowners.yaml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,42 +21,40 @@ concurrency:
2121
cancel-in-progress: true
2222

2323
jobs:
24-
setup-environment:
24+
check-codeowners:
2525
timeout-minutes: 30
2626
runs-on: ubuntu-24.04
2727
if: ${{ github.actor != 'dependabot[bot]' && github.repository == 'open-telemetry/opentelemetry-collector-contrib' }}
2828
steps:
2929
- uses: actions/checkout@v4
30+
3031
- uses: actions/setup-go@v5
3132
with:
3233
go-version: "1.22.8"
3334
cache: false
34-
- name: Cache Go
35-
id: go-cache
35+
36+
- name: Cache Go Tools
37+
id: go-tools-cache
3638
timeout-minutes: 5
3739
uses: actions/cache@v4
3840
with:
3941
path: |
40-
~/go/bin
41-
~/go/pkg/mod
4242
./.tools
43-
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
44-
check-codeowners:
45-
runs-on: ubuntu-24.04
46-
needs: [setup-environment]
47-
steps:
48-
- uses: actions/checkout@v4
49-
- name: Gen githubgen tool
43+
key: go-tools-${{ runner.os }}-${{ hashFiles('internal/tools/go.sum') }}
44+
45+
- name: Install tools
46+
if: github.repository == 'open-telemetry/opentelemetry-collector-contrib' && steps.go-tools-cache.outputs.cache-hit != 'true'
5047
run: |
51-
make githubgen-install
52-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
48+
make install-tools
49+
5350
- uses: actions/checkout@v4
5451
with:
5552
ref: ${{github.event.pull_request.head.ref}}
5653
repository: ${{github.event.pull_request.head.repo.full_name}}
5754
path: pr
55+
5856
- name: Gen CODEOWNERS
5957
run: |
6058
cd pr
61-
GITHUB_TOKEN=${{ secrets.READ_ORG_AND_USER_TOKEN }} githubgen
59+
GITHUB_TOKEN=${{ secrets.READ_ORG_AND_USER_TOKEN }} ./.tools/githubgen codeowners
6260
git diff -s --exit-code || (echo 'Generated code is out of date, please apply this diff and commit the changes in this PR.' && git diff && exit 1)

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ When submitting a component to the community, consider breaking it down into sep
215215
* `make generate`
216216
* `make multimod-verify`
217217
* `make generate-gh-issue-templates`
218+
* `make gengithub`
218219
* `make addlicense`
219220
* **Second PR** should include the concrete implementation of the component. If the
220221
size of this PR is larger than the recommended size consider splitting it in

Makefile

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -310,20 +310,16 @@ generate: install-tools
310310
PATH="$$PWD/.tools:$$PATH" $(MAKE) for-all CMD="$(GOCMD) generate ./..."
311311
$(MAKE) gofmt
312312

313-
.PHONY: githubgen-install
314-
githubgen-install:
315-
cd cmd/githubgen && $(GOCMD) install .
316-
317313
.PHONY: gengithub
318-
gengithub: githubgen-install
319-
githubgen
314+
gengithub: $(GITHUBGEN)
315+
$(GITHUBGEN)
320316

321317
.PHONY: gendistributions
322-
gendistributions: githubgen-install
323-
githubgen distributions
318+
gendistributions: $(GITHUBGEN)
319+
$(GITHUBGEN) distributions
324320

325321
.PHONY: update-codeowners
326-
update-codeowners: gengithub generate
322+
update-codeowners: generate gengithub
327323

328324
FILENAME?=$(shell git branch --show-current)
329325
.PHONY: chlog-new
@@ -559,8 +555,7 @@ clean:
559555

560556
.PHONY: generate-gh-issue-templates
561557
generate-gh-issue-templates:
562-
cd cmd/githubgen && $(GOCMD) install .
563-
githubgen issue-templates
558+
$(GITHUBGEN) issue-templates
564559

565560
.PHONY: checks
566561
checks:

Makefile.Common

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ MISSPELL_CORRECTION := $(TOOLS_BIN_DIR)/misspell -w
6868
LINT := $(TOOLS_BIN_DIR)/golangci-lint
6969
MULTIMOD := $(TOOLS_BIN_DIR)/multimod
7070
CHLOGGEN := $(TOOLS_BIN_DIR)/chloggen
71+
GITHUBGEN := $(TOOLS_BIN_DIR)/githubgen
7172
GOIMPORTS := $(TOOLS_BIN_DIR)/goimports
7273
PORTO := $(TOOLS_BIN_DIR)/porto
7374
CHECKFILE := $(TOOLS_BIN_DIR)/checkfile

cmd/githubgen/metadata.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
type: githubgen
22

33
status:
4+
stability:
5+
deprecated: []
46
class: cmd
57
codeowners:
6-
active: [atoulme]
8+
active: [atoulme]

internal/tools/go.mod

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ require (
1414
go.opentelemetry.io/build-tools/checkfile v0.16.0
1515
go.opentelemetry.io/build-tools/chloggen v0.16.0
1616
go.opentelemetry.io/build-tools/crosslink v0.16.0
17+
go.opentelemetry.io/build-tools/githubgen v0.17.0
1718
go.opentelemetry.io/build-tools/issuegenerator v0.16.0
1819
go.opentelemetry.io/build-tools/multimod v0.16.0
1920
go.opentelemetry.io/collector/cmd/builder v0.118.1-0.20250121185328-fbefb22cc2b3
@@ -107,7 +108,8 @@ require (
107108
github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect
108109
github.com/google/go-cmp v0.6.0 // indirect
109110
github.com/google/go-github v17.0.0+incompatible // indirect
110-
github.com/google/go-querystring v1.0.0 // indirect
111+
github.com/google/go-github/v66 v66.0.0 // indirect
112+
github.com/google/go-querystring v1.1.0 // indirect
111113
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
112114
github.com/gordonklaus/ineffassign v0.1.0 // indirect
113115
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect

internal/tools/go.sum

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/tools/tools.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
_ "go.opentelemetry.io/build-tools/checkfile"
2323
_ "go.opentelemetry.io/build-tools/chloggen"
2424
_ "go.opentelemetry.io/build-tools/crosslink"
25+
_ "go.opentelemetry.io/build-tools/githubgen"
2526
_ "go.opentelemetry.io/build-tools/issuegenerator"
2627
_ "go.opentelemetry.io/build-tools/multimod"
2728
_ "go.opentelemetry.io/collector/cmd/builder"

0 commit comments

Comments
 (0)