File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -154,6 +154,19 @@ pipeline {
154154 }
155155 }
156156 }
157+ stage(' DeletePreviousLayer' ) {
158+ steps {
159+ withGithubNotify(context : " Delete-Layer-${ PLATFORM} " ) {
160+ withGoEnv(){
161+ withAWSEnv(secret : ' secret/observability-team/ci/service-account/apm-aws-lambda' , forceInstallation : true , version : ' 2.4.10' ) {
162+ dir(" ${ BASE_DIR} " ){
163+ cmd(label : ' make delete-in-all-aws-regions' , script : ' make delete-in-all-aws-regions' , returnStatus : true )
164+ }
165+ }
166+ }
167+ }
168+ }
169+ }
157170 stage(' PublishLayer' ) {
158171 steps {
159172 withGithubNotify(context : " Publish-Layer-${ PLATFORM} " ) {
Original file line number Diff line number Diff line change @@ -115,6 +115,21 @@ publish: validate-layer-name validate-aws-default-region
115115 --license " Apache-2.0" \
116116 --zip-file " fileb://./bin/extension.zip"
117117
118+ # Delete the given LAYER in all the AWS regions
119+ delete-in-all-aws-regions : validate-layer-name get-all-aws-regions
120+ @mkdir -p $(AWS_FOLDER )
121+ @while read AWS_DEFAULT_REGION; do \
122+ echo " delete '$( ELASTIC_LAYER_NAME) -$( ARCHITECTURE) ' in $$ {AWS_DEFAULT_REGION}" ; \
123+ AWS_DEFAULT_REGION=" $$ {AWS_DEFAULT_REGION}" ELASTIC_LAYER_NAME=$(ELASTIC_LAYER_NAME ) $(MAKE ) delete; \
124+ done < .regions
125+
126+ # Delete the given LAYER in the given AWS region, it won't fail
127+ delete : validate-layer-name validate-aws-default-region
128+ @aws lambda \
129+ delete-layer-version \
130+ --layer-name " $( ELASTIC_LAYER_NAME) -$( ARCHITECTURE) " \
131+ --version-number 1 || echo " delete-layer-version $( ELASTIC_LAYER_NAME) -$( ARCHITECTURE) for $$ {AWS_DEFAULT_REGION} could not be found"
132+
118133# Grant public access to the given LAYER in the given AWS region
119134grant-public-layer-access : validate-layer-name validate-aws-default-region
120135 @echo " [debug] $( ELASTIC_LAYER_NAME) -$( ARCHITECTURE) with version: $$ ($( MAKE) -s --no-print-directory get-version)"
You can’t perform that action at this time.
0 commit comments