Add tls-verify flag

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
divyansh42 2020-11-27 11:44:15 +05:30 committed by Tim Etchells
parent c126414560
commit ce33c28bcc
5 changed files with 25 additions and 6 deletions

View file

@ -5,7 +5,7 @@
[![license badge](https://img.shields.io/github/license/redhat-actions/push-to-registry)](./LICENSE)
[![size badge](https://img.shields.io/github/size/redhat-actions/push-to-registry/dist/index.js)](./dist)
Push-to-registry is a GitHub Action for pushing an OCI-compatible image to an image registry, such as Dockerhub, Quay&#46;io, or an OpenShift integrated registry.
Push-to-registry is a GitHub Action for pushing a container image to an image registry, such as Dockerhub, Quay&#46;io, or an OpenShift integrated registry.
This action only runs on Linux, as it uses [podman](https://github.com/containers/Podman) to perform the push. [GitHub's Ubuntu action runners](https://github.com/actions/virtual-environments#available-environments) come with Podman preinstalled. If you are not using those runners, you must first [install Podman](https://podman.io/getting-started/installation).
@ -55,6 +55,12 @@ This action only runs on Linux, as it uses [podman](https://github.com/container
<td>Yes</td>
<td>Password, encrypted password, or access token with which to authenticate to the registry.</td>
</tr>
<tr>
<td>tls-verify</td>
<td>No</td>
<td>Verify TLS certificates when contacting the registry. Set to "false" to skip certificate verification.</td>
</tr>
</table>
## Action Outputs

View file

@ -21,9 +21,14 @@ inputs:
password:
description: 'Password to use as credential to authenticate to the registry'
required: true
tls-verify:
description: 'Verify TLS certificates when contacting the registry'
required: false
default: 'true'
outputs:
image-url:
description: 'Complete URL of the pushed image'
registry-path:
description: 'The registry path to which the image was 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

View file

@ -9,6 +9,7 @@ export async function run(): Promise<void> {
const registry = core.getInput('registry', { required: true });
const username = core.getInput('username', { required: true });
const password = core.getInput('password', { required: true });
const tlsVerify = core.getInput('tls-verify');
// get podman cli
const podman = await io.which('podman', true);
@ -41,7 +42,14 @@ export async function run(): Promise<void> {
const creds: string = `${username}:${password}`;
await execute(podman, ['push', '--quiet', '--creds', creds, imageToPush, registryPath]);
const args: string[] = ['push', '--quiet', '--creds', creds, imageToPush, registryPath];
// check if tls-verify is not set to null
if (tlsVerify) {
args.push(`--tls-verify=${tlsVerify}`);
}
await execute(podman, args);
core.info(`Successfully pushed ${imageToPush} to ${registryPath}.`);