Skip to content

Commit

Permalink
Solve issue when image is present in Podman and Docker both (#16)
Browse files Browse the repository at this point in the history
* Solve issue when image is present in Podman and Docker both

If updated docker image is present in docker env then
docker image won't get used if image same name and tag
is already present in podman env.
To fix this, selected latest built image and removed the
image at the end from the podman env if image is pulled
from docker env.

Signed-off-by: divyansh42 <[email protected]>
  • Loading branch information
divyansh42 authored Jan 19, 2021
1 parent b038efb commit 23eb62f
Show file tree
Hide file tree
Showing 9 changed files with 2,061 additions and 71 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// eslint-disable-next-line no-undef
module.exports = {
extends: [
"@redhat-actions/eslint-config",
],
};
16 changes: 9 additions & 7 deletions .github/workflows/verify-push.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# This workflow will perform a test whenever there
# is some change in code done to ensure that the changes
# are not buggy and we are getting the desired output.
name: Test Push
on: [ push, pull_request, workflow_dispatch ]
name: Test Push without image
on: [ push, workflow_dispatch ]
env:
IMAGE_NAME: hello-world
IMAGE_NAME: myimage
IMAGE_REGISTRY: quay.io
IMAGE_TAG: latest

Expand All @@ -17,9 +17,12 @@ jobs:
- name: Checkout Push to Registry action
uses: actions/checkout@v2

# Pull hello-world image to push in next step
- name: Pull Hello world image
run: docker pull ${{ env.IMAGE_NAME }}
- name: Build Image using Docker
run: |
docker build -t ${{ env.IMAGE_NAME }}:latest -<<EOF
FROM busybox
RUN echo "hello world"
EOF
# Push the image to image registry
- name: Push To Quay
Expand All @@ -32,7 +35,6 @@ jobs:
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}


- name: Echo outputs
run: |
echo "registry-path ${{ steps.push.outputs.registry-path }}"
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@ jobs:
run: echo "New image has been pushed to ${{ steps.push-to-quay.outputs.registry-path }}"
```
## Note about images built with Docker
This action uses `Podman` to push, but can also push images built with `Docker`. However, Docker and Podman store their images in different locations, and Podman can only push images in its own storage.

If the image to push is present in the Docker image storage but not in the Podman image storage, it will be pulled into Podman's storage.

If the image to push is present in both the Docker and Podman image storage, the action will push the image which was more recently built, and log a warning.

If the action pulled an image from the Docker image storage into the Podman storage, it will be cleaned up from the Podman storage before the action exits.

## Troubleshooting
Note that quay.io repositories are private by default.<br>

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 23eb62f

Please sign in to comment.