Skip to content

Commit e6cf245

Browse files
committed
Merge branch 'main' of github.com:solarwinds/apm-ruby into NH-113148-docs
2 parents 1adc274 + cf80972 commit e6cf245

32 files changed

+136
-820
lines changed

.github/workflows/build_and_release_gem.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
id: rl-scan
116116
uses: reversinglabs/gh-action-rl-scanner-cloud-only@v1
117117
with:
118-
artifact-to-scan: ./solarwinds_apm-${{ steps.SOLARWINDS_APM_VERSION }}.gem
118+
artifact-to-scan: ./solarwinds_apm-${{ env.SOLARWINDS_APM_VERSION }}.gem
119119
rl-verbose: true
120120
rl-portal-server: solarwinds
121121
rl-portal-org: SolarWinds

.github/workflows/build_publish_lambda_layer.yml

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,7 @@ jobs:
3232
# build layer on arm64 and amd64, then upload to artifacts
3333
# act -j build_layer --container-architecture linux/arm64
3434
build_layer:
35-
strategy:
36-
matrix:
37-
arch:
38-
- x86_64
39-
- arm64
40-
41-
runs-on: ${{ matrix.arch == 'arm64' && fromJSON('{"group":"apm-arm-runner"}') || 'ubuntu-latest' }}
35+
runs-on: ubuntu-latest
4236

4337
steps:
4438
- uses: actions/checkout@v4
@@ -51,7 +45,6 @@ jobs:
5145
working-directory: lambda/
5246
env:
5347
GITHUB_RUBY_TOKEN: ${{ secrets.PACKAGE_GITHUB_TOKEN }}
54-
MATRIX_ARCH: ${{ matrix.arch }}
5548
SOLARWINDS_SOURCE: ${{ github.event.inputs.solarwinds-source }}
5649

5750
- name: Show directory contents
@@ -62,8 +55,8 @@ jobs:
6255
- name: Upload to artifact
6356
uses: actions/upload-artifact@v4
6457
with:
65-
name: ruby-layer-${{ matrix.arch }}.zip
66-
path: lambda/build/ruby-layer-${{ matrix.arch }}.zip
58+
name: ruby-layer.zip
59+
path: lambda/build/ruby-layer.zip
6760

6861
# extract the built layer from artifacts, then scan it with reverselab
6962
reverselab_scan_layer:
@@ -72,39 +65,35 @@ jobs:
7265
runs-on: ubuntu-latest
7366
strategy:
7467
fail-fast: false
75-
matrix:
76-
arch:
77-
- x86_64
78-
- arm64
7968

8069
steps:
8170
- uses: actions/checkout@v4
8271

8372
- name: extract layer zip from artifacts
8473
uses: actions/download-artifact@v4
8574
with:
86-
name: ruby-layer-${{ matrix.arch }}.zip
75+
name: ruby-layer.zip
8776
path: lambda
8877

8978
- name: extract current solarwinds_apm version
9079
run: |
9180
APM_VERSION=$(grep "gem 'solarwinds_apm'" lambda/otel/layer/Gemfile | awk -F"'" '{print $4}')
9281
echo "SOLARWINDS_APM_VERSION=$APM_VERSION" >> $GITHUB_ENV
9382
94-
- name: Scan build artifact on the Portal ${{ matrix.arch }}
83+
- name: Scan build artifact on the Portal
9584
id: rl-scan
9685

9786
env:
9887
RLPORTAL_ACCESS_TOKEN: ${{ secrets.REVERSE_LAB_TOKEN }}
9988

10089
uses: reversinglabs/gh-action-rl-scanner-cloud-only@v1
10190
with:
102-
artifact-to-scan: ./lambda/ruby-layer-${{ matrix.arch }}.zip
91+
artifact-to-scan: ./lambda/ruby-layer.zip
10392
rl-verbose: true
10493
rl-portal-server: solarwinds
10594
rl-portal-org: SolarWinds
10695
rl-portal-group: SaaS-Agents-SWO
107-
rl-package-url: solarwinds-apm-ruby/apm-ruby-lambda-layer-${{ matrix.arch }}@${{ env.SOLARWINDS_APM_VERSION }}
96+
rl-package-url: solarwinds-apm-ruby/apm-ruby-lambda-layer@${{ env.SOLARWINDS_APM_VERSION }}
10897

10998
- name: report the scan status
11099
if: success() || failure()
@@ -136,9 +125,7 @@ jobs:
136125
- us-east-2
137126
- us-west-1
138127
- us-west-2
139-
arch:
140-
- x86_64
141-
- arm64
128+
142129
steps:
143130
- uses: actions/checkout@v4
144131

