mirror of
https://github.com/redhat-actions/push-to-registry.git
synced 2025-02-23 10:31:22 +01:00
Add tls-verify flag
Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
parent
c126414560
commit
ce33c28bcc
5 changed files with 25 additions and 6 deletions
|
@ -5,7 +5,7 @@
|
||||||
[](./LICENSE)
|
[](./LICENSE)
|
||||||
[](./dist)
|
[](./dist)
|
||||||
|
|
||||||
Push-to-registry is a GitHub Action for pushing an OCI-compatible image to an image registry, such as Dockerhub, Quay.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.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).
|
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>Yes</td>
|
||||||
<td>Password, encrypted password, or access token with which to authenticate to the registry.</td>
|
<td>Password, encrypted password, or access token with which to authenticate to the registry.</td>
|
||||||
</tr>
|
</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>
|
</table>
|
||||||
|
|
||||||
## Action Outputs
|
## Action Outputs
|
||||||
|
|
|
@ -21,9 +21,14 @@ inputs:
|
||||||
password:
|
password:
|
||||||
description: 'Password to use as credential to authenticate to the registry'
|
description: 'Password to use as credential to authenticate to the registry'
|
||||||
required: true
|
required: true
|
||||||
|
tls-verify:
|
||||||
|
description: 'Verify TLS certificates when contacting the registry'
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
image-url:
|
registry-path:
|
||||||
description: 'Complete URL of the pushed image'
|
description: 'The registry path to which the image was pushed'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
10
src/index.ts
10
src/index.ts
|
@ -9,6 +9,7 @@ export async function run(): Promise<void> {
|
||||||
const registry = core.getInput('registry', { required: true });
|
const registry = core.getInput('registry', { required: true });
|
||||||
const username = core.getInput('username', { required: true });
|
const username = core.getInput('username', { required: true });
|
||||||
const password = core.getInput('password', { required: true });
|
const password = core.getInput('password', { required: true });
|
||||||
|
const tlsVerify = core.getInput('tls-verify');
|
||||||
|
|
||||||
// get podman cli
|
// get podman cli
|
||||||
const podman = await io.which('podman', true);
|
const podman = await io.which('podman', true);
|
||||||
|
@ -41,7 +42,14 @@ export async function run(): Promise<void> {
|
||||||
|
|
||||||
const creds: string = `${username}:${password}`;
|
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}.`);
|
core.info(`Successfully pushed ${imageToPush} to ${registryPath}.`);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue