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] 2.0 pipeline for 6.8 #21859

Merged
merged 53 commits into from
Oct 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
733b8b7
cherry-pick aad07ad22fdba8c9c7a145dbe3c8b28a943b083a
v1v Oct 15, 2020
a88d5be
Add stages to Jenkins pipeline (#14484)
kuisathaverat Nov 27, 2019
d03edcc
ci: avoid to modify go.mod file (#16842)
kuisathaverat Mar 6, 2020
10667d3
Ensure install scripts only install if needed (#20349)
cachedout Aug 4, 2020
b431752
ci: fix warnings with wildcards and archive system-tests (#18695)
v1v Jul 20, 2020
68c62ae
[CI] use ubuntu-16 and no macosx builds
v1v Oct 16, 2020
ea98d86
[CI] support generator
v1v Oct 16, 2020
7d298af
Windows builds with mage fields build goTestUnit
v1v Oct 16, 2020
ee423e8
Linux builds with RACE_DETECTOR=1 make -C <folder> clean check testsuite
v1v Oct 16, 2020
ea4aa1e
REmove bits that are not part of the 6.8
v1v Oct 16, 2020
4f83202
Enable crosscompiles
v1v Oct 16, 2020
4568ce9
ci: run test on Windows (#15570)
kuisathaverat Feb 7, 2020
a3f0537
[CI] fail if not possible to install python3 (#19164)
v1v Jun 15, 2020
291f186
[CI] Unnecessary from a merge
v1v Oct 19, 2020
142c70a
[CI] lint stage doesn't produce test reports (#21888)
v1v Oct 16, 2020
aef0ef0
[CI] Add stage name in the step (#21887)
v1v Oct 16, 2020
97415f3
[CI] kind setup fails sometimes (#21857)
v1v Oct 16, 2020
b51a219
[CI] Support k8s with minikube
v1v Oct 19, 2020
1b98a74
[CI] refactor runbld post build action (#21256)
v1v Sep 28, 2020
5944376
[CI] Archive build reasons (#21347)
v1v Sep 29, 2020
f902c0d
[CI] Fix runbld when workspace does not exist (#21350)
v1v Sep 29, 2020
daa264b
[CI] Send slack message with build status (#21428)
v1v Oct 2, 2020
84113e4
[CI] Setup git config globally (#21562)
v1v Oct 6, 2020
0ab2919
[CI] unnecessary stash from a merge conflict
v1v Oct 19, 2020
c6bc487
[CI] fix 'no matches found within 10000' (#21466)
v1v Oct 5, 2020
7fd1dc8
[CI] Change notification channel (#21559)
v1v Oct 7, 2020
d7d1491
[CI] Support skip-ci label (#21377)
v1v Oct 14, 2020
4c4534d
[BUILD][CI] fetch dependencies with retry (#21614)
v1v Oct 15, 2020
6cad10b
[CI] fix merge conflict
v1v Oct 19, 2020
92e0a77
Installed with another script
v1v Oct 19, 2020
aed5d86
Disable cloud and k8s in 2.0
v1v Oct 19, 2020
d5351ea
Fix typo in the clean make goal
v1v Oct 19, 2020
18c107d
Skip clean and use integration-tests-environment
v1v Oct 19, 2020
68929c9
no integration tests for journalbeat
v1v Oct 19, 2020
a27eb00
Support existing ps1 file
v1v Oct 19, 2020
fcd389c
Merge remote-tracking branch 'upstream/6.8' into feature/ci-2.0-6.8
v1v Oct 22, 2020
a82fb0f
Disable x-pack/metricbeat in linux since build is broken https://gith…
v1v Oct 22, 2020
fcf5fba
Disable tests for windows in auditbeat. See https://github.com/elasti…
v1v Oct 22, 2020
9241cb9
Disable integration testing for libbeat. See https://github.com/elast…
v1v Oct 22, 2020
3213d4d
Disable integration testing for metricbeat. See https://github.com/el…
v1v Oct 22, 2020
cf4d33b
Merge remote-tracking branch 'upstream/6.8' into feature/ci-2.0-6.8
v1v Oct 29, 2020
244ff31
Disable windows build for auditbeat
v1v Oct 29, 2020
5199ca9
Disable build for libbeat
v1v Oct 29, 2020
d1112a5
Disable build for metricbeat
v1v Oct 29, 2020
d5239e0
Disable windows build for metricbeat
v1v Oct 29, 2020
91a9af8
Disable build for x-pack/metricbeat
v1v Oct 29, 2020
be5d9c2
Disable windows build for x-pack/winlogbeat
v1v Oct 29, 2020
55f03d6
Disable windows build for x-pack/filebeat
v1v Oct 29, 2020
d8ff4c6
integration-tests-environment is not available for x-pack/filebeat
v1v Oct 29, 2020
6d3acae
integration-tests-environment is not available for winlogbeat
v1v Oct 29, 2020
bcd6d51
integration-tests-environment is not available for packetbeat
v1v Oct 29, 2020
05061e6
Build not available for x-pack/metricbeats in 6.8
v1v Oct 29, 2020
bc1311b
Cherry-pick 96c60d0a833497b1814788c1f362457f376bf9b0
v1v Oct 29, 2020
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
52 changes: 52 additions & 0 deletions .ci/scripts/generate_build_table.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env python3

import os
import yaml

if __name__ == "__main__":

print("| Beat | Stage | Command | MODULE | Platforms | When |")
print("|-------|--------|----------|---------|------------|------|")
for root, dirs, files in os.walk("."):
dirs.sort()
for file in files:
if file.endswith("Jenkinsfile.yml") and root != ".":
with open(os.path.join(root, file), 'r') as f:
doc = yaml.load(f, Loader=yaml.FullLoader)
module = root.replace(".{}".format(os.sep), '')
platforms = [doc["platform"]]
when = ""
if "branches" in doc["when"]:
when = f"{when}/:palm_tree:"
if "changeset" in doc["when"]:
when = f"{when}/:file_folder:"
if "comments" in doc["when"]:
when = f"{when}/:speech_balloon:"
if "labels" in doc["when"]:
when = f"{when}/:label:"
if "parameters" in doc["when"]:
when = f"{when}/:smiley:"
if "tags" in doc["when"]:
when = f"{when}/:taco:"
for stage in doc["stages"]:
withModule = False
if "make" in doc["stages"][stage]:
command = doc["stages"][stage]["make"]
if "mage" in doc["stages"][stage]:
command = doc["stages"][stage]["mage"]
if "platforms" in doc["stages"][stage]:
platforms = doc["stages"][stage]["platforms"]
if "withModule" in doc["stages"][stage]:
withModule = doc["stages"][stage]["withModule"]
if "when" in doc["stages"][stage]:
when = f"{when}/:star:"
print("| {} | {} | `{}` | {} | `{}` | {} |".format(
module, stage, command, withModule, platforms, when))

print("> :palm_tree: -> Git Branch based")
print("> :label: -> GitHub Pull Request Label based")
print("> :file_folder: -> Changeset based")
print("> :speech_balloon: -> GitHub Pull Request comment based")
print("> :taco: -> Git tag based")
print("> :smiley: -> Manual UI interaction based")
print("> :star: -> More specific cases based")
16 changes: 16 additions & 0 deletions .ci/scripts/get-vendor-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
#
# Given the go module it will list all the dependencies that will be later on
# used by the CI to enable/disable specific stages as long as the changeset
# matches any of those patterns.
#

GO_VERSION=${GO_VERSION:?"GO_VERSION environment variable is not set"}
BEATS=${1:?"parameter missing."}
eval "$(gvm "${GO_VERSION}")"

go list -deps ./"${BEATS}" \
| grep 'elastic/beats' \
| sort \
| sed -e "s#github.com/elastic/beats/v7/##g" \
| awk '{print "^" $1 "/.*"}'
27 changes: 27 additions & 0 deletions .ci/scripts/install-docker-compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -exuo pipefail

MSG="environment variable missing: DOCKER_COMPOSE_VERSION."
DOCKER_COMPOSE_VERSION=${DOCKER_COMPOSE_VERSION:?$MSG}
HOME=${HOME:?$MSG}

if command -v docker-compose
then
echo "Found docker-compose. Checking version.."
FOUND_DOCKER_COMPOSE_VERSION=$(docker-compose --version|awk '{print $3}'|sed s/\,//)
if [ $FOUND_DOCKER_COMPOSE_VERSION == $DOCKER_COMPOSE_VERSION ]
then
echo "Versions match. No need to install docker-compose. Exiting."
exit 0
fi
fi

echo "UNMET DEP: Installing docker-compose"

DC_CMD="${HOME}/bin/docker-compose"

mkdir -p "${HOME}/bin"

curl -sSLo "${DC_CMD}" "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)"
chmod +x "${DC_CMD}"
30 changes: 30 additions & 0 deletions .ci/scripts/install-go.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -exuo pipefail

MSG="environment variable missing"
GO_VERSION=${GO_VERSION:?$MSG}
PROPERTIES_FILE=${PROPERTIES_FILE:-"go_env.properties"}
HOME=${HOME:?$MSG}
ARCH=$(uname -s| tr '[:upper:]' '[:lower:]')
GVM_CMD="${HOME}/bin/gvm"

if command -v go
then
echo "Found Go. Checking version.."
FOUND_GO_VERSION=$(go version|awk '{print $3}'|sed s/go//)
if [ $FOUND_GO_VERSION == $GO_VERSION ]
then
echo "Versions match. No need to install Go. Exiting."
exit 0
fi
fi

echo "UNMET DEP: Installing Go"
mkdir -p "${HOME}/bin"

curl -sSLo "${GVM_CMD}" "https://github.com/andrewkroh/gvm/releases/download/v0.2.1/gvm-${ARCH}-amd64"
chmod +x "${GVM_CMD}"

gvm ${GO_VERSION}|cut -d ' ' -f 2|tr -d '\"' > ${PROPERTIES_FILE}

eval $(gvm ${GO_VERSION})
26 changes: 26 additions & 0 deletions .ci/scripts/install-kind.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -exuo pipefail

MSG="environment variable missing."
DEFAULT_HOME="/usr/local"
KIND_VERSION=${KIND_VERSION:?$MSG}
HOME=${HOME:?$DEFAULT_HOME}
KIND_CMD="${HOME}/bin/kind"

if command -v kind
then
echo "Found Kind. Checking version.."
FOUND_KIND_VERSION=$(kind --version 2>&1 >/dev/null | awk '{print $3}')
if [ $FOUND_KIND_VERSION == $KIND_VERSION ]
then
echo "Versions match. No need to install Kind. Exiting."
exit 0
fi
fi

echo "UNMET DEP: Installing Kind"

mkdir -p "${HOME}/bin"

curl -sSLo "${KIND_CMD}" "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64"
chmod +x "${KIND_CMD}"
31 changes: 31 additions & 0 deletions .ci/scripts/install-terraform.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

set -exuo pipefail

MSG="environment variable missing."
TERRAFORM_VERSION=${TERRAFORM_VERSION:?$MSG}
HOME=${HOME:?$MSG}
TERRAFORM_CMD="${HOME}/bin/terraform"

OS=$(uname -s | tr '[:upper:]' '[:lower:]')

if command -v terraform
then
echo "Found Terraform. Checking version.."
FOUND_TERRAFORM_VERSION=$(terraform --version | awk '{print $2}' | sed s/v//)
if [ $FOUND_TERRAFORM_VERSION == $TERRAFORM_VERSION ]
then
echo "Versions match. No need to install Terraform. Exiting."
exit 0
fi
fi

echo "UNMET DEP: Installing Terraform"

mkdir -p "${HOME}/bin"

curl -sSLo - "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${OS}_amd64.zip" > ${TERRAFORM_CMD}.zip
unzip -o ${TERRAFORM_CMD}.zip -d $(dirname ${TERRAFORM_CMD})
rm ${TERRAFORM_CMD}.zip

chmod +x "${TERRAFORM_CMD}"
25 changes: 25 additions & 0 deletions .ci/scripts/install-tools.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
set GOPATH=%WORKSPACE%
set MAGEFILE_CACHE=%WORKSPACE%\.magefile
set PATH=%WORKSPACE%\bin;C:\ProgramData\chocolatey\bin;%PATH%

where /q curl
IF ERRORLEVEL 1 (
choco install curl -y --no-progress --skipdownloadcache
)
mkdir %WORKSPACE%\bin
where /q gvm
IF ERRORLEVEL 1 (
curl -sL -o %WORKSPACE%\bin\gvm.exe https://github.com/andrewkroh/gvm/releases/download/v0.2.1/gvm-windows-amd64.exe
)
FOR /f "tokens=*" %%i IN ('"gvm.exe" use %GO_VERSION% --format=batch') DO %%i

go install github.com/elastic/beats/vendor/github.com/magefile/mage
mage -version
where mage

if not exist C:\Python38\python.exe (
REM Install python 3.8.
choco install python -y -r --no-progress --version 3.8.2 || echo ERROR && exit /b
)
python --version
where python
7 changes: 7 additions & 0 deletions .ci/scripts/install-tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -exuo pipefail

.ci/scripts/install-go.sh
.ci/scripts/install-docker-compose.sh
.ci/scripts/install-terraform.sh
make mage
18 changes: 18 additions & 0 deletions .ci/scripts/kind-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -exuo pipefail

MSG="parameter missing."
K8S_VERSION=${K8S_VERSION:?$MSG}
HOME=${HOME:?$MSG}
KBC_CMD="${HOME}/bin/kubectl"

mkdir -p "${HOME}/bin"

curl -sSLo "${KBC_CMD}" "https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl"
chmod +x "${KBC_CMD}"

GO111MODULE="on" go get sigs.k8s.io/kind@v0.5.1
kind create cluster --image kindest/node:${K8S_VERSION}

export KUBECONFIG="$(kind get kubeconfig-path)"
kubectl cluster-info
33 changes: 33 additions & 0 deletions .ci/scripts/minikube-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -exuo pipefail

MSG="parameter missing."
K8S_VERSION=${K8S_VERSION:?$MSG}
MINIKUBE_VERSION=${MINIKUBE_VERSION:?$MSG}
HOME=${HOME:?$MSG}

KBC_CMD="${HOME}/bin/kubectl"
MKB_CMD="${HOME}/bin/minikube"

export CHANGE_MINIKUBE_NONE_USER=true

mkdir -p "${HOME}/bin"

curl -sSLo "${KBC_CMD}" "https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl"
chmod +x "${KBC_CMD}"

curl -sSLo "${MKB_CMD}" "https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64"
chmod +x "${MKB_CMD}"

mkdir -p "${HOME}/.kube" "${HOME}/.minikube"
touch "${HOME}/.kube/config"

minikube start --vm-driver=none --kubernetes-version=${K8S_VERSION} --logtostderr
minikube update-context

JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}'
until kubectl get nodes -o jsonpath="${JSONPATH}" 2>&1 | grep -q "Ready=True"
do
echo "waiting for Minikube..."
sleep 5
done
20 changes: 20 additions & 0 deletions .ci/scripts/pre_archive_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3

import os
import distutils
from distutils import dir_util


if __name__ == "__main__":

if not os.path.exists('build'):
os.makedirs('build')

# Top level folders to be excluded
EXCLUDE = set(['.ci', '.git', '.github', 'vendor', 'dev-tools'])
for root, dirs, files in os.walk('.'):
dirs[:] = [d for d in dirs if d not in EXCLUDE]
if root.endswith(('build')) and not root.startswith((".{}build".format(os.sep))):
dest = os.path.join('build', root.replace(".{}".format(os.sep), ''))
print("Copy {} into {}".format(root, dest))
distutils.dir_util.copy_tree(root, dest, preserve_symlinks=1)
10 changes: 10 additions & 0 deletions .ci/scripts/search_system_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

import os


if __name__ == "__main__":

for root, dirs, files in os.walk('build'):
if root.endswith(('system-tests')):
print(root.replace(".{}".format(os.sep), ''))
Loading