Skip to content

Add describe changed command to check if a package needs rebuild#339

Open
geropl wants to merge 1 commit intomainfrom
gpl/describe-changed-command
Open

Add describe changed command to check if a package needs rebuild#339
geropl wants to merge 1 commit intomainfrom
gpl/describe-changed-command

Conversation

@geropl
Copy link
Member

@geropl geropl commented Mar 13, 2026

Description

Adds leeway describe changed <package> — a lightweight command that checks whether a package's current version hash exists in the local or remote cache.

  • Exits 0 if the package is cached (unchanged / no rebuild needed)
  • Exits 1 if the package is not cached (changed / needs rebuild)

This enables CI branching decisions without running a full build --dry-run across the entire workspace:

if leeway describe changed my-component:my-package; then
  echo "unchanged, skipping build"
else
  leeway build my-component:my-package
fi

The command reuses the existing LocalCache.Location() and RemoteCache.ExistingPackages() infrastructure, so it respects the same LEEWAY_CACHE_DIR, LEEWAY_REMOTE_CACHE_BUCKET, and LEEWAY_REMOTE_CACHE_STORAGE configuration as leeway build.

Output is a tab-separated line: <package>\t<version>\t<status> where status is one of cached locally, cached remotely, or changed.

Related Issue(s)

Fixes CORE-

How to test

# Build leeway
go build -o leeway .

# Check a package that hasn't been built — should exit 1
./leeway describe changed //:app
echo $?  # 1

# Build a package
./leeway build //:helloworld

# Check again — should exit 0
./leeway describe changed //:helloworld
echo $?  # 0

Adds a new subcommand that checks whether a package's current version
exists in the local or remote cache. Exits 0 if cached (unchanged),
1 if not (needs rebuild). Intended for CI branching decisions.

Co-authored-by: Ona <no-reply@ona.com>
@geropl geropl marked this pull request as ready for review March 13, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant