Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# synventis-tools

Shared Synventis developer tooling for Git, Maven, Eclipse, deployment helpers, and agent skills.
Shared Synventis developer tooling for Git, Maven, Eclipse, and agent skills.

## Eclipse Config

Shared Eclipse formatter, cleanup, and import-order settings live in [`eclipse/`](eclipse/).

## Git Tools

Git helper scripts live in [`git/`](git/), including repository cloning, subtree initialization,
SSH URL conversion, and local cleanup helpers.
Git helper scripts live in [`git/`](git/), including PR creation, subtree initialization, SSH URL
conversion, and local cleanup helpers.

## Maven Tools

Maven helper scripts live in [`mvn/`](mvn/). See [`mvn/README.md`](mvn/README.md) for release and
formatting workflows.
Maven helper scripts live in [`mvn/`](mvn/). See [`mvn/README.md`](mvn/README.md) for dependency
inspection and formatting workflows.

## Agent Skills

Expand Down
28 changes: 0 additions & 28 deletions bin/start-syncel-deploy.sh

This file was deleted.

11 changes: 0 additions & 11 deletions git/clone-repositories.sh

This file was deleted.

18 changes: 18 additions & 0 deletions git/create-prs.sh
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

@fpichler fpichler Aug 4, 2026

Copy link
Copy Markdown
Member

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 || continue path 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

gh repo list already 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The initial gh repo list only 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.

Copy link
Copy Markdown
Member Author

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.

@fpichler fpichler Aug 9, 2026

Copy link
Copy Markdown
Member

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 SYNINTERN improvement issue to distinguish an actual 404 from other failures and report incomplete runs.

@fpichler fpichler Aug 10, 2026

Copy link
Copy Markdown
Member

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.

pr=$(gh pr list --repo "$repo" --head "$branch" --state open \
Comment thread
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
2 changes: 1 addition & 1 deletion git/init-from-subtree.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
## init a new repository from a sub directory
# $1 = sub directory
# $2 = github org
Expand Down
2 changes: 1 addition & 1 deletion git/initSshAgent.sh
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
Expand Down
2 changes: 1 addition & 1 deletion git/pull-and-clean.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
## Marc Sladek <marc@sadek.me>, June-Nov 2018
## pulls and cleans the branches of the current or given and sub git repositories in parallel

Expand Down
2 changes: 1 addition & 1 deletion git/repositories-to-ssh.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
## Marc Sladek <marc@sadek.me>, June 2018
## sets the ssh url for all repositories

Expand Down
20 changes: 20 additions & 0 deletions jdk/dump-heap.sh
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"
Comment thread
fpichler marked this conversation as resolved.
echo "heap dump written to $dump"
23 changes: 23 additions & 0 deletions jdk/profile-jfr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
umask 077
Comment thread
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"
80 changes: 2 additions & 78 deletions mvn/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Maven toolbox scripts

This folder contains a small set of scripts to automate dependency updates across multiple Maven projects in a workspace.
This folder contains helpers for inspecting Maven project dependencies and formatting Java code.

## Prerequisites

- Debian/Linux with `bash`
- `python3` (for `build-dependency-tree.py`)
- `git`
- `mvn` (and the Maven Versions Plugin available, since `versions:*` goals are used)
- `mvn`
- Workspace layout: a directory containing multiple Maven projects with `pom.xml` files

All scripts are intended to be run from this folder (they `cd` to the script directory).
Expand Down Expand Up @@ -55,78 +54,3 @@ Create a tree file for a workspace:
```bash
<toolbox>/mvn/build-dependency-tree.py ~/workspace > dependency.tree
```

Comment thread
fpichler marked this conversation as resolved.
---

## `prepare-release`

Prepares and pushes a git branch for a maven project directory for either:

- `--mode=release`: update dependencies to latest releases (default mode)
- `--mode=major`: bump the project version to `X.0-SNAPSHOT` and update dependencies to latest snapshots

It expects a clean `pom.xml`.

### Usage

```bash
<toolbox>/mvn/prepare-release.sh [--mode=release] --branch=<branch-name> [project-dir]
<toolbox>/mvn/prepare-release.sh --mode=major --version=<major> --branch=<branch-name> [project-dir]
```

### Examples

Update the current directory project to the latest releases:

```bash
<toolbox>/mvn/prepare-release.sh --branch=RELEASE
```

Prepare major version 7.0-SNAPSHOT for a single project:

```bash
<toolbox>/mvn/prepare-release.sh --mode=major --version=7 --branch=major-7 ~/workspace/some-project
```

---

## `major-upgrade`

Runs a major upgrade across *multiple* Maven projects in a workspace, in dependency order.

It uses `build-dependency-tree` to generate an ordered list of project directories, then runs `prepare-release --mode=major` for each directory. Progress is checkpointed so the run can be resumed.

### Usage

```bash
<toolbox>/mvn/major-upgrade.sh <major> [workspace_dir]
```

- `<major>`: required major version number (e.g. `7`)
- `workspace_dir`: optional, defaults to `$HOME/workspace`

### Files created

For major version `$v` in workspace `$WS`:

- `$WS/major-$v.tree` — dependency-ordered list of projects (generated once, reused on reruns)
- `$WS/major-$v.done.tree` — checkpoint file of already-processed directories
- `$WS/major-$v.log` — combined stdout/stderr log of all `prepare-release` runs

### Example flow

1. Go to your workspace directory and make sure all repos are cloned. Ensure all repos are
on a clean git state (on `dev` branch).
```bash
cd $WS
<toolbox>/git/pull-and-clean.sh
```
2. Generate a dependency `major-$v.tree` and vet it manually. Entries can be removed if needed.
```bash
<toolbox>/mvn/build-dependency-tree.py > major-$v.tree
edit major-$v.tree
```
3. Run the routine to process all pom's in order. If one fails, fix the repo and rerun the same command to resume. Already completed directories are skipped based on `major-$v.done.tree`.
```bash
<toolbox>/mvn/major-upgrade.sh $v
```
48 changes: 24 additions & 24 deletions mvn/format-java.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -euo pipefail

# Calculate script directory
Expand All @@ -8,30 +8,30 @@ echo "Formatter config: $FORMATTER_CONFIG"

# Help message
function show_help {
echo "Usage: $0 [options] [maven-args]"
echo ""
echo "Formats Java code using the Synventis code formatter."
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo ""
echo "All other arguments are passed to the Maven command."
echo "Usage: $0 [options] [maven-args]"
echo ""
echo "Formats Java code using the Synventis code formatter."
echo ""
echo "Options:"
echo " -h, --help Show this help message"
echo ""
echo "All other arguments are passed to the Maven command."
}

# Parse arguments for help
for arg in "$@"; do
case $arg in
-h|--help)
show_help
exit 0
;;
esac
case $arg in
-h|--help)
show_help
exit 0
;;
esac
done

# Check if formatter config exists
if [ ! -f "$FORMATTER_CONFIG" ]; then
echo "Error: Formatter config file not found at $FORMATTER_CONFIG"
exit 1
echo "Error: Formatter config file not found at $FORMATTER_CONFIG"
exit 1
fi

echo "`pwd`"
Expand All @@ -41,10 +41,10 @@ JAVA_VERSION=$(mvn help:evaluate -Dexpression=java.version -q -DforceStdout)
JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION" | sed -E 's/^1\.//' | cut -d'.' -f1)

mvn net.revelc.code.formatter:formatter-maven-plugin:2.23.0:format \
-Dconfigfile="$FORMATTER_CONFIG" \
-Dlineending=LF \
-Dmaven.compiler.source="$JAVA_MAJOR_VERSION" \
-Dmaven.compiler.target="$JAVA_MAJOR_VERSION" \
-Dformatter.overrideConfigCompilerVersion=true \
-Dproject.build.sourceEncoding=UTF-8 \
"$@"
-Dconfigfile="$FORMATTER_CONFIG" \
-Dlineending=LF \
-Dmaven.compiler.source="$JAVA_MAJOR_VERSION" \
-Dmaven.compiler.target="$JAVA_MAJOR_VERSION" \
-Dformatter.overrideConfigCompilerVersion=true \
-Dproject.build.sourceEncoding=UTF-8 \
"$@"
25 changes: 0 additions & 25 deletions mvn/major-upgrade.sh

This file was deleted.

Loading