Resolve review comments

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
divyansh42 2021-01-28 13:06:40 +05:30
parent 73da53f4a0
commit 3b62e47486
8 changed files with 79 additions and 79 deletions

View file

@ -6,7 +6,7 @@ on: [ push, workflow_dispatch ]
env:
IMAGE_NAME: myimage
IMAGE_REGISTRY: quay.io
IMAGE_TAG: latest
IMAGE_TAGS: v1 ${{ github.sha }}
jobs:
build:
@ -23,9 +23,7 @@ jobs:
FROM busybox
RUN echo "hello world"
EOF
docker tag ${{ env.IMAGE_NAME }}:v1 ${{ env.IMAGE_NAME }}:v2
docker tag ${{ env.IMAGE_NAME }}:v1 ${{ env.IMAGE_NAME }}:v3
docker tag ${{ env.IMAGE_NAME }}:v1 ${{ env.IMAGE_NAME }}:${{ github.sha }}
# Push the image to image registry
- name: Push To Quay
@ -33,7 +31,7 @@ jobs:
id: push
with:
image: ${{ env.IMAGE_NAME }}
tags: v1 v2 v3
tags: ${{ env.IMAGE_TAGS }}
registry: ${{ env.IMAGE_REGISTRY }}/${{ secrets.REGISTRY_USER }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

View file

@ -31,10 +31,10 @@ Refer to the [`podman push`](http://docs.podman.io/en/latest/markdown/podman-man
</tr>
<tr>
<td>tag</td>
<td>tags</td>
<td>No</td>
<td>
Image tag to push.<br>
The tag or tags of the image to push. For multiple tags, seperate by a space. For example, <code>latest {{ github.sha }}</code><br>
Defaults to <code>latest</code>.
</td>
</tr>
@ -73,12 +73,12 @@ Refer to the [`podman push`](http://docs.podman.io/en/latest/markdown/podman-man
## Action Outputs
`registry-paths`: The List of registry paths to which the tag(s) were pushed.<br>
For example, `quay.io/username/spring-image:v1,quay.io/username/spring-image:v2`.
`registry-paths`: A JSON array of registry paths to which the tag(s) were pushed.<br>
For example, `[ quay.io/username/spring-image:v1,quay.io/username/spring-image:latest ]`.
`digest`: The pushed image digest, as written to the `digestfile`.<br>
For example, `sha256:66ce924069ec4181725d15aa27f34afbaf082f434f448dc07a42daa3305cdab3`.
For multiple tags, digest remains same.
For multiple tags, the digest remains same.
## Examples
@ -94,16 +94,18 @@ jobs:
runs-on: ubuntu-latest
env:
IMAGE_NAME: my-app
IMAGE_TAG: latest
IMAGE_TAGS: latest v1
steps:
- uses: actions/checkout@v2
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v1
with:
image: ${{ env.IMAGE_NAME }}
tag: ${{ env.TAG }}
tags: ${{ env.IMAGE_TAGS }}
base-image: some_image
dockerfiles: |
./Dockerfile
@ -111,8 +113,8 @@ jobs:
id: push-to-quay
uses: redhat-actions/push-to-registry@v1
with:
image: ${{ env.IMAGE_NAME }}
tag: ${{ env.TAG }}
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: ${{ secrets.QUAY_REPO }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_TOKEN }}

View file

@ -9,7 +9,7 @@ inputs:
description: 'Name of the image to push'
required: true
tags:
description: 'The tags of the image to push. For multiple tags, seperate by a space. For example, "v1 v0.1".'
description: 'The tag or tags of the image to push. For multiple tags, seperate by a space. For example, "latest v1"'
required: false
default: 'latest'
registry:
@ -34,9 +34,9 @@ inputs:
outputs:
digest:
description: 'The pushed image digest, as written to the `digestfile`'
description: 'The pushed image digest, as written to the "digestfile"'
registry-paths:
description: 'List of registry paths to which the tag(s) were pushed'
description: 'A JSON array of registry paths to which the tag(s) were pushed'
runs:
using: 'node12'
main: 'dist/index.js'

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

98
package-lock.json generated
View file

@ -114,9 +114,9 @@
}
},
"@redhat-actions/eslint-config": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@redhat-actions/eslint-config/-/eslint-config-1.2.0.tgz",
"integrity": "sha512-HFpdgXIB01wmZbCsEpaY0UhQlRBiM/kJxO0WCufIx/wTxepewwsLTsgCgKkljbGfSaqN7FMJ/TbwY1CY/ltHcw==",
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@redhat-actions/eslint-config/-/eslint-config-1.2.11.tgz",
"integrity": "sha512-hS8XXkpWu32Z3S6+EFAvD32+QruxyLiSfqrXjkaSLtWZndkJLNZ/xpHcEwRM1u7KJzd1f7jPl46+GLFfrPT8RQ==",
"dev": true,
"requires": {
"eslint-config-airbnb-base": ">= 14",
@ -130,9 +130,9 @@
"dev": true
},
"@types/json-schema": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
"integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==",
"version": "7.0.7",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz",
"integrity": "sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==",
"dev": true
},
"@types/json5": {
@ -148,13 +148,13 @@
"dev": true
},
"@typescript-eslint/eslint-plugin": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.0.tgz",
"integrity": "sha512-IJ5e2W7uFNfg4qh9eHkHRUCbgZ8VKtGwD07kannJvM5t/GU8P8+24NX8gi3Hf5jST5oWPY8kyV1s/WtfiZ4+Ww==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz",
"integrity": "sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "4.14.0",
"@typescript-eslint/scope-manager": "4.14.0",
"@typescript-eslint/experimental-utils": "4.14.1",
"@typescript-eslint/scope-manager": "4.14.1",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"lodash": "^4.17.15",
@ -164,55 +164,55 @@
}
},
"@typescript-eslint/experimental-utils": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.0.tgz",
"integrity": "sha512-6i6eAoiPlXMKRbXzvoQD5Yn9L7k9ezzGRvzC/x1V3650rUk3c3AOjQyGYyF9BDxQQDK2ElmKOZRD0CbtdkMzQQ==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz",
"integrity": "sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.14.0",
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/typescript-estree": "4.14.0",
"@typescript-eslint/scope-manager": "4.14.1",
"@typescript-eslint/types": "4.14.1",
"@typescript-eslint/typescript-estree": "4.14.1",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
}
},
"@typescript-eslint/parser": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.0.tgz",
"integrity": "sha512-sUDeuCjBU+ZF3Lzw0hphTyScmDDJ5QVkyE21pRoBo8iDl7WBtVFS+WDN3blY1CH3SBt7EmYCw6wfmJjF0l/uYg==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.1.tgz",
"integrity": "sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "4.14.0",
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/typescript-estree": "4.14.0",
"@typescript-eslint/scope-manager": "4.14.1",
"@typescript-eslint/types": "4.14.1",
"@typescript-eslint/typescript-estree": "4.14.1",
"debug": "^4.1.1"
}
},
"@typescript-eslint/scope-manager": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.0.tgz",
"integrity": "sha512-/J+LlRMdbPh4RdL4hfP1eCwHN5bAhFAGOTsvE6SxsrM/47XQiPSgF5MDgLyp/i9kbZV9Lx80DW0OpPkzL+uf8Q==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz",
"integrity": "sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/visitor-keys": "4.14.0"
"@typescript-eslint/types": "4.14.1",
"@typescript-eslint/visitor-keys": "4.14.1"
}
},
"@typescript-eslint/types": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.0.tgz",
"integrity": "sha512-VsQE4VvpldHrTFuVPY1ZnHn/Txw6cZGjL48e+iBxTi2ksa9DmebKjAeFmTVAYoSkTk7gjA7UqJ7pIsyifTsI4A==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.1.tgz",
"integrity": "sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.0.tgz",
"integrity": "sha512-wRjZ5qLao+bvS2F7pX4qi2oLcOONIB+ru8RGBieDptq/SudYwshveORwCVU4/yMAd4GK7Fsf8Uq1tjV838erag==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz",
"integrity": "sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/visitor-keys": "4.14.0",
"@typescript-eslint/types": "4.14.1",
"@typescript-eslint/visitor-keys": "4.14.1",
"debug": "^4.1.1",
"globby": "^11.0.1",
"is-glob": "^4.0.1",
@ -222,12 +222,12 @@
}
},
"@typescript-eslint/visitor-keys": {
"version": "4.14.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.0.tgz",
"integrity": "sha512-MeHHzUyRI50DuiPgV9+LxcM52FCJFYjJiWHtXlbyC27b80mfOwKeiKI+MHOTEpcpfmoPFm/vvQS88bYIx6PZTA==",
"version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz",
"integrity": "sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==",
"dev": true,
"requires": {
"@typescript-eslint/types": "4.14.0",
"@typescript-eslint/types": "4.14.1",
"eslint-visitor-keys": "^2.0.0"
}
},
@ -917,9 +917,9 @@
}
},
"flatted": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.0.tgz",
"integrity": "sha512-tW+UkmtNg/jv9CSofAKvgVcO7c2URjhTdW1ZTkcAritblu8tajiYy7YisnIflEwtKssCtOxpnBRoCB7iap0/TA==",
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.1.1.tgz",
"integrity": "sha512-zAoAQiudy+r5SvnSw3KJy5os/oRJYHzrzja/tBDqrZtNhUw8bt6y8OBzMWcjWr+8liV8Eb6yOhw8WZ7VFZ5ZzA==",
"dev": true
},
"fs.realpath": {
@ -941,9 +941,9 @@
"dev": true
},
"get-intrinsic": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.2.tgz",
"integrity": "sha512-aeX0vrFm21ILl3+JpFFRNe9aUvp6VFZb2/CTbgLb8j75kOhvoNYjt9d8KA/tJG4gSo8nzEDedRl0h7vDmBYRVg==",
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.0.tgz",
"integrity": "sha512-M11rgtQp5GZMZzDL7jLTNxbDfurpzuau5uqRWDPvlHjfvg3TdScAZo96GLvhMjImrmR8uAt0FS2RLoMrfWGKlg==",
"dev": true,
"requires": {
"function-bind": "^1.1.1",
@ -1806,9 +1806,9 @@
"dev": true
},
"tsutils": {
"version": "3.19.1",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.19.1.tgz",
"integrity": "sha512-GEdoBf5XI324lu7ycad7s6laADfnAqCw6wLGI+knxvw9vsIYBaJfYdmeCEG3FMMUiSm3OGgNb+m6utsWf5h9Vw==",
"version": "3.20.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz",
"integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==",
"dev": true,
"requires": {
"tslib": "^1.8.1"

View file

@ -18,11 +18,11 @@
"@actions/io": "^1.0.2"
},
"devDependencies": {
"@redhat-actions/eslint-config": "^1.2.0",
"@redhat-actions/eslint-config": "^1.2.11",
"@redhat-actions/tsconfig": "^1.1.0",
"@types/node": "^12.12.7",
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
"@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.1",
"@vercel/ncc": "^0.25.1",
"eslint": "^7.18.0",
"typescript": "^4.0.5"

View file

@ -30,7 +30,7 @@ const dockerBaseUrl = "docker.io/library";
async function run(): Promise<void> {
const imageInput = core.getInput("image", { required: true });
const tags = core.getInput("tags");
const tags = core.getInput("tags") || "latest";
// split tags
tagsList = tags.split(" ");
const registry = core.getInput("registry", { required: true });
@ -58,26 +58,26 @@ async function run(): Promise<void> {
const isPodmanImageLatest = await isPodmanLocalImageLatest();
if (!isPodmanImageLatest) {
core.warning(`The version of ${imageToPush} in the Docker image storage is more recent `
+ `than the version in the Podman image storage. The image from the Docker image storage `
+ `than the version in the Podman image storage. The image(s) from the Docker image storage `
+ `will be pushed.`);
imageToPush = `${dockerBaseUrl}/${imageToPush}`;
isImageFromDocker = true;
}
else {
core.warning(`The version of ${imageToPush} in the Podman image storage is more recent `
+ `than the version in the Docker image storage. Tag(s) of the image from the Podman image `
+ `than the version in the Docker image storage. The image(s) from the Podman image `
+ `storage will be pushed.`);
}
}
else if (isPresentInDocker) {
imageToPush = `${dockerBaseUrl}/${imageToPush}`;
core.info(`${imageToPush} was found in the Docker image storage, but not in the Podman `
+ `image storage. Tag(s) of the image will be pulled into Podman image storage, pushed, and then `
+ `image storage. The image(s) will be pulled into Podman image storage, pushed, and then `
+ `removed from the Podman image storage.`);
isImageFromDocker = true;
}
let pushMsg = `Pushing ${imageToPush} with tags ${tagsList.toString()} to ${registry}`;
let pushMsg = `Pushing ${imageToPush} with tags ${tagsList.join(", ")} to ${registry}`;
if (username) {
pushMsg += ` as ${username}`;
}
@ -118,7 +118,7 @@ async function run(): Promise<void> {
}
await execute(await getPodmanPath(), args);
core.info(`Successfully pushed ${imageWithTag} to ${registryPath}.`);
core.info(`Successfully pushed ${imageWithTag} to ${registryPath}`);
registryPathList.push(registryPath);
}
@ -132,7 +132,7 @@ async function run(): Promise<void> {
core.warning(`Failed to read digest file "${digestFile}": ${err}`);
}
core.setOutput("registry-paths", registryPathList.toString());
core.setOutput("registry-paths", JSON.stringify(registryPathList));
}
async function pullImageFromDocker(): Promise<boolean> {
@ -154,7 +154,7 @@ async function pullImageFromDocker(): Promise<boolean> {
async function checkImageInPodman(): Promise<boolean> {
// check if images exist in Podman's storage
core.info(`Checking if ${imageToPush} with tag(s) ${tagsList.toString()} is present in Podman image storage`);
core.info(`Checking if ${imageToPush} with tag(s) ${tagsList.join(", ")} is present in Podman image storage`);
let imageWithTag;
try {
for (const tag of tagsList) {