Skip to content

Commit

Permalink
[CI] Create a ciGroup just for tests that use Docker (#98535) (#99090)
Browse files Browse the repository at this point in the history
# Conflicts:
#	test/scripts/jenkins_xpack_build_kibana.sh
  • Loading branch information
brianseeders authored May 3, 2021
1 parent 0182b8d commit f98c2a2
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 8 deletions.
1 change: 1 addition & 0 deletions .ci/es-snapshots/Jenkinsfile_verify_es
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ kibanaPipeline(timeoutMinutes: 210) {
task {
kibanaPipeline.buildXpack(10)
tasks.xpackCiGroups()
tasks.xpackCiGroupDocker()
}
}
}
Expand Down
1 change: 1 addition & 0 deletions .ci/jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ JOB:
- x-pack-ciGroup11
- x-pack-ciGroup12
- x-pack-ciGroup13
- x-pack-ciGroupDocker
- x-pack-accessibility
- x-pack-visualRegression

Expand Down
15 changes: 14 additions & 1 deletion test/scripts/jenkins_xpack_build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ node scripts/functional_tests --assert-none-excluded \
--include-tag ciGroup10 \
--include-tag ciGroup11 \
--include-tag ciGroup12 \
--include-tag ciGroup13
--include-tag ciGroup13 \
--include-tag ciGroupDocker

echo " -> building and extracting default Kibana distributable for use in functional tests"
cd "$KIBANA_DIR"
Expand All @@ -40,6 +41,18 @@ linuxBuild="$(find "$KIBANA_DIR/target" -name 'kibana-*-linux-x86_64.tar.gz')"
installDir="$KIBANA_DIR/install/kibana"
mkdir -p "$installDir"
tar -xzf "$linuxBuild" -C "$installDir" --strip=1
cp "$linuxBuild" "$WORKSPACE/kibana-default.tar.gz"

mkdir -p "$WORKSPACE/kibana-build-xpack"
cp -pR install/kibana/. $WORKSPACE/kibana-build-xpack/

echo " -> Archive built plugins"
shopt -s globstar
tar -zcf \
"$WORKSPACE/kibana-default-plugins.tar.gz" \
x-pack/plugins/**/target/public \
x-pack/test/**/target/public \
examples/**/target/public \
x-pack/examples/**/target/public \
test/**/target/public
shopt -u globstar
31 changes: 28 additions & 3 deletions vars/kibanaPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def functionalTestProcess(String name, String script) {

def ossCiGroupProcess(ciGroup, withDelay = false) {
return functionalTestProcess("ciGroup" + ciGroup) {
if (withDelay) {
if (withDelay && !(ciGroup instanceof String) && !(ciGroup instanceof GString)) {
sleep((ciGroup-1)*30) // smooth out CPU spikes from ES startup
}

Expand All @@ -147,7 +147,7 @@ def ossCiGroupProcess(ciGroup, withDelay = false) {

def xpackCiGroupProcess(ciGroup, withDelay = false) {
return functionalTestProcess("xpack-ciGroup" + ciGroup) {
if (withDelay) {
if (withDelay && !(ciGroup instanceof String) && !(ciGroup instanceof GString)) {
sleep((ciGroup-1)*30) // smooth out CPU spikes from ES startup
}
withEnv([
Expand Down Expand Up @@ -294,11 +294,36 @@ def buildOss(maxWorkers = '') {
}
}

def buildXpack(maxWorkers = '') {
def getBuildArtifactBucket() {
def dir = env.ghprbPullId ? "pr-${env.ghprbPullId}" : buildState.get('checkoutInfo').branch.replace("/", "__")
return "gs://ci-artifacts.kibana.dev/default-build/${dir}/${buildState.get('checkoutInfo').commit}"
}

def buildXpack(maxWorkers = '', uploadArtifacts = false) {
notifyOnError {
withEnv(["KBN_OPTIMIZER_MAX_WORKERS=${maxWorkers}"]) {
runbld("./test/scripts/jenkins_xpack_build_kibana.sh", "Build X-Pack Kibana")
}

if (uploadArtifacts) {
withGcpServiceAccount.fromVaultSecret('secret/kibana-issues/dev/ci-artifacts-key', 'value') {
bash("""
cd "${env.WORKSPACE}"
gsutil -q -m cp 'kibana-default.tar.gz' '${getBuildArtifactBucket()}/'
gsutil -q -m cp 'kibana-default-plugins.tar.gz' '${getBuildArtifactBucket()}/'
""", "Upload Default Build artifacts to GCS")
}
}
}
}

def downloadDefaultBuildArtifacts() {
withGcpServiceAccount.fromVaultSecret('secret/kibana-issues/dev/ci-artifacts-key', 'value') {
bash("""
cd "${env.WORKSPACE}"
gsutil -q -m cp '${getBuildArtifactBucket()}/kibana-default.tar.gz' ./
gsutil -q -m cp '${getBuildArtifactBucket()}/kibana-default-plugins.tar.gz' ./
""", "Download Default Build artifacts from GCS")
}
}

Expand Down
18 changes: 17 additions & 1 deletion vars/tasks.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ def xpackCiGroups() {
tasks(ciGroups.collect { kibanaPipeline.xpackCiGroupProcess(it, true) })
}

def xpackCiGroupDocker() {
task {
workers.ci(name: 'xpack-cigroups-docker', size: 'm', ramDisk: true) {
kibanaPipeline.downloadDefaultBuildArtifacts()
kibanaPipeline.bash("""
cd '${env.WORKSPACE}'
mkdir -p kibana-build-xpack
tar -xzf kibana-default.tar.gz -C kibana-build-xpack --strip=1
tar -xzf kibana-default-plugins.tar.gz -C kibana
""", "Extract Default Build artifacts")
kibanaPipeline.xpackCiGroupProcess('Docker', true)()
}
}
}

def functionalOss(Map params = [:]) {
def config = params ?: [
serverIntegration: true,
Expand Down Expand Up @@ -100,10 +115,11 @@ def functionalXpack(Map params = [:]) {
]

task {
kibanaPipeline.buildXpack(10)
kibanaPipeline.buildXpack(10, true)

if (config.ciGroups) {
xpackCiGroups()
xpackCiGroupDocker()
}

if (config.firefox) {
Expand Down
2 changes: 2 additions & 0 deletions vars/workers.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def label(size) {
return 'docker && linux && immutable'
case 's-highmem':
return 'docker && tests-s'
case 'm':
return 'docker && linux && immutable && gobld/machineType:n2-standard-8'
case 'm-highmem':
return 'docker && linux && immutable && gobld/machineType:n1-highmem-8'
case 'l':
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/fleet_api_integration/apis/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

export default function ({ loadTestFile }) {
describe('Fleet Endpoints', function () {
this.tags('ciGroup10');
this.tags('ciGroupDocker');
// EPM
loadTestFile(require.resolve('./epm/index'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default function (providerContext: FtrProviderContext) {
const { loadTestFile, getService } = providerContext;

describe('endpoint', function () {
this.tags('ciGroup7');
this.tags('ciGroupDocker');
const ingestManager = getService('ingestManager');
const log = getService('log');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function endpointAPIIntegrationTests(providerContext: FtrProvider
describe('Endpoint plugin', function () {
const ingestManager = getService('ingestManager');

this.tags('ciGroup7');
this.tags('ciGroupDocker');
const log = getService('log');

if (!isRegistryEnabled()) {
Expand Down

0 comments on commit f98c2a2

Please sign in to comment.