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

[CI] Enable packaging with Pipeline 2.0 #23854

Merged
merged 50 commits into from
Feb 11, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a38cd76
[CI] Enable packaging with Pipeline 2.0
v1v Feb 4, 2021
6e423ab
Support e2e approach
v1v Feb 4, 2021
f5bdbb6
Support packaging with pipeline 2.0
v1v Feb 4, 2021
6a0ea66
Fix command
v1v Feb 4, 2021
e015b8e
For testing purposes
v1v Feb 4, 2021
7f7b41e
[CI] for testing purposes
v1v Feb 4, 2021
8ad4707
fix wrong syntax with a - in the field
v1v Feb 4, 2021
121e52a
[CI] fix credentials issue
v1v Feb 4, 2021
5b61e05
Use default git step (to avoid any kind of new env variables generate…
v1v Feb 5, 2021
38b7a2e
Cosmetic changes: use the right variable and docs
v1v Feb 5, 2021
164830a
Force GO_VERSION for the e2e to work
v1v Feb 5, 2021
1268e77
Use dir for go
v1v Feb 5, 2021
0174527
Use checkout to skip clean folder with git
v1v Feb 5, 2021
b1f053f
Merge branch 'master' into feature/packaging-e2e-2.0
v1v Feb 5, 2021
644e341
Revert "Use checkout to skip clean folder with git"
v1v Feb 5, 2021
41a6407
Checkout in the folder
v1v Feb 5, 2021
d4e4cca
Return boolean
v1v Feb 6, 2021
ecfd31b
Use junit reporting
v1v Feb 7, 2021
3f79030
Test metricbeat script
v1v Feb 7, 2021
481c3cf
Delegate test preparation to the e2e scripts
v1v Feb 7, 2021
872bcba
Prepare Go version dynamically
v1v Feb 7, 2021
1222ca4
Use entrypoint
v1v Feb 8, 2021
0cd5c08
Publish packages
v1v Feb 8, 2021
2299757
Push CI docker images
v1v Feb 8, 2021
58e5bc5
Use e2e master branch
v1v Feb 8, 2021
5c9d7ea
Disable other pipelines
v1v Feb 9, 2021
85260d8
Add debug mode
v1v Feb 9, 2021
d0371d4
Rename LOG level variable
v1v Feb 9, 2021
96ff995
Avoid using the workdir
v1v Feb 9, 2021
1862d03
For debugging purposes
v1v Feb 9, 2021
3ac5cb2
Revert "For debugging purposes"
v1v Feb 9, 2021
3e073bf
Revert "Avoid using the workdir"
v1v Feb 9, 2021
05af27a
Throw error and archive docker logs
v1v Feb 9, 2021
6da223e
Use x-pack e2e
v1v Feb 9, 2021
c0b7130
Avoid using the workdir since the archive does not work with full paths
v1v Feb 9, 2021
0d819cd
Move away from try/catch
v1v Feb 9, 2021
92eea8f
Add e2e
v1v Feb 9, 2021
896703d
Rename env variable
v1v Feb 9, 2021
6380624
Disable e2e for oss metricbeats
v1v Feb 9, 2021
a70a380
Revert "[CI] for testing purposes"
v1v Feb 9, 2021
984f533
Rename env variable
v1v Feb 9, 2021
7522126
[chore] for testing purposes, disable linting
v1v Feb 9, 2021
09c12ab
Upload artifacts earlier
v1v Feb 9, 2021
97e7409
Force shebang
v1v Feb 9, 2021
6931b00
debugging purposes
v1v Feb 9, 2021
5ac1c01
Enable Snapshot
v1v Feb 10, 2021
5817b85
Revert "Disable other pipelines"
v1v Feb 10, 2021
7cad28a
Restore previous configuration
v1v Feb 10, 2021
9849464
Disable e2e for the time being
v1v Feb 10, 2021
024b732
Apply suggestions from code review
v1v Feb 10, 2021
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
69 changes: 66 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,61 @@ def k8sTest(Map args = [:]) {
}
}

/**
* This method runs the packaging
*/
def packagingLinux(Map args = [:]) {
def PLATFORMS = [ '+all',
'linux/amd64',
'linux/386',
'linux/arm64',
'linux/armv7',
// The platforms above are disabled temporarly as crossbuild images are
// not available. See: https://github.com/elastic/golang-crossbuild/issues/71
//'linux/ppc64le',
//'linux/mips64',
//'linux/s390x',
'windows/amd64',
'windows/386',
(params.macos ? '' : 'darwin/amd64'),
Copy link
Member Author

Choose a reason for hiding this comment

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

Let's see what we do with this

].join(' ')
withEnv([
"PLATFORMS=${PLATFORMS}"
]) {
target(args)
}
}

def e2e(Map args = [:]) {
def suite = args.get('suite', '')
def tags = args.get('tags', '')
def stackVersion = args.get('stackVersion', '8.0.0-SNAPSHOT') // TBC with the version defined somewhere...
dir('.e2e') {
gitCheckout(
branch: "master", // TBC with the target branch if running on a PR basis.
repo: "https://github.com/elastic/e2e-testing.git",
credentialsId: "${JOB_GIT_CREDENTIALS}"
)
try {
if(isInstalled(tool: 'docker', flag: '--version')) {
dockerLogin(secret: "${DOCKER_ELASTIC_SECRET}", registry: "${DOCKER_REGISTRY}")
}
retry(3){
sh script: """.ci/scripts/install-test-dependencies.sh "${suite}" """, label: "Install test dependencies for ${suite}:${tags}"
}
filebeat(output: "docker_logs_${suite}_${tags}.log", workdir: "${env.WORKSPACE}"){
// TBC with the suite to be used
sh script: """SUITE=metricbeat DEVELOPER_MODE=false TIMEOUT_FACTOR=3 LOG_LEVEL=TRACE make -C e2e functional-test""", label: "Run functional tests for ${suite}:${tags}"
}
} catch(e) {
error(e.toString())
} finally {
junit(allowEmptyResults: true, keepLongStdio: true, testResults: "outputs/TEST-*.xml")
archiveArtifacts allowEmptyArchive: true, artifacts: "outputs/TEST-*.xml"
}
}
}

