Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ After building your image, use [push-to-registry](https://github.com/redhat-acti
| 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)
| 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**
| 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
Expand Down
4 changes: 3 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ inputs:
description: 'Alias for "arch". "arch" takes precedence if both are set.'
required: false
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
extra-args:
description: |
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/buildah.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export interface BuildahConfigSettings {
port?: string;
workingdir?: string;
arch?: string;
platform?: string;
}

interface Buildah {
Expand Down Expand Up @@ -140,10 +139,6 @@ export class BuildahCli implements Buildah {
args.push("--arch");
args.push(settings.arch);
}
if (settings.platform) {
args.push("--platform");
args.push(settings.platform);
}
if (settings.workingdir) {
args.push("--workingdir");
args.push(settings.workingdir);
Expand Down
1 change: 1 addition & 0 deletions src/generated/inputs-outputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export enum Inputs {
OCI = "oci",
/**
* Label the image with this PLATFORM, instead of defaulting to the host platform.
* Only supported for containerfile builds.
* Required: false
* Default: None.
*/
Expand Down
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export async function run(): Promise<void> {
await doBuildUsingContainerFiles(cli, newImage, workspace, containerFiles, useOCI, arch, platform);
}
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) {
Expand Down Expand Up @@ -105,7 +108,7 @@ async function doBuildUsingContainerFiles(
}

async function doBuildFromScratch(
cli: BuildahCli, newImage: string, useOCI: boolean, arch: string, platform: string
cli: BuildahCli, newImage: string, useOCI: boolean, arch: string
): Promise<void> {
core.info(`Performing build from scratch`);

Expand All @@ -125,7 +128,6 @@ async function doBuildFromScratch(
workingdir: workingDir,
envs,
arch,
platform,
};
await cli.config(containerId, newImageConfig);
await cli.copy(containerId, content);
Expand Down