Skip to content

Commit 2fab5f4

Browse files
authored
Replace buildkite jdk version check w/GH action (#17945)
* Replace buildkite jdk version check w/GH action Previously a weekly buildkite job would check if there is a newer JDK available than the one vendored in logstash. This job would fail until someone manually updated the JDK version in the `versions.yml` file in logstash. This commit reduces manual intervention by moving the responsibility to a GH action where there are patterns for creating PRs back to logstash. The action should run weekly and also be available in the actions UI. It is locked down with the same permissions as the version bump action. * Refactor to use updatecli * Remove gradle task in favor of updatecli * remove unused file * Dynamically generate java version lookup * make pipeline name unique' '
1 parent ecaf1fd commit 2fab5f4

File tree

6 files changed

+74
-117
lines changed

6 files changed

+74
-117
lines changed

.buildkite/jdk_availability_check_pipeline.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
name: Update java version file
3+
pipelineid: "logstash/jdk-version-updates-{{ requiredEnv "LOGSTASH_BRANCH" }}"
4+
5+
scms:
6+
default:
7+
kind: github
8+
spec:
9+
user: '{{ requiredEnv "GITHUB_ACTOR" }}'
10+
username: '{{ requiredEnv "GITHUB_ACTOR" }}'
11+
owner: '{{ .scm.owner }}'
12+
repository: '{{ .scm.repository }}'
13+
token: '{{ requiredEnv "GITHUB_TOKEN" }}'
14+
branch: '{{ requiredEnv "LOGSTASH_BRANCH" }}'
15+
commitusingapi: true
16+
force: false
17+
18+
sources:
19+
jdk_major:
20+
kind: yaml
21+
spec:
22+
file: "versions.yml"
23+
key: "$.bundled_jdk.revision"
24+
transformers:
25+
- findsubmatch:
26+
pattern: '^(\d+)\.\d+\.\d+$'
27+
captureindex: 1
28+
29+
latest_jdk_version:
30+
kind: json
31+
spec:
32+
file: 'https://jvm-catalog.elastic.co/jdk/latest_adoptiumjdk_{{ source "jdk_major" }}_linux'
33+
key: 'version'
34+
35+
latest_jdk_build:
36+
kind: json
37+
spec:
38+
file: 'https://jvm-catalog.elastic.co/jdk/latest_adoptiumjdk_{{ source "jdk_major" }}_linux'
39+
key: 'revision'
40+
41+
targets:
42+
update_jdk_revision:
43+
name: "Update JDK revision"
44+
kind: yaml
45+
sourceid: latest_jdk_version
46+
spec:
47+
file: versions.yml
48+
key: $.bundled_jdk.revision
49+
50+
update_jdk_build:
51+
name: "Update JDK build"
52+
kind: yaml
53+
sourceid: latest_jdk_build
54+
spec:
55+
file: versions.yml
56+
key: $.bundled_jdk.build
Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
name: Stub GH action for devoping new workflows [STUB]
1+
name: bump-java-version
2+
23
on:
4+
schedule:
5+
# Run weekly on Mondays at midnight UTC
6+
- cron: '0 0 * * 1'
37
workflow_dispatch:
4-
pull_request:
5-
types: [opened, synchronize, reopened]
68

7-
permissions:
8-
pull-requests: write
9-
contents: write
109

1110
jobs:
12-
stub_job_name:
13-
name: Stub Job
11+
bump:
12+
permissions:
13+
contents: write
14+
pull-requests: write
1415
runs-on: ubuntu-latest
1516
steps:
16-
- name: Stub step
17-
run: |
18-
echo "Stub to iterate via PR"
19-
17+
- uses: actions/checkout@v5
18+
19+
- uses: elastic/oblt-actions/updatecli/run@v1
20+
with:
21+
command: apply --config .ci/updatecli/bump-java-version.yml --values .ci/updatecli/values.d/scm.yml
22+
version-file: .updatecli-version
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
LOGSTASH_BRANCH: ${{ github.ref_name }}

build.gradle

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -748,23 +748,6 @@ class JDKDetails {
748748
return createElasticCatalogDownloadUrl()
749749
}
750750

751-
// throws an error iff local version in versions.yml doesn't match the latest from JVM catalog.
752-
void checkLocalVersionMatchingLatest() {
753-
// retrieve the metadata from remote
754-
def url = "https://jvm-catalog.elastic.co/jdk/latest_adoptiumjdk_${major}_${osName}"
755-
def catalogMetadataUrl = URI.create(url).toURL()
756-
def catalogConnection = catalogMetadataUrl.openConnection()
757-
catalogConnection.requestMethod = 'GET'
758-
assert catalogConnection.responseCode == 200
759-
760-
def metadataRetrieved = catalogConnection.content.text
761-
def catalogMetadata = new JsonSlurper().parseText(metadataRetrieved)
762-
763-
if (catalogMetadata.version != revision || catalogMetadata.revision != build) {
764-
throw new GradleException("Found new jdk version. Please update version.yml to ${catalogMetadata.version} build ${catalogMetadata.revision}")
765-
}
766-
}
767-
768751
private String createElasticCatalogDownloadUrl() {
769752
// Ask details to catalog https://jvm-catalog.elastic.co/jdk and return the url to download the JDK
770753

@@ -874,13 +857,6 @@ tasks.register("downloadJdk", Download) {
874857
}
875858
}
876859

877-
tasks.register("checkNewJdkVersion") {
878-
// use Linux x86_64 as canary platform
879-
def jdkDetails = new JDKDetails(gradle.ext.versions.bundled_jdk, "linux", "x86_64")
880-
// throws Gradle exception if local and remote doesn't match
881-
jdkDetails.checkLocalVersionMatchingLatest()
882-
}
883-
884860
tasks.register("deleteLocalJdk", Delete) {
885861
// CLI project properties: -Pjdk_bundle_os=[windows|linux|darwin]
886862
String osName = selectOsType()

catalog-info.yaml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ spec:
3333
- resource:logstash-windows-jdk-matrix-pipeline
3434
- resource:logstash-benchmark-pipeline
3535
- resource:logstash-health-report-tests-pipeline
36-
- resource:logstash-jdk-availability-check-pipeline
3736

3837
# ***********************************
3938
# Declare serverless IT pipeline
@@ -744,62 +743,3 @@ spec:
744743
branch: main
745744
cronline: 30 20 * * *
746745
message: Daily trigger of Health Report Tests Pipeline
747-
748-
# *******************************
749-
# SECTION END: Health Report Tests pipeline
750-
# *******************************
751-
752-
# ***********************************
753-
# Declare JDK check pipeline
754-
# ***********************************
755-
---
756-
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
757-
apiVersion: backstage.io/v1alpha1
758-
kind: Resource
759-
metadata:
760-
name: logstash-jdk-availability-check-pipeline
761-
description: ":logstash: check availability of new JDK version"
762-
spec:
763-
type: buildkite-pipeline
764-
owner: group:logstash
765-
system: platform-ingest
766-
implementation:
767-
apiVersion: buildkite.elastic.dev/v1
768-
kind: Pipeline
769-
metadata:
770-
name: logstash-jdk-availability-check-pipeline
771-
spec:
772-
repository: elastic/logstash
773-
pipeline_file: ".buildkite/jdk_availability_check_pipeline.yml"
774-
maximum_timeout_in_minutes: 10
775-
provider_settings:
776-
trigger_mode: none # don't trigger jobs from github activity
777-
env:
778-
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
779-
SLACK_NOTIFICATIONS_CHANNEL: '#logstash-build'
780-
SLACK_NOTIFICATIONS_ON_SUCCESS: 'false'
781-
SLACK_NOTIFICATIONS_SKIP_FOR_RETRIES: 'true'
782-
teams:
783-
logstash:
784-
access_level: MANAGE_BUILD_AND_READ
785-
ingest-eng-prod:
786-
access_level: MANAGE_BUILD_AND_READ
787-
everyone:
788-
access_level: READ_ONLY
789-
schedules:
790-
Weekly JDK availability check (main):
791-
branch: main
792-
cronline: 0 2 * * 1 # every Monday@2AM UTC
793-
message: Weekly trigger of JDK update availability pipeline per branch
794-
env:
795-
PIPELINES_TO_TRIGGER: 'logstash-jdk-availability-check-pipeline'
796-
Weekly JDK availability check (8.19):
797-
branch: "8.19"
798-
cronline: 0 2 * * 1 # every Monday@2AM UTC
799-
message: Weekly trigger of JDK update availability pipeline per branch
800-
env:
801-
PIPELINES_TO_TRIGGER: 'logstash-jdk-availability-check-pipeline'
802-
803-
# *******************************
804-
# SECTION END: JDK check pipeline
805-
# *******************************

ci/check_jdk_version_availability.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)