Skip to content

Commit a1ff0f4

Browse files
authored
feat: adding support to ruby 3.4 runtime (#332)
1 parent e4ef196 commit a1ff0f4

File tree

5 files changed

+88
-4
lines changed

5 files changed

+88
-4
lines changed

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,22 @@ publish-ruby33-local: build-ruby33
168168
-e AWS_PROFILE \
169169
-v "${HOME}/.aws:/home/newrelic-lambda-layers/.aws" \
170170
newrelic-lambda-layers-ruby33
171+
172+
build-ruby34:
173+
docker build \
174+
--no-cache \
175+
-t newrelic-lambda-layers-ruby34 \
176+
-f ./dockerfiles/Dockerfile.ruby34 \
177+
.
178+
179+
publish-ruby34-ci: build-ruby34
180+
docker run \
181+
-e AWS_ACCESS_KEY_ID \
182+
-e AWS_SECRET_ACCESS_KEY \
183+
newrelic-lambda-layers-ruby34
184+
185+
publish-ruby34-local: build-ruby34
186+
docker run \
187+
-e AWS_PROFILE \
188+
-v "${HOME}/.aws:/home/newrelic-lambda-layers/.aws" \
189+
newrelic-lambda-layers-ruby34

dockerfiles/Dockerfile.ruby34

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM ruby:3.4
2+
3+
RUN apt update
4+
5+
# curl - downloads the prebuilt NR Lambda extension
6+
# python3/pip3 - for the AWS CLI
7+
# zip/unzip - for building AWS Lambda layers .zip files
8+
RUN apt install -y curl python3 python3-pip unzip zip
9+
10+
RUN useradd -m newrelic-lambda-layers
11+
USER newrelic-lambda-layers
12+
WORKDIR /home/newrelic-lambda-layers
13+
RUN pip3 install -U awscli --user --no-cache-dir --break-system-packages
14+
ENV PATH /home/newrelic-lambda-layers/.local/bin/:$PATH
15+
16+
# Ruby layer building depends on the shared `libBuild.sh` script but is
17+
# otherwise independent. Copy over only what we need to build Ruby layers.
18+
COPY --chown=newrelic-lambda-layers libBuild.sh .
19+
COPY --chown=newrelic-lambda-layers ruby ruby/
20+
21+
WORKDIR ruby
22+
23+
# Run ruby/bin/clean just in case Docker is being ran from a developer's
24+
# workstation and their git clone directory has some stray files that could
25+
# conflict.
26+
RUN ./bin/clean
27+
28+
CMD ./publish-layers.sh ruby3.4

libBuild.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ function layer_name_str() {
137137
"ruby3.3")
138138
rt_part="Ruby33"
139139
;;
140+
"ruby3.4")
141+
rt_part="Ruby34"
142+
;;
140143
"dotnet")
141144
rt_part="Dotnet"
142145
;;
@@ -197,6 +200,9 @@ function s3_prefix() {
197200
"ruby3.3")
198201
name="nr-ruby3.3"
199202
;;
203+
"ruby3.4")
204+
name="nr-ruby3.4"
205+
;;
200206
"dotnet")
201207
name="nr-dotnet"
202208
;;
@@ -216,7 +222,7 @@ function agent_name_str() {
216222
"nodejs18.x"|"nodejs20.x"|"nodejs22.x")
217223
agent_name="Node"
218224
;;
219-
"ruby3.2"|"ruby3.3")
225+
"ruby3.2"|"ruby3.3"|"ruby3.4")
220226
agent_name="Ruby"
221227
;;
222228
"java8.al2"|"java11"|"java17"|"java21")

ruby/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,18 @@ A layer is created for every region, architecture, and Ruby runtime combination.
1616

1717
## Layer building and publishing
1818

19-
With Ruby v3.2 or v3.3 `bundle` binary in your path:
19+
With Ruby v3.2 or v3.3 or v3.4 `bundle` binary in your path:
2020

