@@ -16,6 +16,9 @@ pipeline {
1616 SLACK_CHANNEL = ' #apm-agent-java'
17171818 BRANCH_SPECIFIER = " ${ params.branch_specifier} "
19+ SUFFIX_ARN_FILE = ' arn-file.md'
20+ // RELEASE_AWS_LAMBDA_VERSION = '-ver-1-29-0'
21+ // RELEASE_VERSION = '1.29.0'
1922 }
2023 options {
2124 timeout(time : 3 , unit : ' HOURS' )
@@ -27,6 +30,7 @@ pipeline {
2730 parameters {
2831 string(name : ' branch_specifier' , defaultValue : ' stable' , description : " What branch to release from?" )
2932 booleanParam(name : ' check_branch_ci_status' , defaultValue : true , description : " Check for failing tests in the given branch (if no stable branch)?" )
33+ booleanParam(name : ' publish_aws_lambda' , defaultValue : true , description : " Whether to upload the AWS lambda" )
3034 }
3135 stages {
3236 stage(' Initializing' ){
@@ -131,6 +135,7 @@ pipeline {
131135 env. RELEASE_TAG = " v" + user_release_version
132136 env. RELEASE_VERSION = user_release_version
133137 env. BRANCH_DOT_X = user_release_version. substring(0 , user_release_version. indexOf(' .' ))+ ' .x'
138+ env. RELEASE_AWS_LAMBDA_VERSION = ' -ver-' + user_release_version. replaceAll(' \\ .' , ' -' )
134139 }
135140 }
136141 }
@@ -164,10 +169,43 @@ pipeline {
164169 }
165170 }
166171 }
172+ stage(' Publish AWS Lambda' ) {
173+ when {
174+ // expression { params.publish_aws_lambda }
175+ expression { return false }
176+ }
177+ environment {
178+ SOURCE_AWS_FILE = " elastic-apm-java-aws-lambda-layer-${ RELEASE_VERSION} .zip"
179+ }
180+ steps {
181+ setEnvVar(' ELASTIC_LAYER_NAME' , " elastic-apm-java${ env.RELEASE_AWS_LAMBDA_VERSION} " )
182+ withAWSEnv(secret : ' secret/observability-team/ci/service-account/apm-aws-lambda' , role_id : ' apm-vault-role-id' , secret_id : ' apm-vault-secret-id' ,
183+ forceInstallation : true , version : ' 2.4.10' ) {
184+ dir(" ${ BASE_DIR} " ){
185+ dir (' elastic-apm-agent/target' ) {
186+ // TODO: copy file from a google bucket
187+ sh(label : ' fetch AWS lambda file' , script : " wget https://github.com/elastic/apm-agent-java/releases/download/v${ RELEASE_VERSION} /${ SOURCE_AWS_FILE} -O ${ SOURCE_AWS_FILE} " )
188+ }
189+ sh(label : ' make publish-in-all-aws-regions' , script : ' make -C .ci publish-in-all-aws-regions' )
190+ sh(label : ' make create-arn-file' , script : ' make -C .ci create-arn-file' )
191+ }
192+ }
193+ }
194+ post {
195+ always {
196+ archiveArtifacts(allowEmptyArchive : true , artifacts : " ${ BASE_DIR} /.ci/${ SUFFIX_ARN_FILE} " )
197+ }
198+ }
199+ }
167200 stage(' Create GitHub release draft' ) {
201+ when {
202+ expression { return false }
203+ }
168204 steps {
169205 dir(" ${ BASE_DIR} " ){
170206 script {
207+ def arnFile = " .ci/${ SUFFIX_ARN_FILE} "
208+ setEnvVar(' ARN_CONTENT' , fileExists(arnFile) ? readFile(arnFile) : ' ' )
171209 // Construct the URL with anchor for the release notes
172210 // Ex: https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-1.x.html#release-notes-1.13.0
173211 def finalUrl = " https://www.elastic.co/guide/en/apm/agent/java/current/release-notes-${ BRANCH_DOT_X} .html#release-notes-${ RELEASE_VERSION} "
@@ -176,14 +214,17 @@ pipeline {
176214 draft : true ,
177215 tagName : " ${ RELEASE_TAG} " ,
178216 releaseName : " Release ${ RELEASE_VERSION} " ,
179- body : " [Release Notes for ${ RELEASE_VERSION} ](${ finalUrl} )" )
217+ body : " [Release Notes for ${ RELEASE_VERSION} ](${ finalUrl} ) \n ${ ARN_CONTENT } " )
180218 env. RELEASE_ID = ret[' id' ]
181219 env. RELEASE_NOTES_URL = finalUrl
182220 }
183221 }
184222 }
185223 }
186224 stage(' Wait for artifact to be available in Maven Central' ) {
225+ when {
226+ expression { return false }
227+ }
187228 steps {
188229 dir(" ${ BASE_DIR} " ){
189230 script {
@@ -199,6 +240,9 @@ pipeline {
199240 }
200241 }
201242 stage(' Update Cloudfoundry' ) {
243+ when {
244+ expression { return false }
245+ }
202246 steps {
203247 dir(" ${ BASE_DIR} " ){
204248 sh(script : " .ci/release/update_cloudfoundry.sh ${ RELEASE_VERSION} " )
@@ -207,6 +251,9 @@ pipeline {
207251 }
208252 }
209253 stage(' Publish release on GitHub' ) {
254+ when {
255+ expression { return false }
256+ }
210257 steps {
211258 dir(" ${ BASE_DIR} " ){
212259 waitUntil(initialRecurrencePeriod : 60000 ) {
@@ -222,6 +269,9 @@ pipeline {
222269 }
223270 }
224271 stage(' Build and push Docker images' ) {
272+ when {
273+ expression { return false }
274+ }
225275 steps {
226276 dir(" ${ BASE_DIR} " ){
227277 // fetch agent artifact from remote repository
0 commit comments