-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[autoinstrumentation] remove dependency on busybox, use native cp
- Loading branch information
Showing
21 changed files
with
331 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: enhancement | ||
|
||
# The name of the component, or a single word describing the area of concern, (e.g. collector, target allocator, auto-instrumentation, opamp, github action) | ||
component: autoinstrumentation | ||
|
||
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). | ||
note: Implement native cp, remove dependency on busybox for all autoinstrumentation images | ||
|
||
# One or more tracking issues related to the change | ||
issues: [1600] | ||
|
||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: "Publish cp Auto-Instrumentation" | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'autoinstrumentation/cp/**' | ||
- '.github/workflows/publish-autoinstrumentation-cp.yaml' | ||
branches: | ||
- main | ||
pull_request: | ||
paths: | ||
- 'autoinstrumentation/cp/**' | ||
- '.github/workflows/publish-autoinstrumentation-cp.yaml' | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-22.04 | ||
services: | ||
# Start a local registry for pushing the multiarch manifest and images | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Read version | ||
run: echo "VERSION=$(cat autoinstrumentation/cp/version.txt)" >> $GITHUB_ENV | ||
|
||
- uses: docker/setup-buildx-action@v3 | ||
id: multiarch-otelcol-builder | ||
with: | ||
driver: docker-container # Create a builder with the docker-container driver required for multiarch builds | ||
driver-opts: network=host # Required for the builder to push to the local registry service | ||
|
||
- name: Login to GitHub Package Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create docker image | ||
run: | | ||
cd autoinstrumentation/cp | ||
VERSION=${{ env.VERSION }} REPOSITORY=localhost:5000 make docker | ||
- name: Push | ||
run: | | ||
docker tag localhost:5000/cp:${{ env.VERSION }} ghcr.io/open-telemetry/opentelemetry-operator/cp:${{ env.VERSION }} | ||
docker tag localhost:5000/cp:${{ env.VERSION }}-fips ghcr.io/open-telemetry/opentelemetry-operator/cp:${{ env.VERSION }}-fips | ||
docker push ghcr.io/open-telemetry/opentelemetry-operator/cp:${{ env.VERSION }} | ||
docker push ghcr.io/open-telemetry/opentelemetry-operator/cp:${{ env.VERSION }}-fips |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,3 +44,4 @@ config/rbac/certmanager-permissions/ | |
build | ||
node_modules | ||
package-lock.json | ||
autoinstrumentation/cp/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM scratch | ||
|
||
ARG cp | ||
|
||
ADD $cp /cp | ||
|
||
ENTRYPOINT ["/cp"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM scratch | ||
|
||
LABEL fips=true | ||
|
||
ARG cp | ||
|
||
ADD $cp /cp | ||
|
||
ENTRYPOINT ["/cp"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM scratch | ||
|
||
ARG cp | ||
|
||
ADD $cp /cp.exe | ||
|
||
ENTRYPOINT ["/cp.exe"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
VERSION?=latest | ||
REPOSITORY?=ghcr.io/open-telemetry/opentelemetry-operator | ||
GO_BUILD_LDFLAGS ?= '-w -s -extldflags "-static"' | ||
|
||
.PHONY := build | ||
build: | ||
mkdir -p bin | ||
CGO_ENABLED=0 go build -trimpath -o ./bin/cp_$(GOOS)_$(GOARCH)$(EXTRA)$(EXTENSION) -ldflags $(GO_BUILD_LDFLAGS) | ||
|
||
bin/cp_linux_amd64: main.go go.mod | ||
GOOS=linux GOARCH=amd64 EXTENSION="" EXTRA="" make build | ||
|
||
bin/cp_linux_arm64: main.go go.mod | ||
GOOS=linux GOARCH=arm64 EXTENSION="" EXTRA="" make build | ||
|
||
bin/cp_linux_ppc64le: main.go go.mod | ||
GOOS=linux GOARCH=ppc64le EXTENSION="" EXTRA="" make build | ||
|
||
bin/cp_linux_s390x: main.go go.mod | ||
GOOS=linux GOARCH=s390x EXTENSION="" EXTRA="" make build | ||
|
||
bin/cp_windows_arm64.exe: main.go go.mod | ||
GOOS=windows GOARCH=arm64 EXTENSION=".exe" EXTRA="" make build | ||
|
||
bin/cp_windows_amd64.exe: main.go go.mod | ||
GOOS=windows GOARCH=amd64 EXTENSION=".exe" EXTRA="" make build | ||
|
||
bin/cp_linux_amd64_fips: main.go go.mod | ||
GOEXPERIMENT=boringcrypto GOOS=linux GOARCH=amd64 EXTENSION="" EXTRA="_fips" make build | ||
|
||
bin/cp_linux_arm64_fips: main.go go.mod | ||
GOEXPERIMENT=boringcrypto GOOS=linux GOARCH=arm64 EXTENSION="" EXTRA="_fips" make build | ||
|
||
bin/cp_windows_arm64_fips.exe: main.go go.mod | ||
GOEXPERIMENT=boringcrypto GOOS=windows GOARCH=arm64 EXTENSION=".exe" EXTRA="_fips" make build | ||
|
||
bin/cp_windows_amd64_fips.exe: main.go go.mod | ||
GOEXPERIMENT=boringcrypto GOOS=windows GOARCH=amd64 EXTENSION=".exe" EXTRA="_fips" make build | ||
|
||
## Docker build | ||
|
||
.PHONY := docker_linux_amd64 | ||
docker_linux_amd64: bin/cp_linux_amd64 | ||
docker buildx build --platform="linux/amd64" --push -t $(REPOSITORY)/cp_linux_amd64:$(VERSION) --build-arg cp=bin/cp_linux_amd64 . | ||
|
||
.PHONY := docker_linux_arm64 | ||
docker_linux_arm64: bin/cp_linux_arm64 | ||
docker buildx build --platform="linux/arm64" --push -t $(REPOSITORY)/cp_linux_arm64:$(VERSION) --build-arg cp=bin/cp_linux_arm64 . | ||
|
||
.PHONY := docker_linux_ppc64le | ||
docker_linux_ppc64le: bin/cp_linux_ppc64le | ||
docker buildx build --platform="linux/ppc64le" --push -t $(REPOSITORY)/cp_linux_ppc64le:$(VERSION) --build-arg cp=bin/cp_linux_ppc64le . | ||
|
||
.PHONY := docker_linux_s390x | ||
docker_linux_s390x: bin/cp_linux_s390x | ||
docker buildx build --platform="linux/s390x" --push -t $(REPOSITORY)/cp_linux_s390x:$(VERSION) --build-arg cp=bin/cp_linux_s390x . | ||
|
||
.PHONY := docker_windows_arm64 | ||
docker_windows_arm64: bin/cp_windows_arm64.exe | ||
docker buildx build --platform="windows/arm64" --push -f Dockerfile.windows -t $(REPOSITORY)/cp_windows_arm64:$(VERSION) --build-arg cp=bin/cp_windows_arm64.exe . | ||
|
||
.PHONY := docker_windows_amd64 | ||
docker_windows_amd64: bin/cp_windows_amd64.exe | ||
docker buildx build --platform="windows/amd64" --push -f Dockerfile.windows -t $(REPOSITORY)/cp_windows_amd64:$(VERSION) --build-arg cp=bin/cp_windows_amd64.exe . | ||
|
||
.PHONY := docker_linux_amd64_fips | ||
docker_linux_amd64_fips: bin/cp_linux_amd64_fips | ||
docker buildx build --platform="linux/amd64" --push -t $(REPOSITORY)/cp_linux_amd64_fips:$(VERSION) --build-arg cp=bin/cp_linux_amd64_fips . | ||
|
||
.PHONY := docker_linux_arm64_fips | ||
docker_linux_arm64_fips: bin/cp_linux_arm64_fips | ||
docker buildx build --platform="linux/arm64" --push -t $(REPOSITORY)/cp_linux_arm64_fips:$(VERSION) --build-arg cp=bin/cp_linux_arm64_fips . | ||
|
||
.PHONY := docker_windows_amd64_fips | ||
docker_windows_amd64_fips: bin/cp_windows_amd64_fips.exe | ||
docker buildx build --platform="windows/amd64" --push -f Dockerfile.windows -t $(REPOSITORY)/cp_windows_amd64_fips:$(VERSION) --build-arg cp=bin/cp_windows_amd64_fips.exe . | ||
|
||
.PHONY := docker_windows_arm64_fips | ||
docker_windows_arm64_fips: bin/cp_windows_arm64_fips.exe | ||
docker buildx build --platform="windows/arm64" --push -f Dockerfile.windows -t $(REPOSITORY)/cp_windows_arm64_fips:$(VERSION) --build-arg cp=bin/cp_windows_arm64_fips.exe . | ||
|
||
.PHONY := docker | ||
docker: docker_linux_amd64 docker_linux_arm64 docker_linux_ppc64le docker_linux_s390x docker_windows_amd64 docker_windows_arm64 docker_linux_amd64_fips docker_linux_arm64_fips docker_windows_amd64_fips docker_windows_arm64_fips | ||
docker buildx imagetools create -t $(REPOSITORY)/cp:$(VERSION) \ | ||
$(REPOSITORY)/cp_linux_amd64:$(VERSION) \ | ||
$(REPOSITORY)/cp_linux_arm64:$(VERSION) \ | ||
$(REPOSITORY)/cp_linux_ppc64le:$(VERSION) \ | ||
$(REPOSITORY)/cp_linux_s390x:$(VERSION) \ | ||
$(REPOSITORY)/cp_windows_amd64:$(VERSION) \ | ||
$(REPOSITORY)/cp_windows_arm64:$(VERSION) | ||
|
||
docker buildx imagetools create \ | ||
-t $(REPOSITORY)/cp:$(VERSION)-fips \ | ||
$(REPOSITORY)/cp_linux_amd64_fips:$(VERSION) \ | ||
$(REPOSITORY)/cp_linux_arm64_fips:$(VERSION) \ | ||
$(REPOSITORY)/cp_windows_amd64_fips:$(VERSION) \ | ||
$(REPOSITORY)/cp_windows_arm64_fips:$(VERSION) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# cp | ||
|
||
This project allows you to take a file and copy to a new location on disk with the 0400 permission mask (read-only). | ||
|
||
# Install | ||
|
||
## As binary | ||
|
||
```bash | ||
go install github.com/otel-warez/cp@latest | ||
``` | ||
|
||
## As a docker image | ||
|
||
``` | ||
docker pull ghcr.io/otel-warez/cp:latest | ||
``` | ||
|
||
This image is built from scratch and will not be useful on its own, but you can use it as a layer. Here is an example: | ||
|
||
``` | ||
FROM ghcr.io/otel-warez/cp:latest AS cp | ||
FROM scratch AS final | ||
COPY --from=cp /cp /usr/bin/cp | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/otel-warez/cp | ||
|
||
go 1.23.0 |
Oops, something went wrong.