Skip to content

Commit aad07ad

Browse files
authored
[CI] Pipeline 2.0 for monorepos (elastic#20104)
1 parent a9db1b1 commit aad07ad

File tree

26 files changed

+1070
-1259
lines changed

26 files changed

+1070
-1259
lines changed

.ci/jobs/beats-mbp-2.0.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import yaml
5+
6+
if __name__ == "__main__":
7+
8+
print("| Beat | Stage | Command | MODULE | Platforms | When |")
9+
print("|-------|--------|----------|---------|------------|------|")
10+
for root, dirs, files in os.walk("."):
11+
dirs.sort()
12+
for file in files:
13+
if file.endswith("Jenkinsfile.yml") and root != ".":
14+
with open(os.path.join(root, file), 'r') as f:
15+
doc = yaml.load(f, Loader=yaml.FullLoader)
16+
module = root.replace(".{}".format(os.sep), '')
17+
platforms = [doc["platform"]]
18+
when = ""
19+
if "branches" in doc["when"]:
20+
when = f"{when}/:palm_tree:"
21+
if "changeset" in doc["when"]:
22+
when = f"{when}/:file_folder:"
23+
if "comments" in doc["when"]:
24+
when = f"{when}/:speech_balloon:"
25+
if "labels" in doc["when"]:
26+
when = f"{when}/:label:"
27+
if "parameters" in doc["when"]:
28+
when = f"{when}/:smiley:"
29+
if "tags" in doc["when"]:
30+
when = f"{when}/:taco:"
31+
for stage in doc["stages"]:
32+
withModule = False
33+
if "make" in doc["stages"][stage]:
34+
command = doc["stages"][stage]["make"]
35+
if "mage" in doc["stages"][stage]:
36+
command = doc["stages"][stage]["mage"]
37+
if "platforms" in doc["stages"][stage]:
38+
platforms = doc["stages"][stage]["platforms"]
39+
if "withModule" in doc["stages"][stage]:
40+
withModule = doc["stages"][stage]["withModule"]
41+
if "when" in doc["stages"][stage]:
42+
when = f"{when}/:star:"
43+
print("| {} | {} | `{}` | {} | `{}` | {} |".format(
44+
module, stage, command, withModule, platforms, when))
45+
46+
print("> :palm_tree: -> Git Branch based")
47+
print("> :label: -> GitHub Pull Request Label based")
48+
print("> :file_folder: -> Changeset based")
49+
print("> :speech_balloon: -> GitHub Pull Request comment based")
50+
print("> :taco: -> Git tag based")
51+
print("> :smiley: -> Manual UI interaction based")
52+
print("> :star: -> More specific cases based")
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Given the go module it will list all the dependencies that will be later on
4+
# used by the CI to enable/disable specific stages as long as the changeset
5+
# matches any of those patterns.
6+
#
7+
8+
GO_VERSION=${GO_VERSION:?"GO_VERSION environment variable is not set"}
9+
BEATS=${1:?"parameter missing."}
10+
eval "$(gvm "${GO_VERSION}")"
11+
12+
go list -deps ./"${BEATS}" \
13+
| grep 'elastic/beats' \
14+
| sort \
15+
| sed -e "s#github.com/elastic/beats/v7/##g" \
16+
| awk '{print "^" $1 "/.*"}'

.ci/scripts/install-tools.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
set -exuo pipefail
3+
4+
.ci/scripts/install-go.sh
5+
.ci/scripts/install-docker-compose.sh
6+
.ci/scripts/install-terraform.sh
7+
make mage

0 commit comments

Comments
 (0)