Skip to content

Commit 0187a62

Browse files
committed
Add scheduled CI job to update staging artifact when dependencies change
1 parent dc17b09 commit 0187a62

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
- job:
3+
name: elastic+elasticsearch+%BRANCH%+dra-staging-update
4+
display-name: "elastic / elasticsearch # %BRANCH% - DRA staging update"
5+
description: "Scheduled job to check for staging dependency updates"
6+
node: master
7+
triggers:
8+
- timed: "*/30 * * * *"
9+
builders:
10+
- conditional-step:
11+
condition-kind: shell
12+
condition-command: |
13+
#!/usr/bin/env bash
14+
set -o pipefail
15+
RM_BRANCH="%BRANCH%" && [[ "%BRANCH%" == "main" ]] && RM_BRANCH=master
16+
BEATS_MANIFEST=$(curl -sS https://artifacts-staging.elastic.co/beats/latest/${RM_BRANCH}.json | jq -r '.manifest_url')
17+
ML_MANIFEST=$(curl -sS https://artifacts-staging.elastic.co/ml-cpp/latest/${RM_BRANCH}.json | jq -r '.manifest_url')
18+
ES_MANIFEST=$(curl -sS https://artifacts-staging.elastic.co/elasticsearch/latest/${RM_BRANCH}.json | jq -r '.manifest_url')
19+
ES_BEATS_DEPENDENCY=$(curl -sS $ES_MANIFEST | jq -r '.projects.elasticsearch.dependencies[] | select(.prefix == "beats") | .build_uri')
20+
ES_ML_DEPENDENCY=$(curl -sS $ES_MANIFEST | jq -r '.projects.elasticsearch.dependencies[] | select(.prefix == "ml-cpp") | .build_uri')
21+
22+
if [ "$BEATS_MANIFEST" = "$ES_BEATS_DEPENDENCY" ]; then
23+
echo "ES has the latest beats"
24+
else
25+
echo "Need to trigger a build, $BEATS_MANIFEST available but ES has $ES_BEATS_DEPENDENCY"
26+
exit 0
27+
fi
28+
29+
if [ "$ML_MANIFEST" = "$ES_ML_DEPENDENCY" ]; then
30+
echo "ES has the latest ml-cpp"
31+
else
32+
echo "Need to trigger a build, $ML_MANIFEST available but ES has $ES_ML_DEPENDENCY"
33+
exit 0
34+
fi
35+
36+
# A non-zero exit value means the trigger step will be skipped
37+
exit 1
38+
steps:
39+
- trigger-builds:
40+
- project: "elastic+elasticsearch+%BRANCH%+triggers/elastic+elasticsearch+%BRANCH%+dra-staging-trigger"
41+
current-parameters: false
42+
git-revision: false

0 commit comments

Comments
 (0)