ci: spin-up ephemeral ESS clusters to run some system tests #1187
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: test-linux | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '*.md' | |
- '*.asciidoc' | |
- 'docs/**' | |
pull_request: | |
paths-ignore: | |
- '*.md' | |
- '*.asciidoc' | |
- 'docs/**' | |
permissions: | |
contents: read | |
concurrency: | |
group: '${{ github.workflow }}-${{ github.ref }}' | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
# 'pack' & 'tests' are required checks in this workflow. | |
# To not burn unneeded CI cycles: | |
# - Our required checks will always succeed if doc only changes are detected. | |
# - all jobs depend on 'format' to not waste cycles on quickly fixable errors. | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bootstrap Action Workspace | |
uses: ./.github/workflows/bootstrap | |
- name: Format | |
run: ./build.sh format | |
#required step | |
pack: | |
runs-on: ubuntu-latest | |
needs: [ 'format' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bootstrap Action Workspace | |
uses: ./.github/workflows/bootstrap | |
with: | |
rust: 'true' | |
- name: Package | |
run: ./build.sh pack | |
#required step | |
tests: | |
runs-on: ubuntu-latest | |
needs: [ 'format' ] | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bootstrap Action Workspace | |
uses: ./.github/workflows/bootstrap | |
- name: 'Tests: Unit' | |
run: ./build.sh test --test-suite unit | |
azure-tests: | |
runs-on: ubuntu-latest | |
needs: [ 'format', 'tests' ] | |
if: | | |
github.event_name != 'pull_request' | |
|| github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' | |
env: | |
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }} | |
ARM_USE_OIDC: true | |
AZURE_RESOURCE_GROUP_PREFIX: ci-dotnet-${{ github.run_id }} | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bootstrap Action Workspace | |
uses: ./.github/workflows/bootstrap | |
with: | |
azure: 'true' | |
- name: 'Az CLI login' | |
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0 | |
with: | |
client-id: ${{ secrets.ARM_CLIENT_ID }} | |
tenant-id: ${{ secrets.ARM_TENANT_ID }} | |
subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }} | |
- name: 'Tests: Azure' | |
run: ./build.sh test --test-suite azure | |
- name: 'Teardown tests infra' | |
if: ${{ always() }} | |
run: | | |
for group in $(az group list --query "[?name | starts_with(@,'${{ env.AZURE_RESOURCE_GROUP_PREFIX }}')]" --out json | jq .[].name --raw-output); do | |
az group delete --name "${group}" --no-wait --yes | |
done | |
integration-tests: | |
runs-on: ubuntu-latest | |
needs: [ 'format', 'tests' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bootstrap Action Workspace | |
uses: ./.github/workflows/bootstrap | |
- name: 'Tests: Integrations' | |
run: ./build.sh test --test-suite integrations | |
- name: Store crash dumps | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: hang-dumps | |
retention-days: 3 | |
path: | | |
build/output/**/*.dmp | |
build/output/**/*.xml | |
build/output/**/*.pdb | |
startup-hook-tests: | |
runs-on: ubuntu-latest | |
needs: [ 'format', 'tests' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bootstrap Action Workspace | |
uses: ./.github/workflows/bootstrap | |
- name: 'Tests: StartupHooks' | |
run: ./build.sh test --test-suite startuphooks | |
profiler-tests: | |
runs-on: ubuntu-latest | |
needs: [ 'format', 'tests' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bootstrap Action Workspace | |
id: bootstrap | |
uses: ./.github/workflows/bootstrap | |
with: | |
rust: 'true' | |
- name: 'Tests: Profiler' | |
run: ./build.sh test --test-suite profiler | |
- name: Build Profiler Docker Image | |
run: | | |
docker build . -t docker.elastic.co/observability/apm-agent-dotnet:${{ steps.bootstrap.outputs.agent-version }} \ | |
--build-arg AGENT_ZIP_FILE=build/output/elastic_apm_profiler_${{ steps.bootstrap.outputs.agent-version }}-linux-x64.zip | |
system-tests: | |
runs-on: ubuntu-latest | |
needs: [ 'tests' ] | |
# Skip pull_request event from forks and dependabot | |
if: github.event_name != 'pull_request' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]' | |
permissions: | |
contents: read | |
id-token: write | |
strategy: | |
fail-fast: false | |
matrix: | |
# NOTE: edge-oblt version is the next major version for APM Server | |
# dev-oblt version is the the next minor release for APM Server | |
# release-oblt version is the latest release or current BC for APM Server | |
remote-cluster: | |
- 'edge-oblt' | |
- 'dev-oblt' | |
- 'release-oblt' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: elastic/oblt-actions/google/auth@v1 | |
- name: Get token | |
id: get_token | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
with: | |
app_id: ${{ secrets.OBS_AUTOMATION_APP_ID }} | |
private_key: ${{ secrets.OBS_AUTOMATION_APP_PEM }} | |
permissions: >- | |
{ | |
"contents": "write", | |
"pull_requests": "read" | |
} | |
repositories: >- | |
["observability-test-environments"] | |
- uses: elastic/oblt-actions/git/setup@v1 | |
with: | |
github-token: ${{ steps.get_token.outputs.token }} | |
- name: Setup ephemeral cluster | |
uses: elastic/oblt-actions/oblt-cli/cluster-create-ccs@v1 | |
id: cluster_create | |
with: | |
github-token: ${{ steps.get_token.outputs.token }} | |
remote-cluster: ${{ matrix.remote-cluster }} | |
cluster-name-prefix: 'dotnet' | |
wait: 15 | |
- name: Setup credentials for the ephemeral cluster | |
uses: elastic/oblt-actions/oblt-cli/cluster-credentials@v1 | |
with: | |
cluster-name: ${{ steps.cluster_create.outputs.cluster-name }} | |
github-token: ${{ steps.get_token.outputs.token }} | |
# NOTE: you can now use the cluster credentials to run your tests | |
# please see https://github.com/elastic/oblt-actions/tree/v1/oblt-cli/cluster-credentials#exported-environment-variables | |
# for the environment variables that are set by this action | |
- run: echo "TBC" | |
- name: Tear down ephemeral cluster | |
uses: elastic/oblt-actions/oblt-cli/cluster-destroy@v1 | |
if: always() | |
continue-on-error: true | |
with: | |
github-token: ${{ steps.get_token.outputs.token }} | |
cluster-name: ${{ steps.cluster_create.outputs.cluster-name }} |