From cd9602c1c20937a9c8370e678765e135f77c598f Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Fri, 17 May 2024 23:27:45 -0400 Subject: [PATCH 1/2] Add ARM64 Support Signed-off-by: Daniel Mikusa --- .github/pipeline-descriptor.yml | 3 ++ .github/workflows/pb-tests.yml | 1 + .gitignore | 64 ++++++++------------------------- buildpack.toml | 24 ++++++++----- scripts/build.sh | 20 +++++++---- 5 files changed, 48 insertions(+), 64 deletions(-) diff --git a/.github/pipeline-descriptor.yml b/.github/pipeline-descriptor.yml index 5dbfc32..8e3f461 100644 --- a/.github/pipeline-descriptor.yml +++ b/.github/pipeline-descriptor.yml @@ -6,6 +6,9 @@ codeowners: - path: "*" owner: "@paketo-buildpacks/app-monitoring-maintainers" +helpers: + "bin/helper": "$GOMOD/cmd/helper" + package: repositories: ["docker.io/paketobuildpacks/opentelemetry","gcr.io/paketo-buildpacks/opentelemetry"] register: true diff --git a/.github/workflows/pb-tests.yml b/.github/workflows/pb-tests.yml index d0a9087..4fe4d4d 100644 --- a/.github/workflows/pb-tests.yml +++ b/.github/workflows/pb-tests.yml @@ -178,6 +178,7 @@ jobs: env: FORMAT: image PACKAGES: test + TTL_SH_PUBLISH: "false" VERSION: ${{ steps.version.outputs.version }} unit: name: Unit Test diff --git a/.gitignore b/.gitignore index 2a5a1d0..2f65ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,54 +1,20 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ +# Copyright 2018-2020 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. bin/ +linux/ dependencies/ package/ +scratch/ -.vscode/ - -############# -### macOS ### -############# - -# General -.DS_Store -*.DS_Store -**/.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/buildpack.toml b/buildpack.toml index 007fd42..472101c 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,3 +1,17 @@ +# Copyright 2018-2024 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + api = "0.7" [buildpack] @@ -14,7 +28,7 @@ api = "0.7" uri = "https://github.com/paketo-buildpacks/opentelemetry/blob/main/LICENSE" [metadata] - include-files = ["LICENSE", "NOTICE", "README.md", "bin/build", "bin/detect", "bin/main", "bin/helper", "buildpack.toml"] + include-files = ["LICENSE", "NOTICE", "README.md", "linux/amd64/bin/build", "linux/amd64/bin/detect", "linux/amd64/bin/main", "linux/amd64/bin/helper", "linux/arm64/bin/build", "linux/arm64/bin/detect", "linux/arm64/bin/main", "linux/arm64/bin/helper", "buildpack.toml"] pre-package = "scripts/build.sh" [[metadata.configurations]] @@ -31,7 +45,7 @@ api = "0.7" sha256 = "2a2af4c5e57de5e6f688b9921df5dda5cda4eda9626ee5f34ddc5852f84c45d0" source = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/archive/refs/tags/v1.32.0.tar.gz" source-sha256 = "aee96dfc00b58847d247ee38e221c637ca2d69f3b7644f7c06b6b6fb275f86c2" - stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] + stacks = ["*"] uri = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.32.0/opentelemetry-javaagent.jar" version = "1.32.0" @@ -39,11 +53,5 @@ api = "0.7" type = "Apache-2.0" uri = "https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/LICENSE" -[[stacks]] - id = "io.buildpacks.stacks.bionic" - -[[stacks]] - id = "io.paketo.stacks.tiny" - [[stacks]] id = "*" diff --git a/scripts/build.sh b/scripts/build.sh index 3bcac54..9b05e98 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,17 +1,23 @@ #!/usr/bin/env bash - set -euo pipefail -GOOS="linux" go build -ldflags='-s -w' -o bin/helper github.com/paketo-buildpacks/opentelemetry/cmd/helper -GOOS="linux" go build -ldflags='-s -w' -o bin/main github.com/paketo-buildpacks/opentelemetry/cmd/main +GOMOD=$(head -1 go.mod | awk '{print $2}') +GOOS="linux" GOARCH="amd64" go build -ldflags='-s -w' -o "linux/amd64/bin/helper" "$GOMOD/cmd/helper" +GOOS="linux" GOARCH="arm64" go build -ldflags='-s -w' -o "linux/arm64/bin/helper" "$GOMOD/cmd/helper" +GOOS="linux" GOARCH="amd64" go build -ldflags='-s -w' -o linux/amd64/bin/main "$GOMOD/cmd/main" +GOOS="linux" GOARCH="arm64" go build -ldflags='-s -w' -o linux/arm64/bin/main "$GOMOD/cmd/main" if [ "${STRIP:-false}" != "false" ]; then - strip bin/helper bin/main + strip linux/amd64/bin/helper linux/arm64/bin/helper + strip linux/amd64/bin/main linux/arm64/bin/main fi if [ "${COMPRESS:-none}" != "none" ]; then - $COMPRESS bin/helper bin/main + $COMPRESS linux/amd64/bin/helper linux/arm64/bin/helper + $COMPRESS linux/amd64/bin/main linux/arm64/bin/main fi -ln -fs main bin/build -ln -fs main bin/detect +ln -fs main linux/amd64/bin/build +ln -fs main linux/arm64/bin/build +ln -fs main linux/amd64/bin/detect +ln -fs main linux/arm64/bin/detect \ No newline at end of file From f94b22d69e7db59bd47fcc7587a43fdbda7367ce Mon Sep 17 00:00:00 2001 From: Daniel Mikusa Date: Fri, 17 May 2024 23:32:49 -0400 Subject: [PATCH 2/2] Forgot to add targets Signed-off-by: Daniel Mikusa --- buildpack.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/buildpack.toml b/buildpack.toml index 472101c..04bb785 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -55,3 +55,11 @@ api = "0.7" [[stacks]] id = "*" + +[[targets]] + arch = "amd64" + os = "linux" + +[[targets]] + arch = "arm64" + os = "linux"