Skip to content

Conversation

@v1v
Copy link
Member

@v1v v1v commented Feb 23, 2022

What

  1. Monitor the repository for a new release tag version (ex. v3.x.x)
  2. When a tag is detected, a build process will run such that
  • A new GitHub release will be generated for the tag
  • A new layer will be published to AWS for every AWS region
  • The Layer ARN and version will be published in a table to the just created GitHub release
  • These should be publicly accessible layers
  1. Notify when the AWS lambda is published

Tests

Create zip file

ELASTIC_LAYER_NAME=v1v-elastic-apm-node-ver-0-0-0 \
BRANCH_NAME=v3.29.0 \
SUFFIX_ARN_FILE=arn \
make -C .ci dist

produced:

rm -rf ../aws || true
mkdir -p ../aws
cd ../aws; \
		npm init -y; \
		npm install --global-style https://github.com/elastic/apm-agent-nodejs#v3.29.0; \
		mkdir nodejs; \
		mv node_modules nodejs
Wrote to /Users/vmartinez/work/src/github.com/elastic/apm-agent-nodejs/aws/package.json:

{
  "name": "aws",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}



added 157 packages, and audited 158 packages in 5s

36 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
rm -f v3.29.0.zip || true
cd ../aws ; \
		zip -r v3.29.0.zip nodejs
  adding: nodejs/ (stored 0%)
  adding: nodejs/node_modules/ (stored 0%)
  adding: nodejs/node_modules/.package-lock.json (deflated 74%)
  adding: nodejs/node_modules/elastic-apm-node/ (stored 0%)
  adding: nodejs/node_modules/elastic-apm-node/start.js (stored 0%)
  adding: nodejs/node_modules/elastic-apm-node/types/ (stored 0%)
  adding: nodejs/node_modules/elastic-apm-node/types/connect.d.ts (deflated 42%)

List regions:

AWS_ACCESS_KEY_ID=**** \                       
AWS_SECRET_ACCESS_KEY=**** \
ELASTIC_LAYER_NAME=v1v-elastic-apm-node-ver-0-0-0 \
BRANCH_NAME=v3.29.0 \
SUFFIX_ARN_FILE=arn \
make -C .ci get-all-aws-regions
cat .ci/.regions

produces:

af-south-1
eu-north-1
ap-south-1
eu-west-3

Publish

AWS_ACCESS_KEY_ID=**** \
AWS_SECRET_ACCESS_KEY=**** \
ELASTIC_LAYER_NAME=v1v-elastic-apm-node-ver-0-0-0 \
BRANCH_NAME=v3.29.0 \
SUFFIX_ARN_FILE=arn \
make -C .ci publish-in-all-aws-regions

produces:

publish 'v1v-elastic-apm-node-ver-0-0-0' in af-south-1
[debug] v1v-elastic-apm-node-ver-0-0-0 with version: 1
publish 'v1v-elastic-apm-node-ver-0-0-0' in eu-north-1
[debug] v1v-elastic-apm-node-ver-0-0-0 with version: 1
...

Create ARN markdown

ELASTIC_LAYER_NAME=v1v-elastic-apm-node-ver-0-0-0 \
BRANCH_NAME=v3.29.0 \
SUFFIX_ARN_FILE=arn \
make -C .ci create-arn-file

produces:

INFO: create-arn-table ARN(arn:aws:lambda:af-south-1:267093732750:layer:v1v-elastic-apm-node-ver-0-0-0:1):region(af-south-1))
INFO: create-arn-table ARN(arn:aws:lambda:ap-east-1:267093732750:layer:v1v-elastic-apm-node-ver-0-0-0:1):region(ap-east-1))
INFO: create-arn-table ARN(arn:aws:lambda:ap-northeast-1:267093732750:layer:v1v-elastic-apm-node-ver-0-0-0:1):region(ap-northeast-1))

image

Create Release Notes

ELASTIC_LAYER_NAME=v1v-elastic-apm-node-ver-0-0-0 \
BRANCH_NAME=v3.29.0 \
SUFFIX_ARN_FILE=arn \
make -C .ci release-notes

produces:

https://github.com/v1v/apm-agent-nodejs/releases/tag/untagged-5bcf4f0a0e61061a3f8f

@github-actions github-actions bot added the agent-nodejs Make available for APM Agents project planning. label Feb 23, 2022
@ghost
Copy link

ghost commented Feb 23, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-03-01T19:33:48.772+0000

  • Duration: 21 min 33 sec

Test stats 🧪

