Skip to content

Commit 58f3f76

Browse files
[8.19] (backport #17945) Replace buildkite jdk version check w/GH action (#18212)
* 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' ' (cherry picked from commit 2fab5f4) # Conflicts: # catalog-info.yaml * fix merge conflicts --------- Co-authored-by: Cas Donoghue <[email protected]>
1 parent 5f97c27 commit 58f3f76

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
@@ -726,23 +726,6 @@ class JDKDetails {
726726
return createElasticCatalogDownloadUrl()
727727
}
728728

729-
// throws an error iff local version in versions.yml doesn't match the latest from JVM catalog.
730-
void checkLocalVersionMatchingLatest() {
731-
// retrieve the metadata from remote
732-
def url = "https://jvm-catalog.elastic.co/jdk/latest_adoptiumjdk_${major}_${osName}"
733-
def catalogMetadataUrl = URI.create(url).toURL()
734-
def catalogConnection = catalogMetadataUrl.openConnection()
735-
catalogConnection.requestMethod = 'GET'
736-
assert catalogConnection.responseCode == 200
737-
738-
def metadataRetrieved = catalogConnection.content.text
739-
def catalogMetadata = new JsonSlurper().parseText(metadataRetrieved)
740-
741-
if (catalogMetadata.version != revision || catalogMetadata.revision != build) {
742-
throw new GradleException("Found new jdk version. Please update version.yml to ${catalogMetadata.version} build ${catalogMetadata.revision}")
743-
}
744-
}
745-
746729
private String createElasticCatalogDownloadUrl() {
747730
// Ask details to catalog https://jvm-catalog.elastic.co/jdk and return the url to download the JDK
748731

@@ -852,13 +835,6 @@ tasks.register("downloadJdk", Download) {
852835
}
853836
}
854837

855-
tasks.register("checkNewJdkVersion") {
856-
// use Linux x86_64 as canary platform
857-
def jdkDetails = new JDKDetails(gradle.ext.versions.bundled_jdk, "linux", "x86_64")
858-
// throws Gradle exception if local and remote doesn't match
859-
jdkDetails.checkLocalVersionMatchingLatest()
860-
}
861-
862838
tasks.register("deleteLocalJdk", Delete) {
863839
// CLI project properties: -Pjdk_bundle_os=[windows|linux|darwin]
864840
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
@@ -694,62 +693,3 @@ spec:
694693
branch: main
695694
cronline: 30 20 * * *
696695
message: Daily trigger of Health Report Tests Pipeline
697-
698-
# *******************************
699-
# SECTION END: Health Report Tests pipeline
700-
# *******************************
701-
702-
# ***********************************
703-
# Declare JDK check pipeline
704-
# ***********************************
705-
---
706-
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json
707-
apiVersion: backstage.io/v1alpha1
708-
kind: Resource
709-
metadata:
710-
name: logstash-jdk-availability-check-pipeline
711-
description: ":logstash: check availability of new JDK version"
712-
spec:
713-
type: buildkite-pipeline
714-
owner: group:logstash
715-
system: platform-ingest
716-
implementation:
717-
apiVersion: buildkite.elastic.dev/v1
718-
kind: Pipeline
719-
metadata:
720-
name: logstash-jdk-availability-check-pipeline
721-
spec:
722-
repository: elastic/logstash
723-
pipeline_file: ".buildkite/jdk_availability_check_pipeline.yml"
724-
maximum_timeout_in_minutes: 10
725-
provider_settings:
726-
trigger_mode: none # don't trigger jobs from github activity
727-
env:
728-
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'true'
729-
SLACK_NOTIFICATIONS_CHANNEL: '#logstash-build'
730-
SLACK_NOTIFICATIONS_ON_SUCCESS: 'false'
731-
SLACK_NOTIFICATIONS_SKIP_FOR_RETRIES: 'true'
732-
teams:
733-
logstash:
734-
access_level: MANAGE_BUILD_AND_READ
735-
ingest-eng-prod:
736-
access_level: MANAGE_BUILD_AND_READ
737-
everyone:
738-
access_level: READ_ONLY
739-
schedules:
740-
Weekly JDK availability check (main):
741-
branch: main
742-
cronline: 0 2 * * 1 # every Monday@2AM UTC
743-
message: Weekly trigger of JDK update availability pipeline per branch
744-
env:
745-
PIPELINES_TO_TRIGGER: 'logstash-jdk-availability-check-pipeline'
746-
Weekly JDK availability check (8.x):
747-
branch: 8.x
748-
cronline: 0 2 * * 1 # every Monday@2AM UTC
749-
message: Weekly trigger of JDK update availability pipeline per branch
750-
env:
751-
PIPELINES_TO_TRIGGER: 'logstash-jdk-availability-check-pipeline'
752-
753-
# *******************************
754-
# SECTION END: JDK check pipeline
755-
# *******************************

ci/check_jdk_version_availability.sh

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

0 commit comments

Comments
 (0)