diff --git a/.github/actions/build-layer/action.yml b/.github/actions/build-layer/action.yml index 34806538cc..7de82593c8 100644 --- a/.github/actions/build-layer/action.yml +++ b/.github/actions/build-layer/action.yml @@ -5,6 +5,10 @@ inputs: language: description: 'Language of the layer to build (nodejs, python, ruby, javaagent, javawrapper)' required: true + architecture: + description: 'Target architecture (amd64 or arm64). Only used for ruby.' + required: false + default: amd64 outputs: artifact-path: @@ -28,6 +32,8 @@ runs: - if: ${{ inputs.language == 'ruby' }} id: ruby uses: ./.github/actions/build-ruby-layer + with: + architecture: ${{ inputs.architecture }} - if: ${{ inputs.language == 'javaagent' || inputs.language == 'javawrapper' }} id: java diff --git a/.github/actions/build-ruby-layer/action.yml b/.github/actions/build-ruby-layer/action.yml index 0fc7f4597f..0d7376671d 100644 --- a/.github/actions/build-ruby-layer/action.yml +++ b/.github/actions/build-ruby-layer/action.yml @@ -1,10 +1,16 @@ name: 'Build Ruby Lambda Layer' description: 'Builds the OpenTelemetry Ruby Lambda layer' +inputs: + architecture: + description: 'Target architecture (amd64 or arm64)' + required: false + default: amd64 + outputs: artifact-path: description: 'Absolute path to the layer zip artifact' - value: ${{ github.workspace }}/ruby/src/build/opentelemetry-ruby-layer.zip + value: ${{ github.workspace }}/ruby/src/build/opentelemetry-ruby-layer-${{ inputs.architecture }}.zip component-version: description: 'OpenTelemetry Ruby SDK version included in the layer' value: ${{ steps.version.outputs.component-version }} @@ -15,14 +21,17 @@ runs: - name: Build Ruby layer shell: bash working-directory: ruby/src + env: + ARCH: ${{ inputs.architecture }} run: ./build.sh - name: Save Ruby OpenTelemetry SDK version + if: ${{ inputs.architecture == 'amd64' }} id: version shell: bash working-directory: ruby/src run: | - unzip -q build/opentelemetry-ruby-layer.zip + unzip -q build/opentelemetry-ruby-layer-amd64.zip export GEM_PATH=$PWD/ruby/gems/3.3.0/ SDK_VERSION=$(ruby -e 'require "opentelemetry-sdk"; puts OpenTelemetry::SDK::VERSION') echo "component-version=$SDK_VERSION" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4d3aebb93e..1d12fc7207 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -66,20 +66,34 @@ jobs: build-layer: needs: prepare-languages if: ${{ !inputs.use-existing-layer-artifact }} - runs-on: ubuntu-latest + runs-on: ${{ matrix.architecture == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} strategy: fail-fast: false matrix: language: ${{ fromJson(needs.prepare-languages.outputs.languages) }} + architecture: [amd64, arm64] + exclude: + - language: nodejs + architecture: arm64 + - language: python + architecture: arm64 + - language: javaagent + architecture: arm64 + - language: javawrapper + architecture: arm64 steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - uses: ./.github/actions/build-layer id: build with: language: ${{ matrix.language }} + architecture: ${{ matrix.architecture }} - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: - name: opentelemetry-${{ matrix.language }}-layer.zip + name: >- + ${{ matrix.language == 'ruby' + && format('opentelemetry-ruby-layer-{0}.zip', matrix.architecture) + || format('opentelemetry-{0}-layer.zip', matrix.language) }} path: ${{ steps.build.outputs.artifact-path }} test: @@ -111,7 +125,10 @@ jobs: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: - name: opentelemetry-${{ matrix.language }}-layer.zip + name: >- + ${{ matrix.language == 'ruby' + && format('opentelemetry-ruby-layer-{0}.zip', matrix.architecture) + || format('opentelemetry-{0}-layer.zip', matrix.language) }} path: artifacts/ - uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0 @@ -148,6 +165,9 @@ jobs: TEST_LANGUAGE: ${{ matrix.language }} TEST_ARCHITECTURE: ${{ matrix.architecture }} COLLECTOR_LAYER_ZIP: ${{ github.workspace }}/artifacts/opentelemetry-collector-layer-${{ matrix.architecture }}.zip - INSTRUMENTATION_LAYER_ZIP: ${{ github.workspace }}/artifacts/opentelemetry-${{ matrix.language }}-layer.zip + INSTRUMENTATION_LAYER_ZIP: >- + ${{ matrix.language == 'ruby' + && format('{0}/artifacts/opentelemetry-ruby-layer-{1}.zip', github.workspace, matrix.architecture) + || format('{0}/artifacts/opentelemetry-{1}-layer.zip', github.workspace, matrix.language) }} GITHUB_RUN_ID: ${{ github.run_id }} GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }} diff --git a/.github/workflows/release-layer-ruby.yml b/.github/workflows/release-layer-ruby.yml index c1be779f58..0eae4979c8 100644 --- a/.github/workflows/release-layer-ruby.yml +++ b/.github/workflows/release-layer-ruby.yml @@ -11,7 +11,13 @@ permissions: jobs: build-layer: - runs-on: ubuntu-latest + runs-on: ${{ matrix.architecture == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} + strategy: + fail-fast: false + matrix: + architecture: + - amd64 + - arm64 outputs: component-version: ${{ steps.build.outputs.component-version }} steps: @@ -19,11 +25,13 @@ jobs: - uses: ./.github/actions/build-ruby-layer id: build + with: + architecture: ${{ matrix.architecture }} - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 name: Save assembled layer to build with: - name: opentelemetry-ruby-layer.zip + name: opentelemetry-ruby-layer-${{ matrix.architecture }}.zip path: ${{ steps.build.outputs.artifact-path }} integration-test: @@ -52,21 +60,30 @@ jobs: - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: - name: opentelemetry-ruby-layer.zip + name: opentelemetry-ruby-layer-amd64.zip - - name: Add Binary to Release - run: gh release upload ${{ github.ref_name }} opentelemetry-ruby-layer.zip + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: opentelemetry-ruby-layer-arm64.zip + + - name: Add Binaries to Release + run: | + gh release upload ${{ github.ref_name }} opentelemetry-ruby-layer-amd64.zip + gh release upload ${{ github.ref_name }} opentelemetry-ruby-layer-arm64.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish-layer: - permissions: # required by the reusable workflow + permissions: contents: read id-token: write uses: ./.github/workflows/layer-publish.yml needs: [build-layer, create-release] strategy: matrix: + architecture: + - amd64 + - arm64 aws_region: - af-south-1 - ap-east-1 @@ -103,9 +120,10 @@ jobs: - us-west-1 - us-west-2 with: - artifact-name: opentelemetry-ruby-layer.zip + artifact-name: opentelemetry-ruby-layer-${{ matrix.architecture }}.zip layer-name: opentelemetry-ruby component-version: ${{ needs.build-layer.outputs.component-version }} + architecture: ${{ matrix.architecture }} runtimes: ruby3.3 ruby3.4 release-group: prod aws_region: ${{ matrix.aws_region }} diff --git a/ruby/src/build.sh b/ruby/src/build.sh index 01503ee944..672cc150ed 100755 --- a/ruby/src/build.sh +++ b/ruby/src/build.sh @@ -1,7 +1,16 @@ #!/bin/sh set -e +ARCH=${ARCH:-amd64} +PLATFORM="linux/${ARCH}" + mkdir -p build -docker build --progress plain -t aws-otel-lambda-ruby-layer otel -docker run --rm -v "$(pwd)/build:/out" aws-otel-lambda-ruby-layer +docker build --progress plain --platform "$PLATFORM" \ + -t "aws-otel-lambda-ruby-layer-${ARCH}" otel + +docker run --rm --platform "$PLATFORM" \ + -v "$(pwd)/build:/out" \ + "aws-otel-lambda-ruby-layer-${ARCH}" + +mv build/opentelemetry-ruby-layer.zip "build/opentelemetry-ruby-layer-${ARCH}.zip"