Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enables auto benchmarking / acceptance testing #78

Merged
merged 31 commits into from
Dec 19, 2024

Conversation

merschformann
Copy link
Member

@merschformann merschformann commented Dec 11, 2024

Description

Important

The selected acceptance test criteria were just for testing and need to be revised.

Re-enables auto-benchmarking. This will automatically run a short acceptance test pre-merge to fend off major performance regressions.
The acceptance test currently runs on every push and will be used to block merges if it fails. Furthermore, the test runs again post-merge to ping Slack with the result and update the baseline instance for future runs.

Changes

  • Added script for auto-benchmarking in .nextmv/benchmark.py.
  • Added auto-benchmark workflow configured in auto-benchmark.yml.
  • Modified cmd/main.go test entrypoint to work with benchmark inputs (they declare an override max duration).

Resolves ENG-5633

@merschformann merschformann marked this pull request as ready for review December 18, 2024 00:21
Copy link
Contributor

@dirkschumacher dirkschumacher left a comment

Choose a reason for hiding this comment

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

LGTM in general, just a small remark. Approving already and you can merge at your own discretion

- name: run acceptance test
run: |
export BRANCH_NAME=$(echo $GITHUB_REF | awk -F'/' '{print $3}')
export BENCHMARK_API_KEY_PROD=${{ secrets.BENCHMARK_API_KEY_PROD }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use the env feature of the GH workflow for BENCHMARK_API_KEY_PROD and SLACK_URL_DEV_SCIENCE?

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean? 🤔
This is necessary to actually surface the secret as an environment variable in the bash sense. env of Github is used to pass environment variables between steps and/or jobs.

I don't think you need to worry about the secrets leaking this way. As far as I can tell this is the intended way of things to work. Github removes the secrets from the log output (see image).

image

I can rewrite the script to accept these as arguments via argparse (bypassing environment variables), but the call to it would still be logged like this, I think:

python .nextmv/benchmark.py --api-key "***" --slack-url "***"

cc @dirkschumacher

Copy link
Contributor

@dirkschumacher dirkschumacher Dec 19, 2024

Choose a reason for hiding this comment

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

No my comment just referred to using the yaml env key within a step instead of export. I thought that would be the same. But no strong opinion, export obviously also works

e.g.

        env:
          BENCHMARK_ACCOUNT_ID: ${{ vars.BENCHMARK_ACCOUNT_ID }}
          BENCHMARK_API_KEY_PROD: ${{ secrets.BENCHMARK_API_KEY_PROD }}

Copy link
Member Author

@merschformann merschformann Dec 19, 2024

Choose a reason for hiding this comment

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

Sure, works for me. Does indeed look a little nicer. 😊

Copy link
Member

@sebastian-quintero sebastian-quintero left a comment

Choose a reason for hiding this comment

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

Just a Nit. LGTM

Comment on lines +17 to +21
APP_ID = "nextroute-bench"
API_KEY = os.environ["BENCHMARK_API_KEY_PROD"]
SLACK_WEBHOOK = os.getenv("SLACK_URL_DEV_SCIENCE", None)
ACCOUNT_ID = os.getenv("BENCHMARK_ACCOUNT_ID", None)
BRANCH_NAME = os.getenv("BRANCH_NAME", None)
Copy link
Member

Choose a reason for hiding this comment

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

Could have used nextmv.Options for this 👻

Copy link
Member Author

Choose a reason for hiding this comment

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

Haha, fair. I suppose I should get used to it more. 😊

@merschformann merschformann merged commit 82afdb3 into develop Dec 19, 2024
34 checks passed
@merschformann merschformann deleted the merschformann/reenable-auto-benchmarks branch December 19, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants