Migrate nightly benchmarks to GH Actions #4
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: benchmarks | |
on: | |
schedule: | |
- cron: '0 17 * * *' | |
pull_request: # TODO Remove again | |
jobs: | |
benchmarks: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: testing/benchmark | |
env: | |
SSH_KEY: ./id_rsa_terraform | |
TF_VAR_PRIVATE_KEY: ./id_rsa_terraform | |
TF_VAR_PUBLIC_KEY: ./id_rsa_terraform.pub | |
TFVARS_SOURCE: "system-profiles/8GBx1zone.tfvars" # // Default to use an 8gb profile | |
TF_VAR_BUILD_ID: ${{ github.run_id }} | |
TF_VAR_ENVIRONMENT: ci | |
TF_VAR_REPO: ${{ github.repository }} | |
GOBENCH_TAGS: branch=${{ github.head_ref || github.ref }},commit=${{ github.sha }},target_branch=${{ github.base_ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version-file: 'go.mod' | |
- uses: rlespinasse/github-slug-action@d1ca8ffbce40ea2371e35bca356db0acacf567d2 | |
- name: Set up env | |
run: | | |
SLUGGED_BRANCH_NAME=${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} | |
CREATED_AT=$(date +%s) | |
echo "TF_VAR_BRANCH=${SLUGGED_BRANCH_NAME}" >> "$GITHUB_ENV" | |
echo "TF_VAR_CREATED_AT=${CREATED_AT}" >> "$GITHUB_ENV" | |
echo "USER=benchci-$SLUGGED_BRANCH_NAME-$CREATED_AT" >> "$GITHUB_ENV" | |
- uses: elastic/apm-pipeline-library/.github/actions/docker-login@main | |
with: | |
registry: docker.elastic.co | |
secret: secret/observability-team/ci/docker-registry/prod | |
url: ${{ secrets.VAULT_ADDR }} | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
- uses: hashicorp/vault-action@v2.6.0 | |
with: | |
url: ${{ secrets.VAULT_ADDR }} | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
method: approle | |
secrets: | | |
secret/observability-team/ci/elastic-observability-aws-account-auth access_key | AWS_ACCESS_KEY_ID ; | |
secret/observability-team/ci/elastic-observability-aws-account-auth secret_key | AWS_SECRET_ACCESS_KEY ; | |
secret/observability-team/ci/benchmark-cloud user | GOBENCH_USERNAME ; | |
secret/observability-team/ci/benchmark-cloud url | GOBENCH_HOST ; | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.3.7 | |
- name: Build apmbench | |
run: make apmbench $SSH_KEY terraform.tfvars | |
- name: Spin up benchmark environment | |
run: make docker-override-committed-version init apply; echo "-> infra setup done" | |
- name: Tear down benchmark environment | |
if: always() | |
run: make destroy |