-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[Buildkite] Add daily pipeline to check for new jdk ea build #134118
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
steps: | ||
- command: .buildkite/scripts/trigger-if-java-ea-new-build.sh | ||
env: | ||
RECENT_TIME_WINDOW: "24" # time window to consider a build as new in hours | ||
agents: | ||
image: "docker.elastic.co/ci-agent-images/eck-region/buildkite-agent:1.5" | ||
memory: "4G" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# | ||
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
# or more contributor license agreements. Licensed under the "Elastic License | ||
# 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
# Public License v 1"; you may not use this file except in compliance with, at | ||
# your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
# License v3.0 only", or the "Server Side Public License, v 1". | ||
# | ||
|
||
#!/bin/bash | ||
|
||
# Allow overriding the time window (in hours) to check for new builds, defaults to 24 | ||
RECENT_TIME_WINDOW=${RECENT_TIME_WINDOW:-24} | ||
|
||
# Extract current JDK major version from bundled_jdk in version.properties | ||
CURRENT_JDK=$(grep "^bundled_jdk =" build-tools-internal/version.properties | cut -d'=' -f2 | tr -d ' ' | cut -d'.' -f1) | ||
TARGET_JDK=$((CURRENT_JDK + 1)) | ||
|
||
echo "Current JDK major version: $CURRENT_JDK" | ||
echo "Target JDK major version: $TARGET_JDK" | ||
|
||
# Query Elasticsearch JDK archive for available JDKs | ||
JDK_ARCHIVE_URL="https://builds.es-jdk-archive.com/jdks/openjdk/recent.json" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using the recent.json here and not the latest.json as latest.json does not seem to have RCs in them. cc @brianseeders There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are currently parsing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the date in the archive reflects when we archived it. Usually it should be within 24h as we usually check once per day. The timestamp for the rc36 is late as we added support for RC versions after 36 was already available. therefore the gap. I don't see too much need for you to migrate other than the json api and the option to resolve older RCs / EAs and not just the newest available. |
||
echo "Querying JDK archive: $JDK_ARCHIVE_URL" | ||
|
||
# Fetch JDK info and filter for target major version | ||
JDK_DATA=$(curl -s "$JDK_ARCHIVE_URL") | ||
|
||
if [[ -z "$JDK_DATA" ]]; then | ||
echo "Failed to fetch JDK data from archive" | ||
exit 1 | ||
fi | ||
|
||
# Find the latest build for the target JDK version | ||
LATEST_BUILD=$(echo "$JDK_DATA" | jq -r --arg target "$TARGET_JDK" ' | ||
.majors[$target].builds | | ||
sort_by(.archived_at) | | ||
last' | ||
) | ||
|
||
if [[ "$LATEST_BUILD" == "null" || -z "$LATEST_BUILD" ]]; then | ||
echo "No builds found for JDK $TARGET_JDK" | ||
exit 1 | ||
fi | ||
|
||
# Extract timestamp and JDK identifier | ||
TIMESTAMP=$(echo "$LATEST_BUILD" | jq -r '.archived_at') | ||
JDK_IDENTIFIER=$(echo "$LATEST_BUILD" | jq -r '.id') | ||
|
||
echo "Latest JDK ${TARGET_JDK} build from ES archive:" | ||
echo " Timestamp: $TIMESTAMP" | ||
echo " JDK Identifier: $JDK_IDENTIFIER" | ||
|
||
# Set variables for use in the pipeline trigger | ||
jdkbuild="$JDK_IDENTIFIER" | ||
jdk_timestamp="$TIMESTAMP" | ||
|
||
# Check if timestamp is within last 24 hours | ||
CURRENT_TIME=$(date +%s) | ||
BUILD_TIME=$(date -d "$TIMESTAMP" +%s 2>/dev/null || date -j -f "%Y-%m-%dT%H:%M:%S" "${TIMESTAMP%Z}" +%s 2>/dev/null || echo "0") | ||
|
||
if [[ "$BUILD_TIME" == "0" ]]; then | ||
echo "Failed to parse timestamp: $TIMESTAMP" | ||
SHOULD_TRIGGER="false" | ||
else | ||
TIME_DIFF=$((CURRENT_TIME - BUILD_TIME)) | ||
TIME_WINDOW=$((RECENT_TIME_WINDOW * 60 * 60)) | ||
|
||
if [[ $TIME_DIFF -lt $TIME_WINDOW ]]; then | ||
echo "Build is recent (less than ${RECENT_TIME_WINDOW}h old)" | ||
SHOULD_TRIGGER="true" | ||
else | ||
echo "Build is older than ${RECENT_TIME_WINDOW} hours" | ||
SHOULD_TRIGGER="false" | ||
fi | ||
fi | ||
|
||
echo "SHOULD_TRIGGER: $SHOULD_TRIGGER" | ||
|
||
# Format BUILD_TIME as ISO 8601 for EFFECTIVE_START_DATE env in ES BENCH pipeline | ||
if [[ "$BUILD_TIME" != "0" ]]; then | ||
EFFECTIVE_START_DATE=$(date -u -d "@$BUILD_TIME" +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u -r "$BUILD_TIME" +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || echo "") | ||
else | ||
EFFECTIVE_START_DATE="" | ||
fi | ||
gbanasiak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
|
||
if [[ "$SHOULD_TRIGGER" == "true" ]]; then | ||
echo "Triggering performance-esbench-jdk for new jdk build $JDK_IDENTIFIER" | ||
cat << EOF | buildkite-agent pipeline upload | ||
steps: | ||
- trigger: elasticsearch-performance-esbench-jdk | ||
label: Triggering performance-esbench-jdk for new jdk build $JDK_IDENTIFIER | ||
async: true | ||
build: | ||
branch: "$BUILDKITE_BRANCH" | ||
env: | ||
EFFECTIVE_START_DATE: "$EFFECTIVE_START_DATE" | ||
EXECUTION_MODE: "start-test" | ||
gbanasiak marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
EOF | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can test this locally by running:
or with overriding the 24h testing window:
|
||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats the version of that image we use in other places. We should look into automating the updates via renovate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #134122 as follow up on this