Automate JRuby checks#149
Draft
schneems wants to merge 52 commits into
Draft
Conversation
Add tokio, serde, serde_json dependencies to jruby_executable and register a new jruby_release_check binary target. The binary is a placeholder stub that will be implemented in the next commit.
Replicates the language-release-tracker's JRuby parser logic to detect new JRuby releases not yet built on S3. Fetches releases from the GitHub Releases API for jruby/jruby, skips prereleases, validates 4-part version format, resolves Ruby stdlib versions via build properties, and checks S3 for each version/base-image combination. Outputs a JSON array of version strings needing builds, matching the format used by the existing ruby_release_check binary.
Add a check-jruby-releases job that runs in parallel with the existing CRuby check-releases job. Uses jruby_release_check to detect missing JRuby builds and triggers build_jruby.yml for each. Respects the existing dry_run input.
The GitHub Releases API returns 403 for unauthenticated requests that exceed rate limits. Use GITHUB_TOKEN or GH_TOKEN env var for bearer auth when available, and pass GITHUB_TOKEN in the workflow step.
Model --gh-token as Option<String> on the raw Args and introduce a validated ResolvedArgs type via TryFrom<Args>. The conversion is the single validation point: an absent or empty/whitespace token raises a helpful error naming `--gh-token=$(gh auth token)`, so call() and the fetch path receive a token guaranteed non-empty. Removes the implicit GITHUB_TOKEN/GH_TOKEN env reading; the workflow now passes the token explicitly via --gh-token "$GITHUB_TOKEN". Adds unit tests asserting the surfaced message for the missing/empty cases and the happy path.
7618306 to
99bb319
Compare
Previously, errors resolving the Ruby stdlib version or checking S3 for a JRuby binary were logged as warnings and dropped, so the job exited 0 even when work was lost. Accumulate these failures (including panicked tasks) instead of dropping them, let every successful version complete and still get written to the output JSON, then exit non-zero at the end if any failure was collected.
Mirror the JRuby checker: accumulate errors from S3 existence checks (including panicked tasks) instead of warning-and-dropping them, still write the output JSON for versions that succeeded, then exit non-zero at the end if any failure was collected.
The check binaries now exit non-zero when any version's stdlib resolution or S3 probe fails, but versions that succeeded are still written to the output JSON. Run the "Trigger builds" step with `!cancelled()` so those successful versions still get dispatched while the job stays red, and make the jq read fall back to empty so a never-written output file doesn't crash the step.
c5bb50a to
f7ff51a
Compare
fetch_github_releases previously bubbled the first per-page error after retries, so a failure on a later pagination page discarded every release gathered from earlier pages and the caller exited immediately, skipping the output write and the partial-success error accounting the rest of the binary relies on. Pagination now stops on the first failing page but keeps the releases collected so far, returning a ReleasePageError alongside them. The caller records it in the existing errors list so the run still exits non-zero while the recoverable versions continue through the pipeline. The page fetch can only fail two concrete ways (a reqwest transport error or a JSON parse error), so it is modeled with a typed FetchPageError enum rather than Box<dyn Error>, and ReleasePageError surfaces that cause in its Display message.
8e65ab0 to
a4efa50
Compare
Introduce Failures (one or more errors), MaybeFailures (zero-or-more accumulator), and OkMaybe (value plus maybe errors) so functions can gather as many errors as possible instead of bailing on the first. Adapted from the proc_micro pattern but with no syn dependency.
Also fixes a bug where previously we were retrying on a failed header parse even when the request was good.
Introduce paginate_releases_accumulated alongside a CannotParseJrubyVersion error variant so release fetching can collect version-parse and page-fetch failures instead of dropping or short-circuiting on them. Not yet wired into call(). Also renames ReleaseNumberParse to the more accurate ReleaseResponseParse.
Route fetch_github_releases through paginate_releases_accumulated so partial results survive a failed page and version-parse errors are reported instead of dropped. Switch call()'s error accumulator from Vec<String> to MaybeErrors<Box<dyn Error + Send + Sync>>, erasing error types only at this integration seam (a String is the rendering, not the error). A StageError wrapper preserves the per-phase context the strings used to carry.
Delete the now-unused paginate_releases (superseded by the accumulating variant), moving its doc comment over. Repoint the two pagination tests to paginate_releases_accumulated/OkMaybe and add a test proving version-parse failures are accumulated while good versions keep being collected.
Repoint the MaybeErrors Extend doc link from the removed push_unwrap to drain_unwrap, and apply rustfmt formatting fixes.
Move the JRubyVersion type out of the jruby_release_check binary into a dedicated jruby_version module in the jruby_executable library and re-export it, mirroring how shared exposes RubyDownloadVersion. The version-only tests move with the type; binary-specific tests stay in the release-check binary.
Replace the stringly-typed `version: String` CLI argument with the typed JRubyVersion in jruby_build, jruby_check, and jruby_changelog. Clap parses it via the FromStr impl, so non-4-part versions (e.g. `9.4.7`) are now rejected at the CLI boundary, matching the validation jruby_release_check already enforces.
Replace the Result<_, String> stringification in JRubyVersion parsing with a typed jruby_version::ParseError enum, preserving the ParseIntError source chain so callers can pattern-match on which component failed. FromStr becomes the canonical implementation; the inherent parse delegates to it as an ergonomic alternative. GithubReleaseError::CannotParseJrubyVersion now carries the typed error via #[source] instead of a flattened String. Also adds module- and struct-level docs for the 4-segment JRuby version scheme and exposes jruby_version as a public module.
Replace test_strip_v_prefix, which only exercised str::strip_prefix and JRubyVersion round-tripping, with a test that drives paginate_releases_accumulated with a "v9.4.7.0" tag and asserts the resulting version. This actually covers the production stripping logic.
Both ParseError variants now include the offending input string so every invalid-parse message is self-describing, and InvalidComponent surfaces the wrapped ParseIntError in its Display (it was only reachable via the #[source] chain before).
ParseError now embeds the input string, so the wrapper's separate `raw` field and custom message were redundant and dropped the inner detail. Make CannotParseJrubyVersion a transparent #[from] wrapper that defers its Display to ParseError. Also remove test_version_from_str: parse delegates to FromStr, so from_str is already covered by the other parse tests; the test only exercised stdlib str::parse dispatch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently JRuby builds are triggered manually via build_jruby.yml workflow dispatch. CRuby has full automation via ruby_release_check binary and check_new_ruby_releases.yml cron workflow. JRuby needs the same.
GUS-W-22931747