Skip to content

Commit

Permalink
[chore] remove generated code (open-telemetry#34844)
Browse files Browse the repository at this point in the history
**Description:** <Describe what has changed.>
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
This PR:
- removes all of the auto generated files in cmd/otelcontribcol and
cmd/oteltestbedcol
- left some files in place to support the setup, e.g. Dockerfile,
metadata.yaml files, builder-config.yaml files
- adds gitignore files in the folders in question to prevent committing
of auto-generated files
- adds the tools folder to all actions/cache pipeline steps since there
were some caching issues that came up during development of this PR
- adds make generate commands to place where the auto-generated code
files are needed

**Link to tracking Issue:**
Fixes
open-telemetry#27850
Fixes open-telemetry#30884

Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
  • Loading branch information
mowies authored and AkhigbeEromo committed Oct 9, 2024
1 parent 85c8da2 commit d895eae
Show file tree
Hide file tree
Showing 27 changed files with 32 additions and 7,690 deletions.
23 changes: 15 additions & 8 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
Expand All @@ -48,6 +49,7 @@ jobs:
needs: [setup-environment]
steps:
- uses: actions/checkout@v4
- run: make genotelcontribcol
- name: Check Collector Module Version
run: ./.github/workflows/scripts/check-collector-module-version.sh
check-codeowners:
Expand Down Expand Up @@ -102,6 +104,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -171,6 +174,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
Expand All @@ -194,13 +198,15 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- run: make genotelcontribcol
- name: CheckDoc
run: make checkdoc
- name: CheckMetadata
Expand All @@ -219,14 +225,6 @@ jobs:
run: |
make gotidy
git diff --exit-code || (echo 'go.mod/go.sum deps changes detected, please run "make gotidy" and commit the changes in this PR.' && exit 1)
- name: Gen genotelcontribcol
run: |
make genotelcontribcol
git diff -s --exit-code || (echo 'Generated code is out of date, please run "make genotelcontribcol" and commit the changes in this PR.' && exit 1)
- name: Gen genoteltestbedcol
run: |
make genoteltestbedcol
git diff -s --exit-code || (echo 'Generated code is out of date, please run "make genoteltestbedcol" and commit the changes in this PR.' && exit 1)
- name: Gen distributions
run: |
make gendistributions
Expand Down Expand Up @@ -289,6 +287,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -379,6 +378,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Run Integration Tests
run: make gointegration-test GROUP=${{ matrix.group }}
Expand Down Expand Up @@ -417,6 +417,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
Expand All @@ -443,6 +444,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
Expand All @@ -458,6 +460,7 @@ jobs:
needs: [setup-environment]
steps:
- uses: actions/checkout@v4
- run: make genotelcontribcol
- name: Build Examples
run: make build-examples

Expand Down Expand Up @@ -513,13 +516,16 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Install Tools
if: steps.go-cache.outputs.cache-hit != 'true'
run: make install-tools
- name: Generate collector files
run: make genotelcontribcol
- name: Build Collector ${{ matrix.binary }}
run: make GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} GOARM=${{ matrix.arm }} otelcontribcol
- name: Upload Collector Binaries
Expand Down Expand Up @@ -563,6 +569,7 @@ jobs:
path: |
~/go/bin
~/go/pkg/mod
./.tools
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Generate otelcontribcol files
run: make genotelcontribcol
- name: Build Collector
run: make otelcontribcol
- name: Upload Collector Binary
Expand Down Expand Up @@ -101,6 +103,8 @@ jobs:
- name: Install dependencies
if: steps.go-cache.outputs.cache-hit != 'true'
run: make -j2 gomoddownload
- name: Generate otelcontribcol files
run: make genotelcontribcol
- name: Build Docker Image
run: |
make docker-otelcontribcol
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/prometheus-compliance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
~/go/bin
~/go/pkg/mod
~/.cache/go-build
./.tools
key: prometheus-${{ runner.os }}-go-${{ hashFiles('**/go.mod', '**/go.sum') }}
- run: make genotelcontribcol
working-directory: opentelemetry-collector-contrib
- run: make otelcontribcol
working-directory: opentelemetry-collector-contrib
- name: Checkout compliance repo
Expand Down
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ chlog-update: $(CHLOGGEN)
.PHONY: genotelcontribcol
genotelcontribcol: $(BUILDER)
$(BUILDER) --skip-compilation --config cmd/otelcontribcol/builder-config.yaml --output-path cmd/otelcontribcol
$(MAKE) --no-print-directory -C cmd/otelcontribcol fmt

# Build the Collector executable.
.PHONY: otelcontribcol
Expand All @@ -351,7 +350,6 @@ otelcontribcollite:
.PHONY: genoteltestbedcol
genoteltestbedcol: $(BUILDER)
$(BUILDER) --skip-compilation --config cmd/oteltestbedcol/builder-config.yaml --output-path cmd/oteltestbedcol
$(MAKE) --no-print-directory -C cmd/oteltestbedcol fmt

# Build the Collector executable, with only components used in testbed.
.PHONY: oteltestbedcol
Expand Down
4 changes: 4 additions & 0 deletions cmd/otelcontribcol/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!builder-config.yaml
!Dockerfile
!metadata.yaml
4 changes: 1 addition & 3 deletions cmd/otelcontribcol/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM alpine:latest as prep
FROM alpine:latest AS prep
RUN apk --update add ca-certificates

RUN mkdir -p /tmp

FROM scratch

ARG USER_UID=10001
Expand Down
4 changes: 0 additions & 4 deletions cmd/otelcontribcol/Makefile

This file was deleted.

4 changes: 0 additions & 4 deletions cmd/otelcontribcol/README.md

This file was deleted.

Loading

0 comments on commit d895eae

Please sign in to comment.