forked from coreos/coreos-assembler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cosa push-container-manifest command
This will create and push a container manifest (i.e. one that contains multiple images from different architectures) to a remote registry. (cherry picked from commit 8e5ad58) jlebon: Had to manually add `push-container-manifest` to the entrypoint.
- Loading branch information
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/python3 | ||
|
||
# Push a container manifest (i.e. multi-arch) to a container registry based on | ||
# arguments provided by ther user. | ||
|
||
# The inverse of cmd-buildfetch (i.e. we upload a build which later can be | ||
# partially re-downloaded with cmd-buildfetch). | ||
|
||
import argparse | ||
import os | ||
import sys | ||
from cosalib.container_manifest import create_and_push_container_manifest | ||
|
||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) | ||
|
||
|
||
def main(): | ||
args = parse_args() | ||
if args.authfile: | ||
os.environ["REGISTRY_AUTH_FILE"] = args.authfile | ||
create_and_push_container_manifest( | ||
args.repo, args.tag, args.images, args.v2s2) | ||
|
||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser( | ||
prog="CoreOS Assembler Push Container Manifest", | ||
description="Create and push a container manifest to a registry", | ||
usage=""" | ||
Examples: | ||
export REGISTRY_AUTH_FILE=/path/to/auth.json | ||
cosa push-container-manifest \\ | ||
--repo quay.io/dustymabe/coreos-assembler --tag latest \\ | ||
--image docker://quay.io/dustymabe/coreos-assembler:x86_64-6864566 \\ | ||
--image docker://quay.io/dustymabe/coreos-assembler:s390x-6864566 \\ | ||
--image docker://quay.io/dustymabe/coreos-assembler:aarch64-6864566 | ||
cosa push-container-manifest \\ | ||
--repo quay.io/dustymabe/fedora-coreos --tag stable \\ | ||
--image oci-archive://builds/36.20220716.3.1/x86_64/fedora-coreos-37.20220725.91.0-ostree.x86_64.ociarchive \\ | ||
--image oci-archive://builds/36.20220716.3.1/aarch64/fedora-coreos-37.20220725.91.0-ostree.aarch64.ociarchive \\ | ||
--image oci-archive://builds/36.20220716.3.1/s390x/fedora-coreos-37.20220725.91.0-ostree.s390x.ociarchive""") | ||
parser.add_argument("--repo", required=True, help="The registry repo to target for the manifest") | ||
parser.add_argument("--tag", required=True, help="The tag of the manifest to use") | ||
parser.add_argument("--authfile", help="A file to use for registry auth") | ||
parser.add_argument('--v2s2', action='store_true', | ||
help='Use old image manifest version2 schema 2 format') | ||
parser.add_argument("--images", required=True, action='append', default=[], | ||
help="""The images to add to the manifest. Can be specified multiple times like | ||
--image docker://quay.io/dustymabe/coreos-assembler:s390x-686456 | ||
--image oci-archive://path/to/cosa-aarch64-686456.ociarchive""") | ||
|
||
return parser.parse_args() | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains 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