Add feature to pass extra args when pushing image

If a user wants to pass few extra args to push
command when pushing image, then he can pass
using 'extra-args' input parameter.

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
divyansh42 2021-01-28 15:45:07 +05:30
parent e7b5c08b38
commit 38bde145f1
4 changed files with 18 additions and 2 deletions

View file

@ -68,7 +68,15 @@ Refer to the [`podman push`](http://docs.podman.io/en/latest/markdown/podman-man
<td>digestfile</td>
<td>No</td>
<td>After copying the image, write the digest of the resulting image to the file. By default, the filename will be determined from the image and tag.
The contents of this file are the <code>digest</code> output.
The contents of this file are the <code>digest</code> output.</td>
</tr>
<tr>
<td>extra-args</td>
<td>No</td>
<td>Extra args to be passed to push command when pushing image.</td>
</tr>
</table>
## Action Outputs

View file

@ -31,6 +31,9 @@ inputs:
By default, the filename will be determined from the image and tag.
The contents of this file are the digest output.
required: false
extra-args:
description: 'Extra args to be passed to push command when pushing image'
required: false
outputs:
digest:

View file

@ -43,6 +43,7 @@ async function run(): Promise<void> {
const password = core.getInput("password", { required: true });
const tlsVerify = core.getInput("tls-verify");
const digestFileInput = core.getInput("digestfile");
const extraArgs = core.getInput("extra-args");
imageToPush = `${imageInput}`;
const registryPathList: string[] = [];
@ -159,6 +160,10 @@ async function run(): Promise<void> {
registryPath,
];
if (extraArgs) {
args.push(extraArgs);
}
// check if tls-verify is not set to null
if (tlsVerify) {
args.push(`--tls-verify=${tlsVerify}`);