Fix: platform parameter is not supported by buildah config (build-without-containerfile) (#83)

Signed-off-by: James Addison <jay@jp-hosting.net>
This commit is contained in:
James Addison 2021-10-18 18:41:01 +01:00 committed by GitHub
parent 733d8e9a38
commit bb88487cd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 12 deletions

View file

@ -45,7 +45,6 @@ After building your image, use [push-to-registry](https://github.com/redhat-acti
| Input Name | Description | Default | | Input Name | Description | Default |
| ---------- | ----------- | ------- | | ---------- | ----------- | ------- |
| arch | Label the image with this architecture, instead of defaulting to the host architecture. Refer to [Multi arch builds](#multi-arch-builds) for more information. | None (host architecture) | arch | Label the image with this architecture, instead of defaulting to the host architecture. Refer to [Multi arch builds](#multi-arch-builds) for more information. | None (host architecture)
| platform | Label the image with this platform, instead of defaulting to the host platform. Refer to [Multi arch builds](#multi-arch-builds) for more information. | None (host platform)
| base-image | The base image to use for the container. | **Required** | base-image | The base image to use for the container. | **Required**
| content | Paths to files or directories to copy inside the container to create the file image. This is a multiline input to allow you to copy multiple files/directories.| None | content | Paths to files or directories to copy inside the container to create the file image. This is a multiline input to allow you to copy multiple files/directories.| None
| entrypoint | The entry point to set for the container. Separate arguments by newline. | None | entrypoint | The entry point to set for the container. Separate arguments by newline. | None

View file

@ -57,7 +57,9 @@ inputs:
description: 'Alias for "arch". "arch" takes precedence if both are set.' description: 'Alias for "arch". "arch" takes precedence if both are set.'
required: false required: false
platform: platform:
description: 'Label the image with this PLATFORM, instead of defaulting to the host platform.' description: |
Label the image with this PLATFORM, instead of defaulting to the host platform.
Only supported for containerfile builds.
required: false required: false
extra-args: extra-args:
description: | description: |

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

@ -15,7 +15,6 @@ export interface BuildahConfigSettings {
port?: string; port?: string;
workingdir?: string; workingdir?: string;
arch?: string; arch?: string;
platform?: string;
} }
interface Buildah { interface Buildah {
@ -140,10 +139,6 @@ export class BuildahCli implements Buildah {
args.push("--arch"); args.push("--arch");
args.push(settings.arch); args.push(settings.arch);
} }
if (settings.platform) {
args.push("--platform");
args.push(settings.platform);
}
if (settings.workingdir) { if (settings.workingdir) {
args.push("--workingdir"); args.push("--workingdir");
args.push(settings.workingdir); args.push(settings.workingdir);

View file

@ -87,6 +87,7 @@ export enum Inputs {
OCI = "oci", OCI = "oci",
/** /**
* Label the image with this PLATFORM, instead of defaulting to the host platform. * Label the image with this PLATFORM, instead of defaulting to the host platform.
* Only supported for containerfile builds.
* Required: false * Required: false
* Default: None. * Default: None.
*/ */

View file

@ -64,7 +64,10 @@ export async function run(): Promise<void> {
await doBuildUsingContainerFiles(cli, newImage, workspace, containerFiles, useOCI, arch, platform); await doBuildUsingContainerFiles(cli, newImage, workspace, containerFiles, useOCI, arch, platform);
} }
else { else {
await doBuildFromScratch(cli, newImage, useOCI, arch, platform); if (platform) {
throw new Error("The --platform option is not supported for builds without containerfiles.");
}
await doBuildFromScratch(cli, newImage, useOCI, arch);
} }
if (tagsList.length > 1) { if (tagsList.length > 1) {
@ -105,7 +108,7 @@ async function doBuildUsingContainerFiles(
} }
async function doBuildFromScratch( async function doBuildFromScratch(
cli: BuildahCli, newImage: string, useOCI: boolean, arch: string, platform: string cli: BuildahCli, newImage: string, useOCI: boolean, arch: string
): Promise<void> { ): Promise<void> {
core.info(`Performing build from scratch`); core.info(`Performing build from scratch`);
@ -125,7 +128,6 @@ async function doBuildFromScratch(
workingdir: workingDir, workingdir: workingDir,
envs, envs,
arch, arch,
platform,
}; };
await cli.config(containerId, newImageConfig); await cli.config(containerId, newImageConfig);
await cli.copy(containerId, content); await cli.copy(containerId, content);