From b34b261fc4370601429d444701051337a3cebfb2 Mon Sep 17 00:00:00 2001 From: Jan Calanog Date: Wed, 2 Aug 2023 13:50:04 +0200 Subject: [PATCH] Migrate k8s autodiscovery pipeline (#3596) * Migrate k8s-autodiscovery test to GH Actions workflow * Remove Jenkins jobs * Test stack snapshot branches * Use sha for action version * empty (cherry picked from commit 37e80f65f36a76cfebf0ae63e8d007ede86afc84) # Conflicts: # .ci/jobs/e2e-testing-k8s-autodiscovery-daily-mbp.yml # .github/workflows/opentelemetry.yml --- .ci/e2eTestingK8SAutodiscoveryDaily.groovy | 53 ------------------- .github/workflows/k8s-autodiscovery-test.yml | 42 +++++++++++++++ .github/workflows/opentelemetry.yml | 23 ++++++++ .../autodiscover_test.go | 4 +- 4 files changed, 67 insertions(+), 55 deletions(-) delete mode 100644 .ci/e2eTestingK8SAutodiscoveryDaily.groovy create mode 100644 .github/workflows/k8s-autodiscovery-test.yml create mode 100644 .github/workflows/opentelemetry.yml diff --git a/.ci/e2eTestingK8SAutodiscoveryDaily.groovy b/.ci/e2eTestingK8SAutodiscoveryDaily.groovy deleted file mode 100644 index 6da4375834..0000000000 --- a/.ci/e2eTestingK8SAutodiscoveryDaily.groovy +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to Elasticsearch B.V. under one or more contributor -// license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright -// ownership. Elasticsearch B.V. licenses this file to you under -// the Apache License, Version 2.0 (the "License"); you may -// not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -@Library('apm@current') _ - -pipeline { - agent none - environment { - JOB_GCS_BUCKET = credentials('gcs-bucket') - NOTIFY_TO = credentials('notify-to') - PIPELINE_LOG_LEVEL='INFO' - } - options { - timeout(time: 120, unit: 'MINUTES') - buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20')) - timestamps() - ansiColor('xterm') - disableResume() - durabilityHint('PERFORMANCE_OPTIMIZED') - rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) - quietPeriod(10) - } - stages { - stage('Run Tests') { - steps { - runE2E(jobName: "${env.JOB_BASE_NAME}", - runTestsSuites: 'kubernetes-autodiscover', - slackChannel: 'integrations', - propagate: true, - wait: true) - } - } - } - post { - cleanup { - notifyBuildResult() - } - } -} diff --git a/.github/workflows/k8s-autodiscovery-test.yml b/.github/workflows/k8s-autodiscovery-test.yml new file mode 100644 index 0000000000..4d85f4254f --- /dev/null +++ b/.github/workflows/k8s-autodiscovery-test.yml @@ -0,0 +1,42 @@ +name: k8s-autodiscovery-test + +on: + workflow_dispatch: + schedule: + - cron: '0 18 * * *' + +permissions: + contents: read + +jobs: + elastic-stack-snapshot-branches: + runs-on: ubuntu-latest + timeout-minutes: 1 + outputs: + matrix: ${{ steps.generator.outputs.matrix }} + steps: + - id: generator + uses: elastic/apm-pipeline-library/.github/actions/elastic-stack-snapshot-branches@current + + k8s-autodiscovery-test: + needs: elastic-stack-snapshot-branches + strategy: + matrix: ${{ fromJson(needs.elastic-stack-snapshot-branches.outputs.matrix) }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ matrix.branch }} + - id: get-go-version + name: Get Go version + run: echo "version=$(cat .go-version)" >> "$GITHUB_OUTPUT" + - uses: actions/setup-go@v4 + with: + go-version: ${{ steps.get-go-version.outputs.version }} + - name: Create k8s Kind Cluster + uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0 + - name: Run k8s autodiscovery test + working-directory: e2e/_suites/kubernetes-autodiscover + env: + OP_LOG_LEVEL: DEBUG + run: go test -timeout 90m -v diff --git a/.github/workflows/opentelemetry.yml b/.github/workflows/opentelemetry.yml new file mode 100644 index 0000000000..2bca93afaf --- /dev/null +++ b/.github/workflows/opentelemetry.yml @@ -0,0 +1,23 @@ +--- +name: OpenTelemetry Export Trace + +on: + workflow_run: + workflows: + - bump-elastic-stack-snapshot + - golangci-lint + - k8s-autodiscovery-test + - pre-commit + - pull-request + - Test Report + types: [completed] + +jobs: + otel-export-trace: + runs-on: ubuntu-latest + steps: + - uses: elastic/apm-pipeline-library/.github/actions/opentelemetry@current + with: + vaultUrl: ${{ secrets.VAULT_ADDR }} + vaultRoleId: ${{ secrets.VAULT_ROLE_ID }} + vaultSecretId: ${{ secrets.VAULT_SECRET_ID }} diff --git a/e2e/_suites/kubernetes-autodiscover/autodiscover_test.go b/e2e/_suites/kubernetes-autodiscover/autodiscover_test.go index 97c2cdb3f7..c80a3b2561 100644 --- a/e2e/_suites/kubernetes-autodiscover/autodiscover_test.go +++ b/e2e/_suites/kubernetes-autodiscover/autodiscover_test.go @@ -37,8 +37,8 @@ import ( var beatVersions = map[string]string{} -var defaultEventsWaitTimeout = 60 * time.Second -var defaultDeployWaitTimeout = 60 * time.Second +var defaultEventsWaitTimeout = 300 * time.Second +var defaultDeployWaitTimeout = 300 * time.Second var tx *apm.Transaction var stepSpan *apm.Span