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

[jjbb] for scheduling e2e jobs #418

Merged
merged 4 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
61 changes: 61 additions & 0 deletions .ci/e2e-synthetics.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env groovy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite basic pipeline to only checkout the source code and notify the status in slack/email.

TBC in a follow up


@Library('apm@current') _

pipeline {
agent { label 'ubuntu-18 && immutable' }
environment {
REPO = "synthetics"
BASE_DIR = "src/github.com/elastic/${env.REPO}"
PIPELINE_LOG_LEVEL = 'INFO'
SLACK_CHANNEL = '#synthetics-user_experience-uptime'
cachedout marked this conversation as resolved.
Show resolved Hide resolved
}
options {
timeout(time: 1, unit: 'HOURS') // to support releases then we will add a timeout in each stage
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30'))
timestamps()
ansiColor('xterm')
disableResume()
durabilityHint('PERFORMANCE_OPTIMIZED')
rateLimitBuilds(throttle: [count: 60, durationName: 'hour', userBoost: true])
quietPeriod(10)
}
stages {
stage('Checkout') {
options {
skipDefaultCheckout()
timeout(5)
}
steps {
deleteDir()
gitCheckout(basedir: "${BASE_DIR}")
stash allowEmpty: true, name: 'source', useDefaultExcludes: false, excludes: ".nvm/**,.npm/_cacache/**,.nvm/.git/**"
}
}
}
post {
cleanup {
notifyBuildResult(prComment: true)
}
unsuccessful {
notifyStatus(slackStatus: 'danger', subject: "[${env.REPO}] e2e failed", body: "(<${env.RUN_DISPLAY_URL}|Open>)")
}
success {
notifyStatus(slackStatus: 'good', subject: "[${env.REPO}] e2e ran successfully", body: "Great news, the e2e for synthetics has finished successfully. (<${env.RUN_DISPLAY_URL}|Open>).")
}
}
}

/**
This is the wrapper to send notifications for the release process through
v1v marked this conversation as resolved.
Show resolved Hide resolved
slack and email, since it requires some formatting to support the same
message in both systems.
*/
def notifyStatus(def args = [:]) {
releaseNotification(slackChannel: "${env.SLACK_CHANNEL}",
v1v marked this conversation as resolved.
Show resolved Hide resolved
slackColor: args.slackStatus,
slackCredentialsId: 'jenkins-slack-integration-token',
to: 'synthrum@elastic.co',
subject: args.subject,
body: args.body)
}
44 changes: 44 additions & 0 deletions .ci/jobs/e2e-synthetics-mbp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
- job:
name: apm-agent-rum/e2e-synthetics-mbp
display-name: E2E for Elastic Synthetics
description: E2E for Elastic Synthetics.
project-type: multibranch
script-path: .ci/e2e-synthetics.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
disable-pr-notifications: true
head-filter-regex: '(master|\d+\.\d+\.\d+|PR-.*)'
notification-context: 'elastic-synthetics'
repo: 'synthetics'
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
property-strategies:
all-branches:
- suppress-scm-triggering: 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
timeout: '15'
use-author: true
wipe-workspace: true
26 changes: 26 additions & 0 deletions .ci/jobs/e2e-synthetics-schedule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
- job:
name: apm-agent-rum/e2e-synthetics-schedule
display-name: Jobs scheduled daily
description: Jobs scheduled daily from Monday to Friday
project-type: pipeline
parameters:
- string:
name: branch_specifier
default: master
description: the Git branch specifier to build
pipeline-scm:
script-path: .ci/schedule.groovy
scm:
- git:
url: git@github.com:elastic/synthetics.git
refspec: +refs/heads/*:refs/remotes/origin/* +refs/pull/*/head:refs/remotes/origin/pr/*
wipe-workspace: 'True'
name: origin
shallow-clone: true
credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba
reference-repo: /var/lib/jenkins/.git-references/synthetics.git
branches:
- $branch_specifier
triggers:
- timed: 'H 4,16 * * 1-5'
37 changes: 37 additions & 0 deletions .ci/schedule.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env groovy

@Library('apm@current') _

pipeline {
agent none
environment {
NOTIFY_TO = credentials('notify-to')
PIPELINE_LOG_LEVEL='INFO'
}
options {
timeout(time: 1, unit: 'HOURS')
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20'))
timestamps()
ansiColor('xterm')
disableResume()
durabilityHint('PERFORMANCE_OPTIMIZED')
}
triggers {
cron('H 4,16 * * 1-5')
}
stages {
stage('Run Tasks'){
steps {
build(job: 'apm-agent-rum/e2e-synthetics-mpb/master',
v1v marked this conversation as resolved.
Show resolved Hide resolved
propagate: false,
wait: false
)
}
}
}
post {
cleanup {
notifyBuildResult()
}
}
}