Test Results
Failed 0
Passed 241793
Skipped 0
Total 241793

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run module tests for <modules> : Run TAV tests for one or more modules, where <modules> can be either a comma separated list of modules (e.g. memcached,redis) or the string literal ALL to test all modules

  • run benchmark tests : Run the benchmark test only.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@v1v v1v mentioned this pull request Feb 28, 2022
@v1v
Copy link
Member Author

v1v commented Feb 28, 2022

@v1v v1v marked this pull request as ready for review February 28, 2022 16:35
@v1v v1v requested review from a team February 28, 2022 16:35
@v1v v1v self-assigned this Feb 28, 2022
@v1v v1v added the automation label Feb 28, 2022
.ci/Makefile Outdated
release \
create $(BRANCH_NAME) \
--title '$(BRANCH_NAME)' \
--generate-notes \
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably we don't want this, otherwise

image

Suggested change
--generate-notes \

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. I think it would be better to point to the published release notes, e.g. https://www.elastic.co/guide/en/apm/agent/nodejs/current/release-notes-3.x.html#release-notes-3.29.0, at the top of the release section, if possible.

Copy link
Member Author

Choose a reason for hiding this comment

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

mdelapenya
mdelapenya previously approved these changes Feb 28, 2022
@v1v
Copy link
Member Author

v1v commented Mar 1, 2022

I just added a few more changes to:

  • consolidate the AWS_FOLDER in each Make goal.
  • Remove the generate notes in the Release Notes
  • Calculate the changelog

I tested it locally by just running the make goals and https://github.com/v1v/apm-agent-nodejs/releases/tag/v3.29.0 has been just created.

How does it look? If it's fine, I'd like to give a go with the test branch to verify everything goes smooth as expected, for such, I'll rebase the test branch with this PR and then the CI will do the rest. Please let me know your thoughts, as a consequence the ARN will be pointing to the version 2, I don't think that's problematic at all

astorm
astorm previously approved these changes Mar 1, 2022
.ci/Jenkinsfile Outdated
OPBEANS_REPO = 'opbeans-node'
GITHUB_CHECK = 'true'
RELEASE_URL_MESSAGE = "(<https://github.com/elastic/${env.REPO}/releases/tag/${env.TAG_NAME}|${env.TAG_NAME}>)"
SLACK_CHANNEL = '#apm-agent-nodejs'
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a heads up -- for the test builds we didn't see a message sent to our slack channel.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right, I didn't enable notifications from the PullRequest but from Tags, I'm gonna proceed with a new release simulation that should also send notifications, if no issues from your side.

As stated in #2585 (comment), I'd like to give another go, therefore the new ARNs will be ending in 2.

Copy link
Member Author

Choose a reason for hiding this comment

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

image

(bear in mind, the existing null references are expected since it uses a specific env variable only available when running a build from a Git tag)

@astorm
Copy link
Contributor

astorm commented Mar 1, 2022

as a consequence the ARN will be pointing to the version 2, I don't think that's problematic at all

Agreed, not a problem at all.

How does it look? If it's fine, I'd like to give a go with the test branch to verify everything goes smooth as expected, for such, I'll rebase the test branch with this PR and then the CI will do the rest. Please let me know your thoughts,

Sounds good to me -- test away!

@v1v
Copy link
Member Author

v1v commented Mar 1, 2022

#2588 is now running again in the CI, (disabled all the stages but the AWS publishing) and enabled the slack/email notifications with the outcome for the AWS automation. Let's see how it goes in the CI

@v1v
Copy link
Member Author

v1v commented Mar 1, 2022

Co-authored-by: Trent Mick <trentm@gmail.com>
dist: validate-branch-name build
rm -f $(BRANCH_NAME).zip || true
cd $(AWS_FOLDER) ; \
zip -r $(BRANCH_NAME).zip nodejs
Copy link
Member Author

Choose a reason for hiding this comment

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

Produces

image

@v1v
Copy link
Member Author

v1v commented Mar 1, 2022

Status update

https://github.com/v1v/apm-agent-nodejs/releases/tag/v3.29.0 has been created by running the make goals locally.

@trentm , you can now move on with the code review 🙏

@v1v v1v changed the title ci: support AWS lambda when a tag release ci: support AWS lambda when a tag release is created Mar 3, 2022
@v1v v1v merged commit 062f2e2 into elastic:main Mar 3, 2022
@v1v v1v deleted the feature/add-aws-lambda branch March 3, 2022 09:28
@trentm trentm mentioned this pull request Mar 10, 2022
@trentm trentm mentioned this pull request Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-nodejs Make available for APM Agents project planning. automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants