FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add registry authentication to service updates by novofrank · Pull Request #2693 · docker-java/docker-java · GitHub

Repository navigation

Add registry authentication to service updates - #2693

Open
novofrank wants to merge 1 commit into
docker-java:mainfrom
novofrank:fix/update-service-registry-auth
Open

novofrank wants to merge 1 commit into
docker-java:mainfrom
novofrank:fix/update-service-registry-auth

Conversation

novofrank commented Sep 9, 2026 •
edited
Loading

Copy link
Copy Markdown

Summary

Adds registry authentication support to UpdateServiceCmd, bringing service updates in line with the authentication support already available when creating services.

Problem

A service update can change its container image. When the new image is hosted in a private registry, Docker requires registry credentials in the X-Registry-Auth request header. UpdateServiceCmd did not expose an AuthConfig option, so callers could not provide those credentials and Swarm could not pull the private image during an update.

Implementation

  • add optional AuthConfig accessors to UpdateServiceCmd
  • store the authentication configuration in UpdateServiceCmdImpl with the project null-safety annotations and builder conventions
  • apply the existing resourceWithOptionalAuthConfig helper before executing the service-update request
  • extend PrivateRegistryRule so an integration test can run the registry in the same Docker daemon as the Swarm worker

Running the registry in the Swarm Docker-in-Docker daemon is important because localhost:5050 must resolve to the registry from the worker performing the image pull.

Compatibility

  • existing callers do not need to provide authentication
  • no X-Registry-Auth header is sent when AuthConfig is absent
  • the existing service-update request body, version parameter, and response handling remain unchanged
  • the feature uses the existing AuthConfig model and the existing authentication-header serialization path

Verification

  • mvn -pl docker-java -am -Dtest=UpdateServiceCmdExecTest -Dsurefire.failIfNoSpecifiedTests=false test — 2 tests passed
  • mvn -pl docker-java -am -DskipTests test-compile — Java 8 test compilation and checkstyle passed
  • mvn -f docker-java/pom.xml -Dit.test=UpdateSwarmServiceIT#testUpdateServiceWithRegistryAuth org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M4:integration-test — 1 test passed
  • git diff --check — passed

The executor tests verify both the serialized authentication header and its omission when authentication is not configured.

The integration test starts a service with a public image, pushes that image to an authenticated local registry, removes the local private-image tag, and then updates the service with AuthConfig. It waits until the replacement Swarm task is running the private image, ensuring the update really authenticated and pulled from the registry.

Allow UpdateServiceCmd to forward registry credentials through the X-Registry-Auth header. Cover header serialization with focused tests and verify service updates can pull an image from an authenticated private registry.
novofrank requested a review from a team as a code owner September 9, 2026 18:46

Copy link
Copy Markdown
Author

@eddumelendez Please review when you have a moment. Thank you.

Copy link
Copy Markdown
Author

@eddumelendez Hi just wanted to ping you on this. Will you have a chance to review this?

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
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


Back | FazBrowse Home | New Git URL