@@ -434,7 +434,7 @@ def pull(self, repository, tag=None, stream=False, auth_config=None,
434434 return self ._result (response )
435435
436436 def push (self , repository , tag = None , stream = False , auth_config = None ,
437- decode = False ):
437+ decode = False , platform = None ):
438438 """
439439 Push an image or a repository to the registry. Similar to the ``docker
440440 push`` command.
@@ -448,6 +448,7 @@ def push(self, repository, tag=None, stream=False, auth_config=None,
448448 ``username`` and ``password`` keys to be valid.
449449 decode (bool): Decode the JSON data from the server into dicts.
450450 Only applies with ``stream=True``
451+ platform (str): JSON-encoded OCI platform to select the platform-variant to push. If not provided, all available variants will attempt to be pushed.
451452
452453 Returns:
453454 (generator or str): The output from the server.
@@ -488,6 +489,13 @@ def push(self, repository, tag=None, stream=False, auth_config=None,
488489 log .debug ('Sending supplied auth config' )
489490 headers ['X-Registry-Auth' ] = auth .encode_header (auth_config )
490491
492+ if platform is not None :
493+ if utils .version_lt (self ._version , '1.46' ):
494+ raise errors .InvalidVersion (
495+ 'platform was only introduced in API version 1.46'
496+ )
497+ params ['platform' ] = platform
498+
491499 response = self ._post_json (
492500 u , None , headers = headers , stream = stream , params = params
493501 )
0 commit comments