Skip to content

Commit

Permalink
v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DaemonDude23 committed Jan 24, 2023
1 parent 474a3ac commit 70d2c37
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@

---

# [v0.5.0](https://github.com/DaemonDude23/container-image-replicator/releases/tag/v0.5.0) - Jan 23 2023
# [v0.6.0](https://github.com/DaemonDude23/container-image-replicator/releases/tag/v0.6.0) - Jan 23 2023

**Enhancements**

- Reduce `if` conditions for force pull or push.
- Remove a redundant check on the destination repo.

# [0.6.0](https://github.com/DaemonDude23/container-image-replicator/releases/tag/b0.6.0) - Jan 23 2023

**Enhancements**

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ images: # required
- For local installation/use of the raw script, I use a local virtual environment to isolate dependencies:

```bash
git clone https://github.com/DaemonDude23/container-image-replicator.git -b v0.5.0
git clone https://github.com/DaemonDude23/container-image-replicator.git -b b0.6.0
cd container-image-replicator
```

Expand Down
18 changes: 11 additions & 7 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def init_arg_parser():
help="don't check destination or local image cache and pull and push.\
Useful for mutable tags. Be careful, as this can hit rate limits quickly!",
)
args_optional.add_argument("--version", "-v", action="version", version="v0.5.0")
args_optional.add_argument("--version", "-v", action="version", version="b0.6.0")
args_required.add_argument("input_file", action="store", help="path to YAML file containing registry information", type=Path)

arguments = parser.parse_args()
Expand Down Expand Up @@ -232,22 +232,25 @@ def check_remote(
force_pull (bool): force pull, used for immutable tags
force_push (bool): force push, used for immutable tags
"""
if arguments.force_pull_push or force_pull or force_push:
if force_pull:
pull_image(source_repository, source_tag)
if force_push:
push_image(destination_repository, destination_tag)
image_already_pushed: bool = False
if arguments.force_pull_push or force_pull:
pull_image(source_repository, source_tag)
if arguments.force_pull_push or force_push:
push_image(destination_repository, destination_tag)

if verify_destination_image(docker_client, destination_endpoint):
logging.info(f"{destination_endpoint} - image pushed successfully")
image_already_pushed = True
else:
logging.critical(f"{destination_endpoint} - a silent error occurred when pushing the image")
else:

if not image_already_pushed:
if not verify_destination_image(docker_client, destination_endpoint):
# see if image exists locally and pull from the source registry if it doesn't
verify_local_image(
docker_api, source_endpoint, source_repository, source_tag, destination_repository, destination_tag, final_sha256
)

push_image(destination_repository, destination_tag)

if verify_destination_image(docker_client, destination_endpoint):
Expand All @@ -256,6 +259,7 @@ def check_remote(
logging.critical(f"{destination_endpoint} - a silent error occurred when pushing the image")
else:
logging.info(f"{destination_endpoint} - already present in destination. Skipping push")

return True


Expand Down

0 comments on commit 70d2c37

Please sign in to comment.