Skip to content

chore(ci): replace hardcoded server commit with latest release#732

Open
lokidundun wants to merge 8 commits intoapache:masterfrom
lokidundun:unifyci
Open

chore(ci): replace hardcoded server commit with latest release#732
lokidundun wants to merge 8 commits intoapache:masterfrom
lokidundun:unifyci

Conversation

@lokidundun
Copy link
Copy Markdown
Contributor

Purpose of the PR

  • close #xxx

Main Changes

  1. CI: track latest HugeGraph stable release instead of hardcoded commit

All 6 workflows (client-ci, client-go-ci, hubble-ci, loader-ci, spark-connector-ci, tools-ci) previously had a # TODO: replace it with the (latest - n) commit id (n >= 15)
reminder with a manually-pinned COMMIT_ID. These SHAs drift out of date and silently miss server-side regressions.

Replaced the static value with an actions/github-script@v7 step that:

  • queries apache/hugegraph's latest GitHub release via getLatestRelease
  • resolves the tag through getRef and dereferences annotated tags via getTag (lightweight tags work too)
  • exports the 7-char SHA as COMMIT_ID for downstream install-hugegraph-from-source.sh $COMMIT_ID

CI now follows the most recent stable release with zero manual upkeep.

  1. loader-ci: cache the built HugeGraph server

Reused the resolved release SHA as a cache key (~/hugegraph-cache-${commit_id}) so subsequent CI runs skip the server build entirely as long as the upstream release hasn't
moved.

  1. hugegraph-client-go: adapt gremlin to HugeGraph 1.7.0+ graph-space bindings

Server 1.7.0 introduced graph spaces and changed how the gremlin engine registers traversal sources — the graph is no longer a top-level Groovy global named , it's now
aliased as __g_DEFAULT- (where DEFAULT is the default graph space). The Java client was updated for this in GremlinManager.java; the Go client was not, so every gremlin
POST against a 1.7.0+ server failed with:

Could not rebind [g] to [__g_hugegraph] as [__g_hugegraph] not in the Graph or TraversalSource global bindings

Ported the Java behavior:

  • gemlin.go: aliases field on PostRequest / PostRequestData is now map[string]string (was an empty anonymous struct that silently dropped values).
  • Added buildDefaultAliases(transport) mirroring GremlinManager.java:46-56 and HugeClientBuilder.DEFAULT_GRAPHSPACE = "DEFAULT": returns {"graph": "DEFAULT-", "g":
    "__g_DEFAULT-"} when the caller hasn't supplied custom aliases.
  • PostRequest.Do auto-injects on every gremlin POST. GET is intentionally untouched — the Java client has no GET equivalent, and the server's /gremlin GET endpoint cannot accept
    JSON aliases query params due to a Jersey URI-template parser conflict on { / }.
  • gemlin_test.go: removed the GET assertion (would 500 on 1.7.0+ regardless of client changes), changed the POST script from hugegraph.traversal().V().limit(3) to g.V().limit(3)
    to match Java's g.V().count() convention, and surfaced server status/message on failure for easier diagnosis.

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • xxx

Does this PR potentially affect the following parts?

  • Nope
  • Dependencies (add/update license info)
  • Modify configurations
  • The public API
  • Other affects (typed here)

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 2, 2026
@github-actions github-actions Bot added the client hugegraph-client label May 2, 2026
@dosubot dosubot Bot added the ci Continuous integration label May 2, 2026
@imbajin imbajin requested a review from Copilot May 4, 2026 02:50
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CI workflows to follow the latest Apache HugeGraph stable release automatically (instead of pinned SHAs), and adjusts the Go Gremlin client to work with HugeGraph 1.7.0+ graph-space traversal source bindings.

Changes:

  • CI: replace hardcoded COMMIT_ID in multiple workflows with a github-script step that resolves the latest release tag to a commit SHA.
  • CI (loader): key the HugeGraph server cache using the resolved release commit.
  • Go client: send default Gremlin aliases on POST requests and update Gremlin tests to use g.V().

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
hugegraph-client-go/api/v1/gremlin/gemlin.go Switch Gremlin POST aliases to a map and auto-inject default aliases for HugeGraph 1.7.0+.
hugegraph-client-go/api/v1/gremlin/gemlin_test.go Update Gremlin test to use g.V() and improve failure reporting.
.github/workflows/tools-ci.yml Resolve COMMIT_ID from latest HugeGraph release tag via actions/github-script.
.github/workflows/spark-connector-ci.yml Resolve COMMIT_ID from latest HugeGraph release tag via actions/github-script.
.github/workflows/loader-ci.yml Resolve COMMIT_ID dynamically and adjust server cache key/path to the resolved commit.
.github/workflows/hubble-ci.yml Resolve COMMIT_ID from latest HugeGraph release tag via actions/github-script.
.github/workflows/client-go-ci.yml Resolve COMMIT_ID from latest HugeGraph release tag via actions/github-script.
.github/workflows/client-ci.yml Resolve COMMIT_ID from latest HugeGraph release tag via actions/github-script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/tools-ci.yml Outdated
const { data: tag } = await github.rest.git.getTag({ owner, repo, tag_sha: sha });
sha = tag.object.sha;
}
sha = sha.substring(0, 7);
Comment thread .github/workflows/hubble-ci.yml Outdated
const { data: tag } = await github.rest.git.getTag({ owner, repo, tag_sha: sha });
sha = tag.object.sha;
}
sha = sha.substring(0, 7);
Comment on lines +134 to +145
func buildDefaultAliases(transport api.Transport) map[string]string {
cfg := transport.GetConfig()
graphSpace := cfg.GraphSpace
if graphSpace == "" {
graphSpace = "DEFAULT"
}
full := graphSpace + "-" + cfg.Graph
return map[string]string{
"graph": full,
"g": "__g_" + full,
}
}
Comment on lines +132 to +133
// Sending these aliases lets scripts use `g.V()` against the active graph
// regardless of how the server names its bindings internally.
Comment on lines +42 to +43
t.Errorf("client.Gremlin.Post status=%d, message=%s",
respPost.StatusCode, respPost.Data.Message)
const { data: tag } = await github.rest.git.getTag({ owner, repo, tag_sha: sha });
sha = tag.object.sha;
}
sha = sha.substring(0, 7);
Comment thread .github/workflows/loader-ci.yml Outdated
const { data: tag } = await github.rest.git.getTag({ owner, repo, tag_sha: sha });
sha = tag.object.sha;
}
sha = sha.substring(0, 7);
Comment thread .github/workflows/client-go-ci.yml Outdated
const { data: tag } = await github.rest.git.getTag({ owner, repo, tag_sha: sha });
sha = tag.object.sha;
}
sha = sha.substring(0, 7);
Comment thread .github/workflows/client-ci.yml Outdated
const { data: tag } = await github.rest.git.getTag({ owner, repo, tag_sha: sha });
sha = tag.object.sha;
}
sha = sha.substring(0, 7);
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.34%. Comparing base (b066b80) to head (aa29128).
⚠️ Report is 77 commits behind head on master.

Additional details and impacted files
@@              Coverage Diff              @@
##             master     #732       +/-   ##
=============================================
- Coverage     62.49%   39.34%   -23.16%     
- Complexity     1903     2199      +296     
=============================================
  Files           262      468      +206     
  Lines          9541    17353     +7812     
  Branches        886     1819      +933     
=============================================
+ Hits           5963     6828      +865     
- Misses         3190    10038     +6848     
- Partials        388      487       +99     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous integration client hugegraph-client size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants