diff --git a/.github/workflows/contrib-tests.yml b/.github/workflows/contrib-tests.yml index 5ce71f18111..06cbb213281 100644 --- a/.github/workflows/contrib-tests.yml +++ b/.github/workflows/contrib-tests.yml @@ -28,4 +28,4 @@ jobs: run: | contrib_path=/tmp/opentelemetry-collector-contrib git clone https://github.com/open-telemetry/opentelemetry-collector-contrib.git $contrib_path - make CONTRIB_PATH=$contrib_path check-contrib + make CONTRIB_PATH=$contrib_path SKIP_RESTORE_CONTRIB=true check-contrib diff --git a/Makefile b/Makefile index de33fd532f3..76089f26f05 100644 --- a/Makefile +++ b/Makefile @@ -318,8 +318,18 @@ check-contrib: @$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -replace go.opentelemetry.io/collector/semconv=$(CURDIR)/semconv" @$(MAKE) -C $(CONTRIB_PATH) -j2 gotidy @$(MAKE) -C $(CONTRIB_PATH) test - @echo Restoring contrib to no longer use this core checkout + @if [ -z "$(SKIP_RESTORE_CONTRIB)" ]; then \ + $(MAKE) restore-contrib; \ + fi + +# Restores contrib to its original state after running check-contrib. +.PHONY: restore-contrib +restore-contrib: + @echo Restoring contrib at $(CONTRIB_PATH) to its original state @$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector" + @$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/pdata" + @$(MAKE) -C $(CONTRIB_PATH) for-all CMD="$(GOCMD) mod edit -dropreplace go.opentelemetry.io/collector/semconv" + @$(MAKE) -C $(CONTRIB_PATH) -j2 gotidy # List of directories where certificates are stored for unit tests. CERT_DIRS := localhost|""|config/configgrpc/testdata \