This commit is contained in:
omer2500 2023-08-29 20:31:32 +03:00 committed by GitHub
commit c8959a00d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 5175 additions and 4 deletions

View file

@ -59,7 +59,7 @@ After building your image, use [push-to-registry](https://github.com/redhat-acti
| workdir | The working directory to use within the container. | None | workdir | The working directory to use within the container. | None
| extra-args | Extra args to be passed to `buildah from`. Separate arguments by newline. Do not use quotes. | None | extra-args | Extra args to be passed to `buildah from`. Separate arguments by newline. Do not use quotes. | None
| tls-verify | Require HTTPS and verify certificates when accessing the registry. Set to `false` to skip the verification. This will be used with `buildah from` command. | `true` | tls-verify | Require HTTPS and verify certificates when accessing the registry. Set to `false` to skip the verification. This will be used with `buildah from` command. | `true`
| self-hosted-runner-root | If you are running on self hosted runner, you can set this so it will add "sudo" to every buildah command if you dont want to run rootless |`false`
<a id="image-tag-inputs"></a> <a id="image-tag-inputs"></a>
### Image and Tags Inputs ### Image and Tags Inputs
The `image` and `tags` inputs can be provided in one of two forms. The `image` and `tags` inputs can be provided in one of two forms.

View file

@ -82,6 +82,12 @@ inputs:
Require HTTPS and verify certificates when accessing the registry. Defaults to true. Require HTTPS and verify certificates when accessing the registry. Defaults to true.
required: false required: false
default: 'true' default: 'true'
self-hosted-runner-root:
description: |
If you are running on self hosted runner, you can set this so it will add "sudo" to every
buildah command if you dont want to run rootless. Defaults to false
required: false
default: 'false'
outputs: outputs:
image: image:
description: 'Name of the image built' description: 'Name of the image built'

5159
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

@ -130,6 +130,12 @@ export enum Inputs {
* Default: None. * Default: None.
*/ */
WORKDIR = "workdir", WORKDIR = "workdir",
/**
* If you are running on self hosted runner, you can set this so it will add "sudo" to every buildah command if you dont want to run rootless. Defaults to false
* Required: false
* Default: "false"
*/
SELF_HOSTED_RUNNER_ROOT = "self-hosted-runner-root",
} }
export enum Outputs { export enum Outputs {

View file

@ -19,8 +19,10 @@ export async function run(): Promise<void> {
} }
// get buildah cli // get buildah cli
const self_hosted_runner = core.getInput(Inputs.SELF_HOSTED_RUNNER_ROOT)
const buildahPath = await io.which("buildah", true); const buildahPath = await io.which("buildah", true);
const cli: BuildahCli = new BuildahCli(buildahPath); const buildahExec = self_hosted_runner === "true" ? `sudo ${buildahPath}` : buildahPath;
const cli: BuildahCli = new BuildahCli(buildahExec);
// print buildah version // print buildah version
await cli.execute([ "version" ], { group: true }); await cli.execute([ "version" ], { group: true });