2
2
3
3
set -Eeuo pipefail
4
4
5
- # This script creates an AWS Lambda Ruby layer .zip file for each supported
6
- # architecture. The Ruby content does not change between architectures, but
7
- # the included Go based AWS Lambda extension does. The .zip files are written
8
- # to dist/ and from there they are uploaded to AWS via ../libBuild.sh
9
- # functionality.
5
+ # This script creates and publishes an AWS Lambda Ruby layer .zip file for each
6
+ # supported architecture. The Ruby content does not change between
7
+ # architectures or targeted Ruby versions, but the included Go based AWS Lambda
8
+ # extension does. The .zip files are written to dist/ and from there they are
9
+ # uploaded to AWS via functionality defined in the ../libBuild.sh script .
10
10
#
11
11
# Each .zip file is structured like so for Ruby:
12
12
# ruby/gems/<RUBY MAJOR><RUBY MINOR>.0 -- AWS sets this as GEM_PATH. It's where the agent lives
@@ -23,26 +23,61 @@ WRAPPER_FILE=newrelic_lambda_wrapper.rb
23
23
# EXTENSION_CLONE_PATH='../../newrelic-lambda-extension_fallwith'
24
24
EXTENSION_CLONE_PATH=' '
25
25
26
+ # Distribution paths for ARM64
27
+ RB32_DIST_ARM64=$DIST_DIR /ruby32.arm64.zip
28
+ RB33_DIST_ARM64=$DIST_DIR /ruby33.arm64.zip
29
+
30
+ # Distribution paths for X86_64
31
+ RB32_DIST_X64_64=$DIST_DIR /ruby32.x86_64.zip
32
+ RB33_DIST_X64_64=$DIST_DIR /ruby33.x86_64.zip
33
+
26
34
source ../libBuild.sh
27
35
28
36
function usage {
29
37
echo " ./publish-layers.sh [ruby3.2|ruby3.3]"
30
38
}
31
39
32
- function build_and_publish_ruby {
33
- local ruby_version=$1
34
- build_and_publish_ruby_for_arch $ruby_version ' x86_64'
35
- build_and_publish_ruby_for_arch $ruby_version ' arm64'
40
+ function build-ruby32-arm64 {
41
+ build_ruby_for_arch 3.2 ' arm64' $RB32_DIST_ARM64
42
+ }
43
+
44
+ function build-ruby33-arm64 {
45
+ build_ruby_for_arch 3.3 ' arm64' $RB33_DIST_ARM64
46
+ }
47
+
48
+ function build-ruby32-x86 {
49
+ build_ruby_for_arch 3.2 ' x86_64' $RB32_DIST_X64_64
50
+ }
51
+
52
+ function build-ruby33-x86 {
53
+ build_ruby_for_arch 3.3 ' x86_64' $RB33_DIST_X86_64
54
+ }
55
+
56
+ function publish-ruby32-arm64 {
57
+ publish_ruby_for_arch 3.2 ' arm64' $RB32_DIST_ARM64
36
58
}
37
59
38
- function build_and_publish_ruby_for_arch {
60
+ function publish-ruby33-arm64 {
61
+ publush_ruby_for_arch 3.3 ' arm64' $RB33_DIST_ARM64
62
+ }
63
+
64
+ function publish-ruby32-x86 {
65
+ publish_ruby_for_arch 3.2 ' x86_64' $RB32_DIST_X86_64
66
+ }
67
+
68
+ function publish-ruby33-x86 {
69
+ publish_ruby_for_arch 3.3 ' x86_64' $RB33_DIST_X86_64
70
+ }
71
+
72
+ function build_ruby_for_arch {
39
73
local ruby_version=$1
40
74
local arch=$2
75
+ # dynamic filenames are harder to grab for other consumers of this script
76
+ # local dist_file="$DIST_DIR/ruby${ruby_version//./}.$arch.zip"
77
+ local dist_file=$3
41
78
42
79
echo " Building New Relic layer for ruby v$ruby_version ($arch )"
43
80
44
- local dist_file=" $DIST_DIR /ruby${ruby_version// ./ } .$arch .zip"
45
-
46
81
rm -rf $RUBY_DIR $dist_file
47
82
mkdir -p $DIST_DIR
48
83
@@ -102,6 +137,12 @@ function build_and_publish_ruby_for_arch {
102
137
zip -rq $dist_file $RUBY_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE
103
138
rm -rf $RUBY_DIR $EXTENSION_DIST_DIR $EXTENSION_DIST_PREVIEW_FILE
104
139
echo " Build complete: ${dist_file} "
140
+ }
141
+
142
+ function publish_ruby_for_arch {
143
+ local ruby_version=$1
144
+ local arch=$2
145
+ local dist_file=$3
105
146
106
147
for region in " ${REGIONS_X86[@]} " ; do
107
148
echo " Publishing $dist_file for region=$region , ruby=$ruby_version , arch=$arch "
@@ -113,10 +154,16 @@ function build_and_publish_ruby_for_arch {
113
154
set +u # permit $1 to be unbound so that '*' matches it when no args are present
114
155
case " $1 " in
115
156
" ruby3.3" )
116
- build_and_publish_ruby ' 3.3'
157
+ build-ruby33-arm64
158
+ publish-ruby33-arm64
159
+ build-ruby33-x86
160
+ publish-ruby33-x86
117
161
;;
118
162
" ruby3.2" )
119
- build_and_publish_ruby ' 3.2'
163
+ build-ruby32-arm64
164
+ publish-ruby32-arm64
165
+ build-ruby32-x86
166
+ publish-ruby32-x86
120
167
;;
121
168
* )
122
169
usage
0 commit comments