Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pipeline {
BASE_DIR = "src/github.com/elastic/${env.REPO}"
PIPELINE_LOG_LEVEL = 'INFO'
SUFFIX_ARN_FILE = 'arn-file.md'
ELASTIC_LAYER_NAME = 'apm-lambda-extension'
RELEASE_URL_MESSAGE = "(<https://github.com/elastic/${env.REPO}/releases/tag/${env.TAG_NAME}|${env.TAG_NAME}>)"
SLACK_CHANNEL = '#apm-serverless'
NOTIFY_TO = '[email protected]'
Expand All @@ -36,6 +35,7 @@ pipeline {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}")
stash allowEmpty: true, name: 'source', useDefaultExcludes: false
setEnvVar('ELASTIC_LAYER_NAME', "elastic-apm-extension${getVersion()}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to include a suffix for the architecture, otherwise the ARNs for x86_64 and arm64 are indistinguishable.

}
}
stage('Lint'){
Expand Down Expand Up @@ -191,6 +191,18 @@ pipeline {
}
}

/**
* Transform TAG releases from v{major}.{minor}.{patch} to
* ver-{major}-{minor}-{patch}. f.i: given v1.2.3 then
* -ver-1-2-3.
*/
def getVersion() {
if (env.BRANCH_NAME?.trim() && env.BRANCH_NAME.startsWith('v')) {
return env.BRANCH_NAME.replaceAll('v', '-ver').replaceAll('\\.', '-')
}
return ''
}

def notifyStatus(def args = [:]) {
releaseNotification(slackChannel: "${env.SLACK_CHANNEL}",
slackColor: args.slackStatus,
Expand Down
4 changes: 2 additions & 2 deletions apm-lambda-extension/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ get-all-aws-regions:
publish-in-all-aws-regions: validate-layer-name get-all-aws-regions
@mkdir -p $(AWS_FOLDER)
@while read AWS_DEFAULT_REGION; do \
echo "publish '$(ELASTIC_LAYER_NAME)' in $${AWS_DEFAULT_REGION}"; \
echo "publish '$(ELASTIC_LAYER_NAME)-$(ARCHITECTURE)' in $${AWS_DEFAULT_REGION}"; \
AWS_DEFAULT_REGION="$${AWS_DEFAULT_REGION}" ELASTIC_LAYER_NAME=$(ELASTIC_LAYER_NAME) $(MAKE) publish > $(AWS_FOLDER)/$${AWS_DEFAULT_REGION}; \
done <.regions

Expand All @@ -60,7 +60,7 @@ publish: validate-layer-name validate-aws-default-region
@aws lambda \
--output json \
publish-layer-version \
--layer-name "${ELASTIC_LAYER_NAME}" \
--layer-name "$(ELASTIC_LAYER_NAME)-$(ARCHITECTURE)" \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The make goal publish is the one in charge to apply the layer-name with the architecture since the Makefile is in charge to transform the GOARCH in the expected format.

--description "AWS Lambda Extension Layer for Elastic APM $(ARCHITECTURE)" \
--license "Apache-2.0" \
--zip-file "fileb://./bin/extension.zip"
Expand Down
2 changes: 1 addition & 1 deletion apm-lambda-extension/cli/build-and-publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function getLastJsonFromShellOutput (output) {
function buildAndPublish () {
return new Promise(function (resolve, reject) {
if (!process.env.ELASTIC_LAYER_NAME) {
process.env.ELASTIC_LAYER_NAME = 'apm-lambda-extension'
process.env.ELASTIC_LAYER_NAME = 'elastic-apm-extension'
}
console.log('running cd .. && make build-and-publish')
exec('cd .. && make build-and-publish', (error, stdout, stderr) => {
Expand Down