/**
* This method runs the given command supporting two kind of scenarios:
* - make -C <folder> then the dir(location) is not required, aka by disaling isMage: false
Expand All @@ -270,6 +325,7 @@ def target(Map args = [:]) {
def directory = args.get('directory', '')
def withModule = args.get('withModule', false)
def isMage = args.get('isMage', false)
def isE2E = args.get('isE2E', false)
withNode(args.label) {
withGithubNotify(context: "${context}") {
withBeatsEnv(archive: true, withModule: withModule, directory: directory, id: args.id) {
Expand All @@ -279,6 +335,9 @@ def target(Map args = [:]) {
dir(isMage ? directory : '') {
cmd(label: "${args.id?.trim() ? args.id : env.STAGE_NAME} - ${command}", script: "${command}")
}
if(isE2E) {
e2e(suite: directory)
}
}
}
}
Expand Down Expand Up @@ -708,18 +767,22 @@ class RunCommand extends co.elastic.beats.BeatsFunction {
}
public run(Map args = [:]){
def withModule = args.content.get('withModule', false)
if(args?.content?.containsKey('make')) {
def isE2E = args.content.get('isE2E', false)
/*if(args?.content?.containsKey('make')) {
steps.target(context: args.context, command: args.content.make, directory: args.project, label: args.label, withModule: withModule, isMage: false, id: args.id)
}
if(args?.content?.containsKey('mage')) {
steps.target(context: args.context, command: args.content.mage, directory: args.project, label: args.label, withModule: withModule, isMage: true, id: args.id)
}
}*/
if(args?.content?.containsKey('packaging-linux')) {
steps.packagingLinux(context: args.context, command: args.content.packaging-linux, directory: args.project, label: args.label, isMage: true, id: args.id, isE2E: isE2E)
}/*
if(args?.content?.containsKey('k8sTest')) {
steps.k8sTest(context: args.context, versions: args.content.k8sTest.split(','), label: args.label, id: args.id)
}
if(args?.content?.containsKey('cloud')) {
steps.cloud(context: args.context, command: args.content.cloud, directory: args.project, label: args.label, withModule: withModule, dirs: args.content.dirs, id: args.id)
}
} */
}
}

Expand Down
4 changes: 2 additions & 2 deletions Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ projects:
- "x-pack/elastic-agent"
- "x-pack/filebeat"
- "x-pack/functionbeat"
- "x-pack/heartbeat"
- "x-pack/libbeat"
- "x-pack/metricbeat"
- "x-pack/packetbeat"
- "x-pack/winlogbeat"
- "dev-tools"
##- "x-pack/heartbeat" It's not yet in the 1.0 pipeline.
##- "x-pack/journalbeat" It's not yet in the 1.0 pipeline.
##- "x-pack/journalbeat" It is not yet in the 1.0 pipeline.

## Changeset macros that are defined here and used in each specific 2.0 pipeline.
changeset:
Expand Down
3 changes: 3 additions & 0 deletions auditbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ stages:
# - "windows-7"
# branches: true ## for all the branches
# tags: true ## for all the tags
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions filebeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions heartbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,6 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions journalbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ stages:
tags: true ## for all the tags
unitTest:
mage: "mage build unitTest"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions metricbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,6 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: true
3 changes: 3 additions & 0 deletions packetbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions winlogbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions x-pack/auditbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions x-pack/dockerlogbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ stages:
build:
mage: "mage build test"
withModule: true ## run the ITs only if the changeset affects a specific module.
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions x-pack/elastic-agent/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,6 @@ stages:
# - "windows-7-32"
# branches: true ## for all the branches
# tags: true ## for all the tags
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions x-pack/filebeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,6 @@ stages:
# - "windows-7-32"
# branches: true ## for all the branches
# tags: true ## for all the tags
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions x-pack/functionbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,6 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
18 changes: 18 additions & 0 deletions x-pack/heartbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
when:
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a new step, though there is no build in place yet but the packaging itself.

branches: true ## for all the branches
changeset: ## when PR contains any of those entries in the changeset
- "^x-pack/heartbeat/.*"
- "@ci" ## special token regarding the changeset for the ci
- "@xpack" ## special token regarding the changeset for the xpack
comments: ## when PR comment contains any of those entries
- "/test x-pack/heartbeat"
labels: ## when PR labels matches any of those entries
- "x-pack-heartbeat"
parameters: ## when parameter was selected in the UI.
- "x-pack-heartbeat"
tags: true ## for all the tags
platform: "immutable && ubuntu-18" ## default label for all the stages
stages:
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions x-pack/metricbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ stages:
# mage: "mage build unitTest"
# platforms: ## override default labels in this specific stage.
# - "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
3 changes: 3 additions & 0 deletions x-pack/packetbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,6 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
5 changes: 5 additions & 0 deletions x-pack/winlogbeat/Jenkinsfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ stages:
mage: "mage build unitTest"
platforms: ## override default labels in this specific stage.
- "windows-7-32-bit"
packaging-linux:
packaging-linux: "mage package"
isE2E: false
platforms: ## override default labels in this specific stage.
- "immutable && ubuntu-18"