-
Notifications
You must be signed in to change notification settings - Fork 0
jdk profiling & create-prs scripts #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
msladek
wants to merge
2
commits into
dev
Choose a base branch
from
profiling
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| helpstr="Usage: $(basename "$0") ORG BRANCH [GH_PR_CREATE_OPTIONS...]" | ||
| org="${1:?$helpstr}" | ||
| branch="${2:?$helpstr}" | ||
| shift 2 | ||
|
|
||
| repos=$(gh repo list "$org" --source --no-archived --limit 1000 \ | ||
| --json nameWithOwner --jq '.[].nameWithOwner') | ||
|
|
||
| for repo in $repos; do | ||
| gh api "repos/$repo/branches/$branch" --silent >/dev/null 2>&1 || continue | ||
| pr=$(gh pr list --repo "$repo" --head "$branch" --state open \ | ||
|
fpichler marked this conversation as resolved.
|
||
| --json url --jq '.[0].url // empty') | ||
| [ -n "$pr" ] && echo "skip $repo: $pr" && continue | ||
| gh pr create --repo "$repo" --head "$branch" "$@" | ||
| done | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #!/bin/bash | ||
| #!/usr/bin/env bash | ||
|
|
||
| eval $(ssh-agent) | ||
| ssh-add $1 | ||
|
|
||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| umask 077 | ||
|
|
||
| service="${1:-web}" | ||
| cmd=(docker compose exec -T "$service") | ||
| dump="heap-$(date +%Y%m%d-%H%M%S).hprof" | ||
| tmpfile="/tmp/$dump" | ||
|
|
||
| cleanup() { | ||
| "${cmd[@]}" rm -f "$tmpfile" | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| echo "heap dump may pause the JVM and require up to the heap size in free disk space" | ||
| "${cmd[@]}" jcmd 1 VM.flags | ||
| "${cmd[@]}" jcmd 1 GC.heap_info | ||
| "${cmd[@]}" jcmd 1 GC.heap_dump "$tmpfile" | ||
| "${cmd[@]}" cat "$tmpfile" > "$dump" | ||
|
fpichler marked this conversation as resolved.
|
||
| echo "heap dump written to $dump" | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
| umask 077 | ||
|
fpichler marked this conversation as resolved.
|
||
|
|
||
| service="${1:-web}" | ||
| cmd=(docker compose exec -T "$service") | ||
| profile="profile-$(date +%Y%m%d-%H%M%S)" | ||
| tmpfile="/tmp/${profile}.jfr" | ||
|
|
||
| cleanup() { | ||
| "${cmd[@]}" jcmd 1 JFR.stop name="$profile" >/dev/null 2>&1 || true | ||
| "${cmd[@]}" rm -f "$tmpfile" || true | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| "${cmd[@]}" jcmd 1 JFR.start name="$profile" settings=profile filename="$tmpfile" maxsize=512m | ||
|
|
||
| read -r -n 1 -s -p "recording; press any key to stop" && echo | ||
|
|
||
| "${cmd[@]}" jcmd 1 JFR.stop name="$profile" | ||
|
|
||
| "${cmd[@]}" cat "$tmpfile" > "${profile}.jfr" | ||
| echo "recording written to ${profile}.jfr" | ||
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Do not treat every API failure as “branch absent”.
Authentication failures, rate limits, API outages, and network errors all take this
|| continuepath with stderr discarded. If every lookup fails, the batch prints nothing and exits successfully without creating any PRs.Smallest fix: continue only for an explicit 404; surface other failures and return a non-zero status or a failure summary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gh repo listalready acts as the authentication and connectivity preflight. This is intentionally a small best-effort helper, distinguishing API failures would add disproportionate complexity, so I’m keeping it as is.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial
gh repo listonly proves that one request succeeded. Each later branch lookup can independently fail because of a rate limit, transient network/API failure, or repository-specific authorization, and line 13 still converts every such failure into a silent successful skip. Best-effort operation can continue after an error, but it should report non-404 failures and return a failure summary/non-zero status so the batch cannot silently omit repositories.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again: This is a small best-effort helper, not security-critical production automation. Per-repository lookup failures are intentionally treated as skips. Adding response status handling would be disproportionate to its intended use.
Feel free to add improvements to this in a separate PR. I’m keeping it as is.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Downgrading this finding from P1 to P2 and keeping the thread open. I accept that this is a small best-effort helper, but the resulting behavior still needs to be explicit.
Please add inline documentation near this lookup stating that branch-query failures—including rate limits, authorization errors, and network/API outages—are silently treated as missing branches, so the command can exit successfully after producing an incomplete set of PRs.
Please also create and link a
SYNINTERNimprovement issue to distinguish an actual 404 from other failures and report incomplete runs.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for clarifying that this is intentionally a small, manual, best-effort helper. Given that scope, I accept keeping the current error handling in this PR.
To correct my approval summary: I withdraw the requested follow-up Jira issue. It is not a pre-merge requirement, and I am still not requesting that the different failure responses be handled in this PR.
Nevertheless, I still consider a brief inline comment necessary because the current control flow intentionally treats every branch lookup failure—not only a missing branch—as a skip. The command may therefore exit successfully with an incomplete result. A single-line comment is sufficient, for example:
# Best effort: any lookup failure is treated as a missing branch, so the run may succeed with an incomplete result.Of the two expectations stated in my approval summary, only this inline documentation remains.