-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Problem
The Docker cleanup functionality in docker/build.gradle.kts currently uses a mixed approach for GitHub API operations:
- CLI commands for package deletions
- curl for some operations (from earlier implementation)
This inconsistency makes the code harder to maintain and debug.
Proposed Solution
Consider refactoring to use a consistent API approach, with two main options:
Option 1: Standardize on Work seamlessly with GitHub from the command line.
USAGE
gh [flags]
CORE COMMANDS
auth: Authenticate gh and git with GitHub
browse: Open repositories, issues, pull requests, and more in the browser
codespace: Connect to and manage codespaces
gist: Manage gists
issue: Manage issues
org: Manage organizations
pr: Manage pull requests
project: Work with GitHub Projects.
release: Manage releases
repo: Manage repositories
GITHUB ACTIONS COMMANDS
cache: Manage GitHub Actions caches
run: View details about workflow runs
workflow: View details about GitHub Actions workflows
ALIAS COMMANDS
co: Alias for "pr checkout"
ADDITIONAL COMMANDS
alias: Create command shortcuts
api: Make an authenticated GitHub API request
attestation: Work with artifact attestations
completion: Generate shell completion scripts
config: Manage configuration for gh
extension: Manage gh extensions
gpg-key: Manage GPG keys
label: Manage labels
preview: Execute previews for gh features
ruleset: View info about repo rulesets
search: Search for repositories, issues, and pull requests
secret: Manage GitHub secrets
ssh-key: Manage SSH keys
status: Print information about relevant issues, pull requests, and notifications across repositories
variable: Manage GitHub Actions variables
HELP TOPICS
accessibility: Learn about GitHub CLI's accessibility experiences
actions: Learn about working with GitHub Actions
environment: Environment variables that can be used with gh
exit-codes: Exit codes used by gh
formatting: Formatting options for JSON data exported from gh
mintty: Information about using gh with MinTTY
reference: A comprehensive reference of all gh commands
FLAGS
--help Show help for command
--version Show gh version
EXAMPLES
$ gh issue create
$ gh repo clone cli/cli
$ gh pr checkout 321
LEARN MORE
Use gh <command> <subcommand> --help
for more information about a command.
Read the manual at https://cli.github.com/manual
Learn about exit codes using gh help exit-codes
Learn about accessibility experiences using gh help accessibility
CLI
- Replace any remaining curl operations with commands
- Benefits: Consistent authentication, better error handling, simpler subprocess management
Option 2: Use existing GitHubProtocol.kt class
- Extend the existing class to support container package operations
- This class already provides proper authentication, error handling, and JSON parsing for Maven packages
- Benefits: Type-safe operations, consistent with existing codebase patterns, better error handling
Current Implementation
The cleanup task currently:
- Uses for container package deletions
- Has proper authentication handling via GITHUB_TOKEN environment variable
- Includes retry verification logic with proper error handling
Files Involved
-
- Main cleanup task implementation
-
- Existing GitHub API wrapper
Next Steps
- Review current GitHubProtocol.kt capabilities for container packages
- Decide on the preferred approach (gh CLI vs GitHubProtocol extension)
- Implement the chosen solution
- Test thoroughly with different authentication scenarios
This is a code quality improvement that will make the Docker operations more maintainable and consistent with the rest of the codebase.