Skip to content

Commit

Permalink
Merge branch 'master' into cloud-deployment-link
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Jun 23, 2020
2 parents 25a5d6d + 1ad1879 commit 2c71ab3
Show file tree
Hide file tree
Showing 2,984 changed files with 135,041 additions and 112,776 deletions.
12 changes: 8 additions & 4 deletions .ci/end2end.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pipeline {
}
}
steps{
notifyStatus('Running smoke tests', 'PENDING')
notifyTestStatus('Running smoke tests', 'PENDING')
dir("${BASE_DIR}"){
sh "${E2E_DIR}/ci/run-e2e.sh"
}
Expand All @@ -95,10 +95,10 @@ pipeline {
}
}
unsuccessful {
notifyStatus('Test failures', 'FAILURE')
notifyTestStatus('Test failures', 'FAILURE')
}
success {
notifyStatus('Tests passed', 'SUCCESS')
notifyTestStatus('Tests passed', 'SUCCESS')
}
}
}
Expand All @@ -113,5 +113,9 @@ pipeline {
}

def notifyStatus(String description, String status) {
withGithubNotify.notify('end2end-for-apm-ui', description, status, getBlueoceanDisplayURL())
withGithubNotify.notify('end2end-for-apm-ui', description, status, getBlueoceanTabURL('pipeline'))
}

def notifyTestStatus(String description, String status) {
withGithubNotify.notify('end2end-for-apm-ui', description, status, getBlueoceanTabURL('tests'))
}
58 changes: 2 additions & 56 deletions .ci/packer_cache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,5 @@

set -e

branch="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"

# run setup script that gives us node, yarn, and bootstraps the project
source src/dev/ci_setup/setup.sh;

# download es snapshots
node scripts/es snapshot --download-only;
node scripts/es snapshot --license=oss --download-only;

# download reporting browsers
(cd "x-pack" && yarn gulp prepare);

# cache the chromedriver archive
chromedriverDistVersion="$(node -e "console.log(require('chromedriver').version)")"
chromedriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.chromedriver)")"
if [ -z "$chromedriverDistVersion" ] || [ -z "$chromedriverPkgVersion" ]; then
echo "UNABLE TO DETERMINE CHROMEDRIVER VERSIONS"
exit 1
fi
mkdir -p .chromedriver
curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion

# cache the geckodriver archive
geckodriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.geckodriver)")"
if [ -z "$geckodriverPkgVersion" ]; then
echo "UNABLE TO DETERMINE geckodriver VERSIONS"
exit 1
fi
mkdir -p ".geckodriver"
cp "node_modules/geckodriver/geckodriver.tar.gz" .geckodriver/geckodriver.tar.gz
echo "$geckodriverPkgVersion" > .geckodriver/pkgVersion

echo "Creating bootstrap_cache archive"

# archive cacheable directories
mkdir -p "$HOME/.kibana/bootstrap_cache"
tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
x-pack/plugins/reporting/.chromium \
.es \
.chromedriver \
.geckodriver;

echo "Adding node_modules"
# Find all of the node_modules directories that aren't test fixtures, and aren't inside other node_modules directories, and append them to the tar
find . -type d -name node_modules -not -path '*__fixtures__*' -prune -print0 | xargs -0I % tar -rf "$HOME/.kibana/bootstrap_cache/$branch.tar" "%"

echo "created $HOME/.kibana/bootstrap_cache/$branch.tar"

if [ "$branch" == "master" ]; then
echo "Creating bootstrap cache for 7.x";

git clone https://github.com/elastic/kibana.git --branch 7.x --depth 1 /tmp/kibana-7.x
(cd /tmp/kibana-7.x && ./.ci/packer_cache.sh);
rm -rf /tmp/kibana-7.x;
fi
./.ci/packer_cache_for_branch.sh master
./.ci/packer_cache_for_branch.sh 7.x
62 changes: 62 additions & 0 deletions .ci/packer_cache_for_branch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash

set -e

branch="$1"
checkoutDir="$(pwd)"

if [[ "$branch" != "master" ]]; then
checkoutDir="/tmp/kibana-$branch"
git clone https://github.com/elastic/kibana.git --branch "$branch" --depth 1 "$checkoutDir"
cd "$checkoutDir"
fi

source src/dev/ci_setup/setup.sh;

# download es snapshots
node scripts/es snapshot --download-only;
node scripts/es snapshot --license=oss --download-only;

# download reporting browsers
(cd "x-pack" && yarn gulp prepare);

# cache the chromedriver archive
chromedriverDistVersion="$(node -e "console.log(require('chromedriver').version)")"
chromedriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.chromedriver)")"
if [ -z "$chromedriverDistVersion" ] || [ -z "$chromedriverPkgVersion" ]; then
echo "UNABLE TO DETERMINE CHROMEDRIVER VERSIONS"
exit 1
fi
mkdir -p .chromedriver
curl "https://chromedriver.storage.googleapis.com/$chromedriverDistVersion/chromedriver_linux64.zip" > .chromedriver/chromedriver.zip
echo "$chromedriverPkgVersion" > .chromedriver/pkgVersion

# cache the geckodriver archive
geckodriverPkgVersion="$(node -e "console.log(require('./package.json').devDependencies.geckodriver)")"
if [ -z "$geckodriverPkgVersion" ]; then
echo "UNABLE TO DETERMINE geckodriver VERSIONS"
exit 1
fi
mkdir -p ".geckodriver"
cp "node_modules/geckodriver/geckodriver.tar.gz" .geckodriver/geckodriver.tar.gz
echo "$geckodriverPkgVersion" > .geckodriver/pkgVersion

echo "Creating bootstrap_cache archive"

# archive cacheable directories
mkdir -p "$HOME/.kibana/bootstrap_cache"
tar -cf "$HOME/.kibana/bootstrap_cache/$branch.tar" \
x-pack/plugins/reporting/.chromium \
.es \
.chromedriver \
.geckodriver;

echo "Adding node_modules"
# Find all of the node_modules directories that aren't test fixtures, and aren't inside other node_modules directories, and append them to the tar
find . -type d -name node_modules -not -path '*__fixtures__*' -prune -print0 | xargs -0I % tar -rf "$HOME/.kibana/bootstrap_cache/$branch.tar" "%"

echo "created $HOME/.kibana/bootstrap_cache/$branch.tar"

if [[ "$branch" != "master" ]]; then
rm --preserve-root -rf "$checkoutDir"
fi
8 changes: 8 additions & 0 deletions .ci/pipeline-library/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Kibana Jenkins Pipeline Library

## Running tests

```bash
cd .ci/pipeline-library
./gradlew test
```
46 changes: 46 additions & 0 deletions .ci/pipeline-library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
plugins {
id 'groovy'
id 'idea'
}

group = 'co.elastic.kibana.pipeline'
version = '0.0.1'

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
maven { url 'https://repo.jenkins-ci.org/releases/' }
maven { url 'https://repo.maven.apache.org/maven2' }
}

dependencies {
implementation 'org.codehaus.groovy:groovy-all:2.4.12'
implementation 'org.jenkins-ci.main:jenkins-core:2.23'
implementation 'org.jenkins-ci.plugins.workflow:workflow-step-api:2.19@jar'
testImplementation 'com.lesfurets:jenkins-pipeline-unit:1.4'
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:2.+'
testImplementation 'org.assertj:assertj-core:3.15+' // Temporary https://github.com/jenkinsci/JenkinsPipelineUnit/issues/209
}

sourceSets {
main {
groovy {
srcDirs = ['vars']
}
}

test {
groovy {
srcDirs = ['src/test']
}
}
}

test {
testLogging {
events 'passed', 'skipped', 'failed'
exceptionFormat = 'full'
}
}
Binary file not shown.
5 changes: 5 additions & 0 deletions .ci/pipeline-library/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 2c71ab3

Please sign in to comment.