@@ -151,7 +138,7 @@ jobs:
151138
- name: extract layer zip from artifacts
152139
uses: actions/download-artifact@v4
153140
with:
154-
name: ruby-layer-${{ matrix.arch }}.zip
141+
name: ruby-layer.zip
155142
path: lambda
156143

157144
- name: extract current solarwinds_apm version
@@ -164,18 +151,17 @@ jobs:
164151
run: |
165152
cd lambda/
166153
aws lambda publish-layer-version \
167-
--layer-name solarwinds-apm-ruby-${{ matrix.arch }}-${{ env.SOLARWINDS_APM_VERSION }} \
154+
--layer-name solarwinds-apm-ruby-${{ env.SOLARWINDS_APM_VERSION }} \
168155
--license-info "Apache 2.0" \
169-
--compatible-architectures ${{ matrix.arch }} \
170-
--compatible-runtimes ruby3.2 ruby3.3 \
171-
--zip-file fileb://ruby-layer-${{ matrix.arch }}.zip \
156+
--compatible-architectures x86_64 arm64 \
157+
--compatible-runtimes ruby3.2 ruby3.3 ruby3.4 \
158+
--zip-file fileb://ruby-layer.zip \
172159
--query 'LayerVersionArn' \
173-
--compatible-architectures ${{ matrix.arch }} \
174160
--output text
175161
176162
- name: grant permissions to public for the published layer
177163
run: |
178-
layer_name=solarwinds-apm-ruby-${{ matrix.arch }}-${{ env.SOLARWINDS_APM_VERSION }}
164+
layer_name=solarwinds-apm-ruby-${{ env.SOLARWINDS_APM_VERSION }}
179165
latest_version=$(aws lambda list-layer-versions --layer-name $layer_name | jq -r '.LayerVersions | max_by(.Version) | .Version')
180166
aws lambda add-layer-version-permission \
181167
--layer-name $layer_name \

.github/workflows/run_unit_tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ jobs:
2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
ruby: ['3.2.2','3.1.0','3.0.6','2.7.5']
24+
ruby: ['3.4.2', '3.3.2', '3.2.2','3.1.0']
2525
os: ['bullseye']
2626
include:
27+
- ruby: '3.4.2'
28+
os: 'alpine3.21'
29+
- ruby: '3.3.3'
30+
os: 'alpine3.20'
2731
- ruby: '3.2.2'
2832
os: 'alpine3.17'
2933
- ruby: '3.1.0'
3034
os: 'alpine3.15'
31-
- ruby: '3.0.6'
32-
os: 'alpine3.16'
33-
- ruby: '2.7.5'
34-
os: 'alpine3.15'
3535

3636
container:
3737
image: ruby:${{ matrix.ruby }}-${{ matrix.os }}

gemfiles/test_gems.gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ group :development, :test do
3535
gem 'simplecov-console'
3636
gem 'webmock' if RUBY_VERSION >= '2.0.0'
3737
gem 'grpc', '~> 1.71'
38+
gem 'base64' if RUBY_VERSION >= '3.4.0'
3839

3940
gem 'opentelemetry-sdk'
4041
gem 'opentelemetry-instrumentation-all'
@@ -45,7 +46,6 @@ group :development, :test do
4546
gem 'opentelemetry-test-helpers'
4647

4748
gem 'opentelemetry-resource-detector-azure'
48-
# aws resource detector requires ruby >= 3.1.0
4949
gem 'opentelemetry-resource-detector-aws' if RUBY_VERSION >= '3.1.0'
5050
gem 'opentelemetry-resource-detector-container'
5151
end

init.rb

Lines changed: 0 additions & 9 deletions
This file was deleted.

lambda/build.sh

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,18 @@ fi
1515

1616
mkdir -p build
1717

18-
docker build --no-cache \
19-
--build-arg BUNDLE_RUBYGEMS__PKG__GITHUB__COM=${GITHUB_RUBY_TOKEN} \
20-
--progress plain \
21-
-f otel/Dockerfile_3_2 \
22-
-t sw-lambda-ruby-layer-3-2 otel
18+
for ruby_version in 3.2 3.3 3.4; do
19+
docker build --no-cache \
20+
--build-arg RUBY_VERSION=${ruby_version} \
21+
--progress plain \
22+
-f otel/Dockerfile \
23+
-t sw-lambda-ruby-layer-${ruby_version} otel
2324

