diff --git a/.ci/jobs/apm-server-smoketests-mbp.yml b/.ci/jobs/apm-server-smoketests-mbp.yml new file mode 100644 index 00000000000..4df24ec3906 --- /dev/null +++ b/.ci/jobs/apm-server-smoketests-mbp.yml @@ -0,0 +1,45 @@ +--- +- job: + name: apm-server/smoke-tests-mbp + display-name: APM Server Smoke Tests + description: APM Server Smoke Tests + project-type: multibranch + concurrent: true + script-path: .ci/smoke-tests.groovy + scm: + - github: + branch-discovery: no-pr + discover-pr-forks-strategy: merge-current + discover-pr-forks-trust: permission + discover-pr-origin: merge-current + discover-tags: false + head-filter-regex: '(main|7\.17|8\.\d+|PR-.*)' + notification-context: 'apm-server-smoketests' + repo: apm-server + repo-owner: elastic + credentials-id: 2a9602aa-ab9f-4e52-baf3-b71ca88469c7-UserAndToken + ssh-checkout: + credentials: f6c7695a-671e-4f4f-a331-acdce44ff9ba + 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: 100 + reference-repo: /var/lib/jenkins/.git-references/apm-server.git + timeout: '15' + use-author: true + wipe-workspace: true + property-strategies: + all-branches: + - suppress-scm-triggering: true diff --git a/.ci/smoke-tests.groovy b/.ci/smoke-tests.groovy new file mode 100644 index 00000000000..6ab3f714392 --- /dev/null +++ b/.ci/smoke-tests.groovy @@ -0,0 +1,70 @@ +#!/usr/bin/env groovy +@Library('apm@current') _ + +pipeline { + agent { label 'linux && immutable' } + environment { + REPO = 'apm-server' + BASE_DIR = "src/github.com/elastic/${env.REPO}" + AWS_ACCOUNT_SECRET = 'secret/observability-team/ci/elastic-observability-aws-account-auth' + EC_KEY_SECRET = 'secret/observability-team/ci/elastic-cloud/observability-pro' + TERRAFORM_VERSION = '1.2.3' + + CREATED_DATE = "${new Date().getTime()}" + } + + options { + timeout(time: 3, unit: 'HOURS') + buildDiscarder(logRotator(numToKeepStr: '100', artifactNumToKeepStr: '30', daysToKeepStr: '30')) + timestamps() + ansiColor('xterm') + disableResume() + durabilityHint('PERFORMANCE_OPTIMIZED') + rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true]) + } + parameters { + string(name: 'SMOKETEST_VERSIONS', defaultValue: 'latest', description: 'Run smoke tests using following APM versions') + } + stages { + stage('Checkout') { + options { skipDefaultCheckout() } + steps { + deleteDir() + gitCheckout(basedir: "${BASE_DIR}", shallow: false) + } + } + + stage('Smoke Tests') { + options { skipDefaultCheckout() } + environment { + SSH_KEY = "./id_rsa_terraform" + TF_VAR_private_key = "./id_rsa_terraform" + TF_VAR_public_key = "./id_rsa_terraform.pub" + // cloud tags + TF_VAR_BUILD_ID = "${env.BUILD_ID}" + TF_VAR_ENVIRONMENT= 'ci' + TF_VAR_BRANCH = "${env.BRANCH_NAME.toLowerCase().replaceAll('[^a-z0-9-]', '-')}" + TF_VAR_REPO = "${REPO}" + } + steps { + dir ("${BASE_DIR}") { + withGoEnv() { + withTestClusterEnv { + sh(label: 'Run smoke tests', script: 'make smoketest') + } + } + } + } + } + } +} + +def withTestClusterEnv(Closure body) { + withAWSEnv(secret: "${AWS_ACCOUNT_SECRET}", version: "2.7.6") { + withTerraformEnv(version: "${TERRAFORM_VERSION}") { + withSecretVault(secret: "${EC_KEY_SECRET}", data: ['apiKey': 'EC_API_KEY'] ) { + body() + } + } + } +}