Resolve review comments

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
divyansh42 2021-01-28 12:18:24 +05:30
parent 557824d2d1
commit 8fc3073634
9 changed files with 67 additions and 65 deletions

View file

@ -78,7 +78,7 @@ jobs:
uses: ./buildah-build/ uses: ./buildah-build/
with: with:
image: ${{ env.IMAGE_NAME }} image: ${{ env.IMAGE_NAME }}
tags: 'latest v2' tags: 'latest ${{ github.sha }}'
base-image: 'registry.access.redhat.com/openjdk/openjdk-11-rhel7' base-image: 'registry.access.redhat.com/openjdk/openjdk-11-rhel7'
# To avoid hardcoding a particular version of the binary. # To avoid hardcoding a particular version of the binary.
content: | content: |

View file

@ -34,7 +34,7 @@ After building your image, use [push-to-registry](https://github.com/redhat-acti
<td>tags</td> <td>tags</td>
<td>No</td> <td>No</td>
<td> <td>
The tags of the image to build. For multiple tags, seperate by a space. For example, <code>v1 v0.1</code>.<br> The tags of the image to build. For multiple tags, seperate by a space. For example, <code>latest ${{ github.sha }}</code>.<br>
Default: <code>latest</code> Default: <code>latest</code>
</td> </td>
</tr> </tr>
@ -42,7 +42,7 @@ After building your image, use [push-to-registry](https://github.com/redhat-acti
<tr> <tr>
<td>base-image</td> <td>base-image</td>
<td>No</td> <td>No</td>
<td>The base image to use to create the initial container.</td> <td>The base image to use for the container.</td>
</tr> </tr>
<tr> <tr>
@ -123,8 +123,8 @@ envs: |
`image`: The name of the built image.<br> `image`: The name of the built image.<br>
For example, `spring-image`. For example, `spring-image`.
`tags`: The list of tags delimeted by a space.<br> `tags`: A list of the tags that were created, separated by spaces.<br>
For example, `v1 v0.1`. For example, `latest ${{ github.sha }}`.
## Build Types ## Build Types

View file

@ -9,7 +9,7 @@ inputs:
description: 'The name (reference) of the image to build' description: 'The name (reference) of the image to build'
required: true required: true
tags: tags:
description: 'The tags of the image to build. For multiple tags, seperate by a space. For example, "v1 v0.1".' description: 'The tags of the image to build. For multiple tags, seperate by a space. For example, "latest v1".'
required: false required: false
default: latest default: latest
base-image: base-image:
@ -38,17 +38,17 @@ inputs:
description: 'List of environment variables to be set when running containers based on image' description: 'List of environment variables to be set when running containers based on image'
required: false required: false
build-args: build-args:
description: 'List of --build-args to pass to buildah.' description: 'List of --build-args to pass to buildah'
required: false required: false
oci: oci:
description: 'Set to true to build using the OCI image format instead of the Docker image format.' description: 'Set to true to build using the OCI image format instead of the Docker image format'
default: 'false' default: 'false'
required: false required: false
outputs: outputs:
image: image:
description: 'Name of the image built' description: 'Name of the image built'
tags: tags:
description: 'List of tags delimeted by a space' description: 'List of the tags that were created, separated by spaces'
runs: runs:
using: 'node12' using: 'node12'
main: 'dist/index.js' 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

86
package-lock.json generated
View file

@ -129,9 +129,9 @@
} }
}, },
"@redhat-actions/eslint-config": { "@redhat-actions/eslint-config": {
"version": "1.2.4", "version": "1.2.11",
"resolved": "https://registry.npmjs.org/@redhat-actions/eslint-config/-/eslint-config-1.2.4.tgz", "resolved": "https://registry.npmjs.org/@redhat-actions/eslint-config/-/eslint-config-1.2.11.tgz",
"integrity": "sha512-3Y+qEU2k5LBuOGmO4yY9/74GHWc3gCvFvRselFVV7Dzc43XeeicvOQSE0eoOFxTRakOY4WpXoJKh5pUOm4jOog==", "integrity": "sha512-hS8XXkpWu32Z3S6+EFAvD32+QruxyLiSfqrXjkaSLtWZndkJLNZ/xpHcEwRM1u7KJzd1f7jPl46+GLFfrPT8RQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"eslint-config-airbnb-base": ">= 14", "eslint-config-airbnb-base": ">= 14",
@ -163,13 +163,13 @@
"dev": true "dev": true
}, },
"@typescript-eslint/eslint-plugin": { "@typescript-eslint/eslint-plugin": {
"version": "4.14.0", "version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.14.1.tgz",
"integrity": "sha512-IJ5e2W7uFNfg4qh9eHkHRUCbgZ8VKtGwD07kannJvM5t/GU8P8+24NX8gi3Hf5jST5oWPY8kyV1s/WtfiZ4+Ww==", "integrity": "sha512-5JriGbYhtqMS1kRcZTQxndz1lKMwwEXKbwZbkUZNnp6MJX0+OVXnG0kOlBZP4LUAxEyzu3cs+EXd/97MJXsGfw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/experimental-utils": "4.14.0", "@typescript-eslint/experimental-utils": "4.14.1",
"@typescript-eslint/scope-manager": "4.14.0", "@typescript-eslint/scope-manager": "4.14.1",
"debug": "^4.1.1", "debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1", "functional-red-black-tree": "^1.0.1",
"lodash": "^4.17.15", "lodash": "^4.17.15",
@ -205,28 +205,28 @@
} }
}, },
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "4.14.0", "version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.14.1.tgz",
"integrity": "sha512-6i6eAoiPlXMKRbXzvoQD5Yn9L7k9ezzGRvzC/x1V3650rUk3c3AOjQyGYyF9BDxQQDK2ElmKOZRD0CbtdkMzQQ==", "integrity": "sha512-2CuHWOJwvpw0LofbyG5gvYjEyoJeSvVH2PnfUQSn0KQr4v8Dql2pr43ohmx4fdPQ/eVoTSFjTi/bsGEXl/zUUQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/scope-manager": "4.14.0", "@typescript-eslint/scope-manager": "4.14.1",
"@typescript-eslint/types": "4.14.0", "@typescript-eslint/types": "4.14.1",
"@typescript-eslint/typescript-estree": "4.14.0", "@typescript-eslint/typescript-estree": "4.14.1",
"eslint-scope": "^5.0.0", "eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0" "eslint-utils": "^2.0.0"
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "4.14.0", "version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.14.1.tgz",
"integrity": "sha512-sUDeuCjBU+ZF3Lzw0hphTyScmDDJ5QVkyE21pRoBo8iDl7WBtVFS+WDN3blY1CH3SBt7EmYCw6wfmJjF0l/uYg==", "integrity": "sha512-mL3+gU18g9JPsHZuKMZ8Z0Ss9YP1S5xYZ7n68Z98GnPq02pYNQuRXL85b9GYhl6jpdvUc45Km7hAl71vybjUmw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/scope-manager": "4.14.0", "@typescript-eslint/scope-manager": "4.14.1",
"@typescript-eslint/types": "4.14.0", "@typescript-eslint/types": "4.14.1",
"@typescript-eslint/typescript-estree": "4.14.0", "@typescript-eslint/typescript-estree": "4.14.1",
"debug": "^4.1.1" "debug": "^4.1.1"
}, },
"dependencies": { "dependencies": {
@ -248,29 +248,29 @@
} }
}, },
"@typescript-eslint/scope-manager": { "@typescript-eslint/scope-manager": {
"version": "4.14.0", "version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.14.1.tgz",
"integrity": "sha512-/J+LlRMdbPh4RdL4hfP1eCwHN5bAhFAGOTsvE6SxsrM/47XQiPSgF5MDgLyp/i9kbZV9Lx80DW0OpPkzL+uf8Q==", "integrity": "sha512-F4bjJcSqXqHnC9JGUlnqSa3fC2YH5zTtmACS1Hk+WX/nFB0guuynVK5ev35D4XZbdKjulXBAQMyRr216kmxghw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.14.0", "@typescript-eslint/types": "4.14.1",
"@typescript-eslint/visitor-keys": "4.14.0" "@typescript-eslint/visitor-keys": "4.14.1"
} }
}, },
"@typescript-eslint/types": { "@typescript-eslint/types": {
"version": "4.14.0", "version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.14.1.tgz",
"integrity": "sha512-VsQE4VvpldHrTFuVPY1ZnHn/Txw6cZGjL48e+iBxTi2ksa9DmebKjAeFmTVAYoSkTk7gjA7UqJ7pIsyifTsI4A==", "integrity": "sha512-SkhzHdI/AllAgQSxXM89XwS1Tkic7csPdndUuTKabEwRcEfR8uQ/iPA3Dgio1rqsV3jtqZhY0QQni8rLswJM2w==",
"dev": true "dev": true
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "4.14.0", "version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.14.1.tgz",
"integrity": "sha512-wRjZ5qLao+bvS2F7pX4qi2oLcOONIB+ru8RGBieDptq/SudYwshveORwCVU4/yMAd4GK7Fsf8Uq1tjV838erag==", "integrity": "sha512-M8+7MbzKC1PvJIA8kR2sSBnex8bsR5auatLCnVlNTJczmJgqRn8M+sAlQfkEq7M4IY3WmaNJ+LJjPVRrREVSHQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.14.0", "@typescript-eslint/types": "4.14.1",
"@typescript-eslint/visitor-keys": "4.14.0", "@typescript-eslint/visitor-keys": "4.14.1",
"debug": "^4.1.1", "debug": "^4.1.1",
"globby": "^11.0.1", "globby": "^11.0.1",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
@ -306,12 +306,12 @@
} }
}, },
"@typescript-eslint/visitor-keys": { "@typescript-eslint/visitor-keys": {
"version": "4.14.0", "version": "4.14.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.14.1.tgz",
"integrity": "sha512-MeHHzUyRI50DuiPgV9+LxcM52FCJFYjJiWHtXlbyC27b80mfOwKeiKI+MHOTEpcpfmoPFm/vvQS88bYIx6PZTA==", "integrity": "sha512-TAblbDXOI7bd0C/9PE1G+AFo7R5uc+ty1ArDoxmrC1ah61Hn6shURKy7gLdRb1qKJmjHkqu5Oq+e4Kt0jwf1IA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@typescript-eslint/types": "4.14.0", "@typescript-eslint/types": "4.14.1",
"eslint-visitor-keys": "^2.0.0" "eslint-visitor-keys": "^2.0.0"
} }
}, },
@ -1000,9 +1000,9 @@
"dev": true "dev": true
}, },
"get-intrinsic": { "get-intrinsic": {
"version": "1.0.2", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.0.2.tgz", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.0.tgz",
"integrity": "sha512-aeX0vrFm21ILl3+JpFFRNe9aUvp6VFZb2/CTbgLb8j75kOhvoNYjt9d8KA/tJG4gSo8nzEDedRl0h7vDmBYRVg==", "integrity": "sha512-M11rgtQp5GZMZzDL7jLTNxbDfurpzuau5uqRWDPvlHjfvg3TdScAZo96GLvhMjImrmR8uAt0FS2RLoMrfWGKlg==",
"dev": true, "dev": true,
"requires": { "requires": {
"function-bind": "^1.1.1", "function-bind": "^1.1.1",
@ -1855,9 +1855,9 @@
"dev": true "dev": true
}, },
"tsutils": { "tsutils": {
"version": "3.19.1", "version": "3.20.0",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.19.1.tgz", "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.20.0.tgz",
"integrity": "sha512-GEdoBf5XI324lu7ycad7s6laADfnAqCw6wLGI+knxvw9vsIYBaJfYdmeCEG3FMMUiSm3OGgNb+m6utsWf5h9Vw==", "integrity": "sha512-RYbuQuvkhuqVeXweWT3tJLKOEJ/UUw9GjNEZGWdrLLlM+611o1gwLHBpxoFJKKl25fLprp2eVthtKs5JOrNeXg==",
"dev": true, "dev": true,
"requires": { "requires": {
"tslib": "^1.8.1" "tslib": "^1.8.1"

View file

@ -26,11 +26,11 @@
"language-recognizer": "0.0.1" "language-recognizer": "0.0.1"
}, },
"devDependencies": { "devDependencies": {
"@redhat-actions/eslint-config": "^1.2.4", "@redhat-actions/eslint-config": "^1.2.11",
"@redhat-actions/tsconfig": "^1.1.1", "@redhat-actions/tsconfig": "^1.1.1",
"@types/node": "^12", "@types/node": "^12",
"@typescript-eslint/eslint-plugin": "^4.14.0", "@typescript-eslint/eslint-plugin": "^4.14.1",
"@typescript-eslint/parser": "^4.14.0", "@typescript-eslint/parser": "^4.14.1",
"@vercel/ncc": "^0.25.1", "@vercel/ncc": "^0.25.1",
"eslint": "^7.18.0", "eslint": "^7.18.0",
"typescript": "^4.0.5" "typescript": "^4.0.5"

View file

@ -98,8 +98,10 @@ export class BuildahCli implements Buildah {
core.debug("commit"); core.debug("commit");
core.debug(container); core.debug(container);
core.debug(newImageName); core.debug(newImageName);
const args: string[] = [ "commit", ...BuildahCli.getImageFormatOption(useOCI), const args: string[] = [
"--squash", container, newImageName ]; "commit", ...BuildahCli.getImageFormatOption(useOCI),
"--squash", container, newImageName,
];
return this.execute(args); return this.execute(args);
} }

View file

@ -12,10 +12,10 @@ export async function run(): Promise<void> {
const buildahPath = await io.which("buildah", true); const buildahPath = await io.which("buildah", true);
const cli: BuildahCli = new BuildahCli(buildahPath); const cli: BuildahCli = new BuildahCli(buildahPath);
const workspace = process.env.GITHUB_WORKSPACE || ""; const workspace = process.env.GITHUB_WORKSPACE || process.cwd();
const dockerFiles = getInputList("dockerfiles"); const dockerFiles = getInputList("dockerfiles");
const image = core.getInput("image", { required: true }); const image = core.getInput("image", { required: true });
const tags = core.getInput("tags"); const tags = core.getInput("tags") || "latest";
const tagsList: string[] = tags.split(" "); const tagsList: string[] = tags.split(" ");
const newImage = `${image}:${tagsList[0]}`; const newImage = `${image}:${tagsList[0]}`;
const useOCI = core.getInput("oci") === "true"; const useOCI = core.getInput("oci") === "true";
@ -46,8 +46,8 @@ async function doBuildUsingDockerFiles(
const context = path.join(workspace, core.getInput("context")); const context = path.join(workspace, core.getInput("context"));
const buildArgs = getInputList("build-args"); const buildArgs = getInputList("build-args");
const inputdockerFiles = dockerFiles.map((file) => path.join(workspace, file)); const dockerFileAbsPaths = dockerFiles.map((file) => path.join(workspace, file));
await cli.buildUsingDocker(newImage, context, inputdockerFiles, buildArgs, useOCI); await cli.buildUsingDocker(newImage, context, dockerFileAbsPaths, buildArgs, useOCI);
} }
async function doBuildFromScratch( async function doBuildFromScratch(