24-
docker run --rm -v "$(pwd)/build:/out" sw-lambda-ruby-layer-3-2
25-
26-
docker build --no-cache \
27-
--build-arg BUNDLE_RUBYGEMS__PKG__GITHUB__COM=${GITHUB_RUBY_TOKEN} \
28-
--progress plain \
29-
-f otel/Dockerfile_3_3 \
30-
-t sw-lambda-ruby-layer-3-3 otel
31-
32-
docker run --rm -v "$(pwd)/build:/out" sw-lambda-ruby-layer-3-3
33-
34-
docker build --no-cache \
35-
--build-arg BUNDLE_RUBYGEMS__PKG__GITHUB__COM=${GITHUB_RUBY_TOKEN} \
36-
--progress plain \
37-
-f otel/Dockerfile_3_4 \
38-
-t sw-lambda-ruby-layer-3-4 otel
39-
40-
docker run --rm -v "$(pwd)/build:/out" sw-lambda-ruby-layer-3-4
25+
docker run --rm -v "$(pwd)/build:/out" sw-lambda-ruby-layer-${ruby_version}
26+
done
4127

4228
cd build/
4329
mkdir solarwinds-apm && mkdir ruby && mkdir ruby/gems
4430
unzip -q gems-3.2.0.zip -d ruby/gems/ && unzip -q gems-3.3.0.zip -d ruby/gems/ && unzip -q gems-3.4.0.zip -d ruby/gems/
4531
cp ../otel/layer/otel_wrapper.rb . && cp ../otel/layer/wrapper solarwinds-apm/
46-
zip -qr ruby-layer-$MATRIX_ARCH.zip ruby/ solarwinds-apm/ otel_wrapper.rb
32+
zip -qr ruby-layer.zip ruby/ solarwinds-apm/ otel_wrapper.rb

lambda/otel/Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
ARG RUBY_VERSION
2+
FROM public.ecr.aws/sam/build-ruby${RUBY_VERSION}:latest
3+
4+
ARG RUBY_VERSION
5+
ENV RUBY_VERSION=${RUBY_VERSION}
6+
7+
RUN mkdir /build
8+
COPY . /build
9+
10+
WORKDIR /build/layer
11+
RUN bundle config set --local path 'ruby'
12+
13+
# Save gem filename if present
14+
RUN ls | grep solarwinds_apm-*.gem > gem_file.txt 2>/dev/null || true
15+
16+
# Install dependencies
17+
RUN bundle update
18+
19+
# Install wget
20+
RUN sh -c '(command -v dnf && dnf install -y wget) || (command -v yum && yum install -y wget)'
21+
22+
# Install aarch64 version of protobuf gem
23+
ENV ARCH=aarch64
24+
RUN PROTOBUF_VERSION=$(bundle exec ruby -e 'puts Gem.loaded_specs["google-protobuf"].version.to_s') && \
25+
wget "https://rubygems.org/downloads/google-protobuf-${PROTOBUF_VERSION}-${ARCH}-linux-gnu.gem" && \
26+
bundle exec gem install "google-protobuf-${PROTOBUF_VERSION}-${ARCH}-linux-gnu.gem"
27+
28+
# Install solarwinds_apm gem (from file, if exists; for local build only)
29+
RUN gem_file=$(cat gem_file.txt) && \
30+
if [ -f "$gem_file" ]; then \
31+
gem install $gem_file; \
32+
bundle exec gem uninstall solarwinds_apm; \
33+
mv /var/lang/lib/ruby/gems/${RUBY_VERSION}.0/gems/solarwinds_apm-*/ /build/layer/ruby/ruby/${RUBY_VERSION}.0/gems/; \
34+
mv /var/lang/lib/ruby/gems/${RUBY_VERSION}.0/specifications/solarwinds_apm-* /build/layer/ruby/ruby/${RUBY_VERSION}.0/specifications/; \
35+
fi
36+
37+
# Clean up cache and docs
38+
RUN rm -rf /build/layer/ruby/ruby/${RUBY_VERSION}.0/cache/* && \
39+
rm -rf /build/layer/ruby/ruby/${RUBY_VERSION}.0/doc/*
40+
41+
# Zip the layer
42+
WORKDIR /build/layer/ruby/ruby
43+
44+
RUN zip -qr gems-${RUBY_VERSION}.0.zip ${RUBY_VERSION}.0/
45+
46+
CMD cp /build/layer/ruby/ruby/gems-${RUBY_VERSION}.0.zip /out/gems-${RUBY_VERSION}.0.zip

lambda/otel/Dockerfile_3_2

Lines changed: 0 additions & 28 deletions
This file was deleted.

lambda/otel/Dockerfile_3_3

Lines changed: 0 additions & 28 deletions
This file was deleted.

lambda/otel/Dockerfile_3_4

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)