-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 23928-fix-docker-entrypoint
- Loading branch information
Showing
1,175 changed files
with
117,020 additions
and
103,747 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#!/usr/bin/env groovy | ||
|
||
@Library('apm@current') _ | ||
|
||
pipeline { | ||
agent { label 'ubuntu-18 && immutable' } | ||
environment { | ||
BASE_DIR = 'src/github.com/elastic/beats' | ||
DOCKERELASTIC_SECRET = 'secret/observability-team/ci/docker-registry/prod' | ||
DOCKER_REGISTRY = 'docker.elastic.co' | ||
SYNTHETICS = "-synthetics" | ||
PIPELINE_LOG_LEVEL = "INFO" | ||
BEATS_FOLDER = "x-pack/heartbeat" | ||
} | ||
options { | ||
timeout(time: 3, unit: 'HOURS') | ||
buildDiscarder(logRotator(numToKeepStr: '20', artifactNumToKeepStr: '20', daysToKeepStr: '30')) | ||
timestamps() | ||
ansiColor('xterm') | ||
disableResume() | ||
durabilityHint('PERFORMANCE_OPTIMIZED') | ||
disableConcurrentBuilds() | ||
} | ||
triggers { | ||
issueCommentTrigger('(?i)^\\/packag[ing|e] synthetics$') | ||
} | ||
parameters { | ||
booleanParam(name: 'linux', defaultValue: true, description: 'Allow linux stages.') | ||
} | ||
stages { | ||
stage('Checkout') { | ||
options { skipDefaultCheckout() } | ||
steps { | ||
deleteDir() | ||
gitCheckout(basedir: "${BASE_DIR}") | ||
setEnvVar("GO_VERSION", readFile("${BASE_DIR}/.go-version").trim()) | ||
} | ||
} | ||
stage('Build and test'){ | ||
steps { | ||
withGithubNotify(context: "Build and test") { | ||
withBeatsEnv{ | ||
dir("${env.BEATS_FOLDER}") { | ||
sh(label: 'Build and test', script: 'mage build test') | ||
} | ||
} | ||
} | ||
} | ||
} | ||
stage('Package Linux'){ | ||
environment { | ||
HOME = "${env.WORKSPACE}" | ||
PLATFORMS = [ | ||
'+all', | ||
'linux/amd64' | ||
].join(' ') | ||
} | ||
steps { | ||
withGithubNotify(context: "Packaging Linux ${BEATS_FOLDER}") { | ||
release() | ||
pushCIDockerImages() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def pushCIDockerImages(){ | ||
catchError(buildResult: 'UNSTABLE', message: 'Unable to push Docker images', stageResult: 'FAILURE') { | ||
tagAndPush('heartbeat') | ||
} | ||
} | ||
|
||
def tagAndPush(name){ | ||
def libbetaVer = sh(label: 'Get libbeat version', script: 'grep defaultBeatVersion ${BASE_DIR}/libbeat/version/version.go|cut -d "=" -f 2|tr -d \\"', returnStdout: true)?.trim() | ||
|
||
def tagName = "${libbetaVer}" | ||
def oldName = "${DOCKER_REGISTRY}/beats/${name}:${libbetaVer}" | ||
def newName = "${DOCKER_REGISTRY}/observability-ci/${name}:${libbetaVer}${env.SYNTHETICS}" | ||
def commitName = "${DOCKER_REGISTRY}/observability-ci/${name}:${env.GIT_BASE_COMMIT}" | ||
dockerLogin(secret: "${DOCKERELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}") | ||
retry(3){ | ||
sh(label:'Change tag and push', script: """ | ||
docker tag ${oldName} ${newName} | ||
docker push ${newName} | ||
docker tag ${oldName} ${commitName} | ||
docker push ${commitName} | ||
""") | ||
} | ||
} | ||
|
||
def release(){ | ||
withBeatsEnv(){ | ||
dir("${env.BEATS_FOLDER}") { | ||
sh(label: "Release ${env.BEATS_FOLDER} ${env.PLATFORMS}", script: 'mage package') | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* There is a specific folder structure in https://staging.elastic.co/ and https://artifacts.elastic.co/downloads/ | ||
* therefore the storage bucket in GCP should follow the same folder structure. | ||
* This is required by https://github.com/elastic/beats-tester | ||
* e.g. | ||
* baseDir=name -> return name | ||
* baseDir=name1/name2/name3-> return name2 | ||
*/ | ||
def getBeatsName(baseDir) { | ||
return baseDir.replace('x-pack/', '') | ||
} | ||
|
||
def withBeatsEnv(Closure body) { | ||
withMageEnv(){ | ||
withEnv([ | ||
"PYTHON_ENV=${WORKSPACE}/python-env" | ||
]) { | ||
dir("${env.BASE_DIR}"){ | ||
body() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
- job: | ||
name: beats-schedule-weekly | ||
display-name: Jobs scheduled weekly (Sunday) | ||
description: Jobs scheduled weekly (Sunday) | ||
view: Beats | ||
project-type: pipeline | ||
parameters: | ||
- string: | ||
name: branch_specifier | ||
default: master | ||
description: the Git branch specifier to build | ||
pipeline-scm: | ||
script-path: .ci/schedule-weekly.groovy | ||
scm: | ||
- git: | ||
url: git@github.com:elastic/beats.git | ||
refspec: +refs/heads/*:refs/remotes/origin/* | ||
wipe-workspace: 'True' | ||
name: origin | ||
shallow-clone: true | ||
credentials-id: f6c7695a-671e-4f4f-a331-acdce44ff9ba | ||
reference-repo: /var/lib/jenkins/.git-references/beats.git | ||
branches: | ||
- $branch_specifier | ||
triggers: | ||
- timed: 'H H(1-4) * * 0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@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 H(1-4) * * 0') | ||
} | ||
stages { | ||
stage('Nighly beats builds') { | ||
steps { | ||
build(quietPeriod: 0, job: 'Beats/beats/master', parameters: [booleanParam(name: 'awsCloudTests', value: true)], wait: false, propagate: false) | ||
build(quietPeriod: 1000, job: 'Beats/beats/7.x', parameters: [booleanParam(name: 'awsCloudTests', value: true)], wait: false, propagate: false) | ||
} | ||
} | ||
} | ||
post { | ||
cleanup { | ||
notifyBuildResult(prComment: false) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.14.12 | ||
1.15.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.