From bcb6ccb00a0164889784f25b9811804e2c7323bd 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) --- .ci/e2eTestingK8SAutodiscoveryDaily.groovy | 53 ------------------- ...2e-testing-k8s-autodiscovery-daily-mbp.yml | 47 ---------------- .github/workflows/k8s-autodiscovery-test.yml | 42 +++++++++++++++ .github/workflows/opentelemetry.yml | 1 + .../autodiscover_test.go | 4 +- 5 files changed, 45 insertions(+), 102 deletions(-) delete mode 100644 .ci/e2eTestingK8SAutodiscoveryDaily.groovy delete mode 100644 .ci/jobs/e2e-testing-k8s-autodiscovery-daily-mbp.yml create mode 100644 .github/workflows/k8s-autodiscovery-test.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/.ci/jobs/e2e-testing-k8s-autodiscovery-daily-mbp.yml b/.ci/jobs/e2e-testing-k8s-autodiscovery-daily-mbp.yml deleted file mode 100644 index 9da5f8ad4a..0000000000 --- a/.ci/jobs/e2e-testing-k8s-autodiscovery-daily-mbp.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- job: - name: e2e-tests/e2e-testing-k8s-autodiscovery-daily-mbp - display-name: End-2-End tests for Observability K8S Autodiscovery Pipeline - description: Run E2E K8S Autodiscovery test suite daily, including maintenance branches - view: E2E - project-type: multibranch - script-path: .ci/e2eTestingK8SAutodiscoveryDaily.groovy - scm: - - github: - branch-discovery: no-pr - head-filter-regex: '(main|8\.\d|7\.17|feature-.*)' - discover-pr-forks-strategy: merge-current - discover-pr-forks-trust: permission - discover-pr-origin: merge-current - discover-tags: false - notification-context: 'beats-ci/e2e-testing' - disable-pr-notifications: true - repo: e2e-testing - repo-owner: elastic - credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken - ssh-checkout: - credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba - property-strategies: - all-branches: - - suppress-scm-triggering: true - build-strategies: - - regular-branches: true - - change-request: - ignore-target-only-changes: true - clean: - after: true - before: true - prune: true - shallow-clone: true - depth: 3 - do-not-fetch-tags: true - submodule: - disable: false - recursive: true - parent-credentials: true - timeout: 120 - timeout: '15' - use-author: true - wipe-workspace: 'True' - triggers: - - timed: 'H H(4-5) * * 1-5' 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 index 739fb908c7..2bca93afaf 100644 --- a/.github/workflows/opentelemetry.yml +++ b/.github/workflows/opentelemetry.yml @@ -6,6 +6,7 @@ on: workflows: - bump-elastic-stack-snapshot - golangci-lint + - k8s-autodiscovery-test - pre-commit - pull-request - Test Report diff --git a/e2e/_suites/kubernetes-autodiscover/autodiscover_test.go b/e2e/_suites/kubernetes-autodiscover/autodiscover_test.go index 2109d109b5..8263200416 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