mirror of
https://github.com/redhat-actions/push-to-registry.git
synced 2025-04-19 22:26:18 +02:00
Modify input format to newline
Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
parent
38bde145f1
commit
dae1e56fb6
6 changed files with 27 additions and 7 deletions
|
@ -74,7 +74,8 @@ Refer to the [`podman push`](http://docs.podman.io/en/latest/markdown/podman-man
|
|||
<tr>
|
||||
<td>extra-args</td>
|
||||
<td>No</td>
|
||||
<td>Extra args to be passed to push command when pushing image.</td>
|
||||
<td>Extra args to be passed to podman push.
|
||||
Separate arguments by newline. Do not use quotes.</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
|
|
@ -32,7 +32,9 @@ inputs:
|
|||
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'
|
||||
description: |
|
||||
Extra args to be passed to podman push.
|
||||
Separate arguments by newline. Do not use quotes - @actions/exec will do the quoting for you.
|
||||
required: false
|
||||
|
||||
outputs:
|
||||
|
|
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
15
src/index.ts
15
src/index.ts
|
@ -3,6 +3,7 @@ import * as exec from "@actions/exec";
|
|||
import * as io from "@actions/io";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import { splitByNewline } from "./util";
|
||||
|
||||
interface ExecResult {
|
||||
exitCode: number;
|
||||
|
@ -43,7 +44,15 @@ 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");
|
||||
|
||||
const inputExtraArgsStr = core.getInput("extra-args");
|
||||
let podmanExtraArgs: string[] = [];
|
||||
if (inputExtraArgsStr) {
|
||||
// transform the array of lines into an array of arguments
|
||||
// by splitting over lines, then over spaces, then trimming.
|
||||
const lines = splitByNewline(inputExtraArgsStr);
|
||||
podmanExtraArgs = lines.flatMap((line) => line.split(" ")).map((arg) => arg.trim());
|
||||
}
|
||||
|
||||
imageToPush = `${imageInput}`;
|
||||
const registryPathList: string[] = [];
|
||||
|
@ -160,8 +169,8 @@ async function run(): Promise<void> {
|
|||
registryPath,
|
||||
];
|
||||
|
||||
if (extraArgs) {
|
||||
args.push(extraArgs);
|
||||
if (podmanExtraArgs.length > 0) {
|
||||
args.push(...podmanExtraArgs);
|
||||
}
|
||||
|
||||
// check if tls-verify is not set to null
|
||||
|
|
8
src/util.ts
Normal file
8
src/util.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
/***************************************************************************************************
|
||||
* Copyright (c) Red Hat, Inc. All rights reserved.
|
||||
* Licensed under the MIT License. See LICENSE file in the project root for license information.
|
||||
**************************************************************************************************/
|
||||
|
||||
export function splitByNewline(s: string): string[] {
|
||||
return s.split(/\r?\n/);
|
||||
}
|
Loading…
Add table
Reference in a new issue