Skip to content

Commit 6baa401

Browse files
authored
publish: add elastic prefix in the layer name and version as suffix (#115)
1 parent 421db45 commit 6baa401

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.ci/Jenkinsfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pipeline {
99
BASE_DIR = "src/github.com/elastic/${env.REPO}"
1010
PIPELINE_LOG_LEVEL = 'INFO'
1111
SUFFIX_ARN_FILE = 'arn-file.md'
12-
ELASTIC_LAYER_NAME = 'apm-lambda-extension'
1312
RELEASE_URL_MESSAGE = "(<https://github.com/elastic/${env.REPO}/releases/tag/${env.TAG_NAME}|${env.TAG_NAME}>)"
1413
SLACK_CHANNEL = '#apm-serverless'
1514
NOTIFY_TO = '[email protected]'
@@ -36,6 +35,7 @@ pipeline {
3635
deleteDir()
3736
gitCheckout(basedir: "${BASE_DIR}")
3837
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
38+
setEnvVar('ELASTIC_LAYER_NAME', "elastic-apm-extension${getVersion()}")
3939
}
4040
}
4141
stage('Lint'){
@@ -191,6 +191,18 @@ pipeline {
191191
}
192192
}
193193

194+
/**
195+
* Transform TAG releases from v{major}.{minor}.{patch} to
196+
* ver-{major}-{minor}-{patch}. f.i: given v1.2.3 then
197+
* -ver-1-2-3.
198+
*/
199+
def getVersion() {
200+
if (env.BRANCH_NAME?.trim() && env.BRANCH_NAME.startsWith('v')) {
201+
return env.BRANCH_NAME.replaceAll('v', '-ver').replaceAll('\\.', '-')
202+
}
203+
return ''
204+
}
205+
194206
def notifyStatus(def args = [:]) {
195207
releaseNotification(slackChannel: "${env.SLACK_CHANNEL}",
196208
slackColor: args.slackStatus,

apm-lambda-extension/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ get-all-aws-regions:
5151
publish-in-all-aws-regions: validate-layer-name get-all-aws-regions
5252
@mkdir -p $(AWS_FOLDER)
5353
@while read AWS_DEFAULT_REGION; do \
54-
echo "publish '$(ELASTIC_LAYER_NAME)' in $${AWS_DEFAULT_REGION}"; \
54+
echo "publish '$(ELASTIC_LAYER_NAME)-$(ARCHITECTURE)' in $${AWS_DEFAULT_REGION}"; \
5555
AWS_DEFAULT_REGION="$${AWS_DEFAULT_REGION}" ELASTIC_LAYER_NAME=$(ELASTIC_LAYER_NAME) $(MAKE) publish > $(AWS_FOLDER)/$${AWS_DEFAULT_REGION}; \
5656
AWS_DEFAULT_REGION="$${AWS_DEFAULT_REGION}" ELASTIC_LAYER_NAME=$(ELASTIC_LAYER_NAME) $(MAKE) grant-public-layer-access; \
5757
done <.regions
@@ -61,7 +61,7 @@ publish: validate-layer-name validate-aws-default-region
6161
@aws lambda \
6262
--output json \
6363
publish-layer-version \
64-
--layer-name "${ELASTIC_LAYER_NAME}" \
64+
--layer-name "$(ELASTIC_LAYER_NAME)-$(ARCHITECTURE)" \
6565
--description "AWS Lambda Extension Layer for Elastic APM $(ARCHITECTURE)" \
6666
--license "Apache-2.0" \
6767
--zip-file "fileb://./bin/extension.zip"

apm-lambda-extension/cli/build-and-publish.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function getLastJsonFromShellOutput (output) {
3838
function buildAndPublish () {
3939
return new Promise(function (resolve, reject) {
4040
if (!process.env.ELASTIC_LAYER_NAME) {
41-
process.env.ELASTIC_LAYER_NAME = 'apm-lambda-extension'
41+
process.env.ELASTIC_LAYER_NAME = 'elastic-apm-extension'
4242
}
4343
console.log('running cd .. && make build-and-publish')
4444
exec('cd .. && make build-and-publish', (error, stdout, stderr) => {

0 commit comments

Comments
 (0)