Repository navigation
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors and extends the gcluster image building and prerequisite checking capabilities to support non-Google Artifact Registry (GAR) OCI registries, such as Harbor or local registries, including support for insecure registries and proper WORKDIR alignment. Feedback on the changes includes preserving all project-independent CLI tool states (like GKEGCloudAuthPluginInstalled) when resetting stale prerequisite states in cmd/job/prereq_build.go to avoid defeating the cache, and deferring the closure of the HTTP response body in pingRegistryV2 within pkg/imagebuilder/registry_check.go to prevent potential resource leaks.
…t non-GAR OCI registries - Nil-safely inspect baseImg.ConfigFile().Config.WorkingDir and extract --build-context files into WORKDIR (defaulting unset or '/' WORKDIR to /workspace via mutate.Config), normalize reproducible tar headers, and preserve executable file modes. - Support non-GAR OCI destination registries (GCLUSTER_IMAGE_REPO=<host>[/<repo>] or auto-derived <host>/gcluster/<namespace>/<workload>:<hash> from private/local --base-image), [IPv6]:port authorities, Docker keychain auth, GCLUSTER_INSECURE_REGISTRY=true, plain-HTTP private/loopback fallback, and domain-scoped GAR project paths. - Inspect non-GAR destination registries via a bounded 2s GET /v2/ ping and Docker keychain check instead of probing Google Cloud APIs, and resolve build target namespaces lazily with job.GKENamespace precedence.
…mespace errors, and drop dead pool fields
…un build offline-safe, and remove thin wrappers
358b2ab to
fdf6790
Compare
Summary
Aligns
gcluster job submit --build-contextCrane container packaging with the base image'sWORKDIRand adds first-class support for non-Artifact Registry OCI registries (such as Harbor and local IPv4/IPv6 registries) without requiring Google Cloud APIs when pushing outside Artifact Registry.WORKDIR-Aligned Crane Packaging & Reproducible Tar Layers (pkg/imagebuilder/crane_builder.go):baseImg.ConfigFile().Config.WorkingDir(normalizing POSIX/paths) and prefixes--build-contexttar entries with that directory; whenWORKDIRis unset or/, setsWORKDIR /workspaceviamutate.Configand extracts into/workspaceso relative commands (--command "python app.py") resolve consistently across base images.0755/0644), and mixesbaseImage|platform|contentHashinto built tags.pkg/imagebuilder/crane_builder.go,pkg/orchestrator/gke/gke_job_orchestrator.go,cmd/job/submit.go):[IPv6]:portand bare IPv6 registry authorities vianet.SplitHostPort, authenticates viaauthn.DefaultKeychain(~/.docker/config.json), supportsGCLUSTER_INSECURE_REGISTRY=trueplus plain-HTTP fallback on loopback/RFC 1918/IPv6 ULA hosts, and formats domain-scoped GCP project IDs (:->/) on Artifact Registry paths.GCLUSTER_IMAGE_REPO=<host>[/<repository>]for OCI registries and auto-derives<host>/gcluster/<namespace>/<workload>:<content-hash>(without requiringUSER/USERNAME) whenGCLUSTER_IMAGE_REPOis unset and--base-imagetargets a private/local OCI registry.g.getCurrentNamespace(preferring explicitjob.GKENamespacewithout mutatingg.namespace, falling back to"default"on offline--dry-run, and failing fast on live builds) only whenjob.BaseImage != ""so prebuilt--imagesubmissions never touch kubeconfig./v2/Prerequisite Check (pkg/imagebuilder/registry_check.go,cmd/job/prereq_build.go):2sGET /v2/ping andauthn.DefaultKeychaincheck on401 Unauthorizedinstead of probing Google Cloud APIs, preserves installed local CLI binary flags across project switches and 24h TTL expiry, and proceeds with a warning when cross-project GAR pushes lackserviceusage.services.listIAM permission.Cloud-Docs: none
Testing
KUBECONFIG=/dev/null GOOGLE_API_USE_CLIENT_CERTIFICATE=false go test -race -count=1 ./pkg/imagebuilder/... ./pkg/orchestrator/gke/... ./cmd/job/...TestNormalizeRegistryHost,TestIsGoogleArtifactRegistryAndPrivateHost,TestResolveDestinationRepo,TestGenerateImageName_NonGARScopingAndNoUserEnv,TestBuildContainerImageFromBaseImage_WorkdirAlignmentAndModes,TestBuildContainerImageFromBaseImage_LocalHTTPAndAuthKeychain,TestBuildContainerImageFromBaseImage_InvalidImageRepoFailsBeforePull,TestBuildContainerImageFromBaseImage_PullAndPushErrors,TestInspectTargetRegistry_OpenAndAuthKeychain,TestInspectTargetRegistry_TLSAndHTTPErrors,TestBuildContainerImage_NamespacePrecedenceAndPrebuiltHermeticity,TestBuildContainerImage_OfflineDryRunFallbackAndLiveError,TestEnsureBuildPrerequisites_ExplicitGARSkipsGKEAuthPluginAndPreservesCache,TestEnsureBuildPrerequisites_CrossProjectGARPermissionDeniedProceeds,TestEnsureBuildPrerequisites_NonGARLocalRegistry, andTestValidateBuildContext_OCIRegistries.