davsclaus commented on code in PR #1838:
URL: https://github.com/apache/camel-website/pull/1838#discussion_r4400056412
##########
.github/workflows/pr.yaml:
##########
@@ -75,6 +75,23 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # latest.properties, lts.properties and every X.Y.properties under
+ # static/camel-cli/releases must be copies of the exact-version manifests
+ # they select (lts from `kind: lts` in content/releases). Fails on drift;
+ # fix it with `scripts/camel-cli-aliases.sh rebuild`.
+ camel-cli-manifests:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v5
+ - name: Set up JDK
+ uses: actions/setup-java@v5
+ with:
+ distribution: temurin
+ java-version: '17'
Review Comment:
Camel 4.24 onwards is JDK 21+, and the generator source follows apache/camel
main. It compiles on 17 today, but the next upstream change could use a Java 21
API and break this check.
```suggestion
java-version: '21'
```
##########
content/download/camel-cli-launcher.md:
##########
@@ -63,5 +64,18 @@ or more than one top-level directory, and runs the staged
launcher once to
confirm a Java 17+ runtime before activating it. If that check fails, any
Review Comment:
Suggestion (predates this PR, but the page is touched here): this line and
the prerequisite at line 13 still say Java 17, while the upstream
`install.sh`/`install.ps1` on main now say "Java 21+ required". Worth saying
Java 21+ for Camel 4.24 onwards (17 for older pinned versions such as 4.22.2),
either here or when the installers are re-vendored.
##########
scripts/camel-cli-aliases.sh:
##########
@@ -0,0 +1,101 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# camel-cli-aliases.sh - maintain the Camel CLI alias manifests in
+# static/camel-cli/releases (latest.properties, lts.properties,
X.Y.properties).
+#
+# Usage:
+# scripts/camel-cli-aliases.sh check verify the aliases, write
nothing (CI)
+# scripts/camel-cli-aliases.sh rebuild regenerate the aliases
(backfill)
+# scripts/camel-cli-aliases.sh kind <X.Y.Z> print "lts" or "regular" for
a release
+#
+# The LTS versions come from the release pages: a release is LTS when
+# content/releases/release-<version>.md has `kind: lts` in its front matter.
+# Every exact-version manifest (X.Y.Z.properties) must have a published
+# (`draft: false`, `category: camel`) release page. The alias rules themselves
+# live in the vendored scripts/WebsiteManifestGenerator.java
(--rebuild-aliases).
+set -eu
+
+repo_root=$(CDPATH='' cd -- "$(dirname -- "$0")/.." && pwd)
+releases_dir="$repo_root/static/camel-cli/releases"
+pages_dir="$repo_root/content/releases"
+generator="$repo_root/scripts/WebsiteManifestGenerator.java"
+
+die() { echo "error: $*" >&2; exit 1; }
+usage() { echo "Usage: $0 check | rebuild | kind <X.Y.Z>" >&2; exit 2; }
+
+# Prints the value of a top-level key from the YAML front matter of a page,
+# without surrounding whitespace or quotes. Prints nothing if the key is
absent.
+front_matter_value() {
+ awk -v key="$2" '
+ NR == 1 { if ($0 != "---") exit; next }
+ $0 == "---" { exit }
+ index($0, key ":") == 1 {
+ v = substr($0, length(key) + 2)
+ gsub(/^[ \t]+|[ \t\r]+$/, "", v)
+ gsub(/^["\047]|["\047]$/, "", v)
+ print v
+ exit
+ }
+ ' "$1"
+}
+
+# Prints "lts" or "regular" for a published Camel release; fails if its release
+# page is missing, is a draft, or is not a Camel release.
+release_kind() {
+ page="$pages_dir/release-$1.md"
+ [ -f "$page" ] || die "release page not found for $1:
content/releases/release-$1.md"
+ [ "$(front_matter_value "$page" draft)" != "true" ] \
+ || die "release page for $1 is a draft: content/releases/release-$1.md"
+ category=$(front_matter_value "$page" category)
+ [ "$category" = "camel" ] \
+ || die "release page for $1 has category '$category', expected
'camel': content/releases/release-$1.md"
+ if [ "$(front_matter_value "$page" kind)" = "lts" ]; then echo lts; else
echo regular; fi
+}
+
+# Comma-separated LTS versions among the exact-version manifests.
+lts_versions() {
+ list=""
+ for manifest in "$releases_dir"/*.properties; do
+ v=$(basename "$manifest" .properties)
+ echo "$v" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$' || continue
+ kind=$(release_kind "$v") || exit 1
+ [ "$kind" = "lts" ] && list="$list${list:+,}$v"
+ done
+ echo "$list"
+}
+
+rebuild_aliases() {
+ command -v java >/dev/null 2>&1 || die "java (JDK 17+) is required to run
$generator"
Review Comment:
Same here, to match the JDK 21 baseline of camel main (the same message in
`update-camel-cli-manifest.sh` could follow suit):
```suggestion
command -v java >/dev/null 2>&1 || die "java (JDK 21+) is required to
run $generator"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]