2121
```shell
2222
./publish_layers.sh ruby3.2
2323

2424
# or
2525

2626
./publish_layers.sh ruby3.3
27+
28+
# or
29+
30+
./publish_layers.sh ruby3.4
2731
```
2832

2933

ruby/publish-layers.sh

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ EXTENSION_CLONE_PATH=''
2626
# Distribution paths for ARM64
2727
RB32_DIST_ARM64=$DIST_DIR/ruby32.arm64.zip
2828
RB33_DIST_ARM64=$DIST_DIR/ruby33.arm64.zip
29+
RB34_DIST_ARM64=$DIST_DIR/ruby34.arm64.zip
2930

3031
# Distribution paths for X86_64
3132
RB32_DIST_X86_64=$DIST_DIR/ruby32.x86_64.zip
32-
RB33_DIST_X86_64=$DIST_DIR/ruby33.x86_64.zip
33+
RB33_DIST_X86_64=$DIST_DIR/ruby33.x86_64.zip
34+
RB34_DIST_X86_64=$DIST_DIR/ruby34.x86_64.zip
3335

3436
source ../libBuild.sh
3537

3638
function usage {
37-
echo "./publish-layers.sh [ruby3.2|ruby3.3]"
39+
echo "./publish-layers.sh [ruby3.2|ruby3.3|ruby3.4]"
3840
}
3941

4042
function build-ruby32-arm64 {
@@ -45,6 +47,11 @@ function build-ruby33-arm64 {
4547
build_ruby_for_arch 3.3 'arm64' $RB33_DIST_ARM64
4648
}
4749

50+
function build-ruby34-arm64 {
51+
build_ruby_for_arch 3.4 'arm64' $RB34_DIST_ARM64
52+
}
53+
54+
4855
function build-ruby32-x86 {
4956
build_ruby_for_arch 3.2 'x86_64' $RB32_DIST_X86_64
5057
}
@@ -53,6 +60,10 @@ function build-ruby33-x86 {
5360
build_ruby_for_arch 3.3 'x86_64' $RB33_DIST_X86_64
5461
}
5562

63+
function build-ruby34-x86 {
64+
build_ruby_for_arch 3.4 'x86_64' $RB34_DIST_X86_64
65+
}
66+
5667
function publish-ruby32-arm64 {
5768
publish_ruby_for_arch 3.2 'arm64' $RB32_DIST_ARM64
5869
}
@@ -61,6 +72,10 @@ function publish-ruby33-arm64 {
6172
publish_ruby_for_arch 3.3 'arm64' $RB33_DIST_ARM64
6273
}
6374

75+
function publish-ruby34-arm64 {
76+
publish_ruby_for_arch 3.4 'arm64' $RB34_DIST_ARM64
77+
}
78+
6479
function publish-ruby32-x86 {
6580
publish_ruby_for_arch 3.2 'x86_64' $RB32_DIST_X86_64
6681
}
@@ -69,6 +84,10 @@ function publish-ruby33-x86 {
6984
publish_ruby_for_arch 3.3 'x86_64' $RB33_DIST_X86_64
7085
}
7186

87+
function publish-ruby34-x86 {
88+
publish_ruby_for_arch 3.4 'x86_64' $RB34_DIST_X86_64
89+
}
90+
7291
function build_ruby_for_arch {
7392
local ruby_version=$1
7493
local arch=$2
@@ -153,6 +172,14 @@ function publish_ruby_for_arch {
153172

154173
set +u # permit $1 to be unbound so that '*' matches it when no args are present
155174
case "$1" in
175+
"ruby3.4")
176+
build-ruby34-arm64
177+
publish-ruby34-arm64
178+
publish_docker_ecr $RB34_DIST_ARM64 ruby3.4 arm64
179+
build-ruby34-x86
180+
publish-ruby34-x86
181+
publish_docker_ecr $RB34_DIST_X86_64 ruby3.4 x86_64
182+
;;
156183
"ruby3.3")
157184
build-ruby33-arm64
158185
publish-ruby33-arm64

0 commit comments

Comments
 (0)