Skip to content

Commit

Permalink
Use a single module for all binaries (open-telemetry#2317)
Browse files Browse the repository at this point in the history
* Use a single module for all binaries

* Move Go setup after checkout in CI jobs
  • Loading branch information
swiatekm authored Jan 11, 2024
1 parent 1f48d82 commit b50ddc3
Show file tree
Hide file tree
Showing 12 changed files with 368 additions and 1,832 deletions.
44 changes: 2 additions & 42 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,6 @@ updates:
schedule:
interval: daily
# Create a group of dependencies to be updated together in one pull request
groups:
golang-org-x:
patterns:
- "golang.org/x/*"
prometheus:
patterns:
- "github.com/prometheus-operator/prometheus-operator"
- "github.com/prometheus-operator/prometheus-operator/*"
- "github.com/prometheus/prometheus"
- "github.com/prometheus/prometheus/*"
- "github.com/prometheus/client_go"
- "github.com/prometheus/client_go/*"
kubernetes:
patterns:
- "k8s.io/*"
- "sigs.k8s.io/*"
- package-ecosystem: gomod
directory: /cmd/operator-opamp-bridge
schedule:
interval: daily
groups:
golang-org-x:
patterns:
Expand All @@ -43,28 +23,8 @@ updates:
- "sigs.k8s.io/*"
otel:
patterns:
- go.opentelemetry.io/otel
- go.opentelemetry.io/otel/*
- package-ecosystem: gomod
directory: /cmd/otel-allocator
schedule:
interval: daily
groups:
golang-org-x:
patterns:
- "golang.org/x/*"
prometheus:
patterns:
- "github.com/prometheus-operator/prometheus-operator"
- "github.com/prometheus-operator/prometheus-operator/*"
- "github.com/prometheus/prometheus"
- "github.com/prometheus/prometheus/*"
- "github.com/prometheus/client_go"
- "github.com/prometheus/client_go/*"
kubernetes:
patterns:
- "k8s.io/*"
- "sigs.k8s.io/*"
- "go.opentelemetry.io/otel"
- "go.opentelemetry.io/otel/*"

- package-ecosystem: github-actions
directory: /
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,28 @@ jobs:
name: Unit tests
runs-on: ubuntu-22.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "~1.21.1"

- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: "basic checks"
run: make ci

lint:
name: Code standards (linting)
runs-on: ubuntu-22.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "~1.21.1"
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- uses: actions/cache@v3
with:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: "~1.21.3"
cache-dependency-path: |
go.sum
cmd/otel-allocator/go.sum
cmd/operator-opamp-bridge/go.sum

- name: Setup kind
env:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish-operator-opamp-bridge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '~1.21.3'
cache-dependency-path: 'cmd/operator-opamp-bridge/go.sum'

# TODO: We're currently not using this. Should we?
- name: Read version
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish-target-allocator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- uses: actions/setup-go@v5
with:
go-version: '~1.21.3'
cache-dependency-path: 'cmd/otel-allocator/go.sum'

# TODO: We're currently not using this. Should we?
- name: Read version
Expand Down
13 changes: 2 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,11 @@ all: manager
.PHONY: ci
ci: test

# helper to get your gomod up-to-date
.PHONY: gomod
gomod:
go mod tidy && go mod vendor && (cd cmd/otel-allocator && go mod tidy) && (cd cmd/operator-opamp-bridge && go mod tidy)

# Run tests
# setup-envtest uses KUBEBUILDER_ASSETS which points to a directory with binaries (api-server, etcd and kubectl)
.PHONY: test
test: generate fmt vet ensure-generate-is-noop envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...
cd cmd/otel-allocator && KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...
cd cmd/operator-opamp-bridge && KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(KUBE_VERSION) -p path)" go test ${GOTEST_OPTS} ./...

# Build manager binary
.PHONY: manager
Expand All @@ -117,11 +110,11 @@ manager: generate fmt vet

# Build target allocator binary
targetallocator:
cd cmd/otel-allocator && CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH) go build -a -installsuffix cgo -o bin/targetallocator_${ARCH} -ldflags "${COMMON_LDFLAGS}" .
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH) go build -a -installsuffix cgo -o cmd/otel-allocator/bin/targetallocator_${ARCH} -ldflags "${COMMON_LDFLAGS}" ./cmd/otel-allocator

# Build opamp bridge binary
operator-opamp-bridge:
cd cmd/operator-opamp-bridge && CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH) go build -a -installsuffix cgo -o bin/opampbridge_${ARCH} -ldflags "${COMMON_LDFLAGS}" .
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(ARCH) go build -a -installsuffix cgo -o cmd/operator-opamp-bridge/bin/opampbridge_${ARCH} -ldflags "${COMMON_LDFLAGS}" ./cmd/operator-opamp-bridge

# Run against the configured Kubernetes cluster in ~/.kube/config
.PHONY: run
Expand Down Expand Up @@ -196,8 +189,6 @@ vet:
.PHONY: lint
lint: golangci-lint
$(GOLANGCI_LINT) run
cd cmd/otel-allocator && $(GOLANGCI_LINT) run
cd cmd/operator-opamp-bridge && $(GOLANGCI_LINT) run

# Generate code
.PHONY: generate
Expand Down
95 changes: 0 additions & 95 deletions cmd/operator-opamp-bridge/go.mod

This file was deleted.

Loading

0 comments on commit b50ddc3

Please sign in to comment.