Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial support of smoketests in CI #8492

Merged
merged 3 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .ci/jobs/apm-server-smoketests-mbp.yml
Original file line number Diff line number Diff line change
@@ -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-.*)'
v1v marked this conversation as resolved.
Show resolved Hide resolved
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
v1v marked this conversation as resolved.
Show resolved Hide resolved
70 changes: 70 additions & 0 deletions .ci/smoke-tests.groovy
Original file line number Diff line number Diff line change
@@ -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()
}
}
}
}