Skip to content
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ Whether to verify TLS certificates.

Default: `true`

### `platform` (optional)

Specify the archatecture of the image to pull

Default: `linux/amd64`
Copy link
Copy Markdown
Contributor

@p5 p5 Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than defaulting to linux/amd64, please can we make this an optional input (i.e. not specified in any podman/bib commands by default) so it defaults to BIB's implementation?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think copilot called me out and fixed that.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops I just committed it

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't track why there are 2 copies of the same image pull code


### `types` (optional)

The types of artifacts to build. Can be any type supported by
Expand Down
2 changes: 2 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/types.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/bib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export async function build(

// Pull the required images
core.startGroup('Pulling required images')
await pullImage(options.builderImage, options.tlsVerify)
await pullImage(options.image, options.tlsVerify)
await pullImage(options.builderImage, options.tlsVerify, options.platform)
await pullImage(options.image, options.tlsVerify, options.platform)
core.endGroup()

// Create the output directory
Expand All @@ -43,6 +43,7 @@ export async function build(
podmanArgs.push('run')
podmanArgs.push('--rm')
podmanArgs.push('--privileged')
podmanArgs.push(`--platform ${options.platform || ''}`)
podmanArgs.push('--security-opt label=type:unconfined_t')
podmanArgs.push(
'--volume /var/lib/containers/storage:/var/lib/containers/storage'
Expand Down Expand Up @@ -132,6 +133,7 @@ async function pullImage(image: string, tlsVerify?: boolean): Promise<void> {
try {
const executible = 'podman'
const tlsFlags = tlsVerify ? '' : '--tls-verify=false'
const platform = platform ? '' : `--platform ${options.platform}`
await execAsRoot(
executible,
['pull', tlsFlags, image].filter((arg) => arg)
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export async function run(): Promise<void> {
const configFilePath: string = core.getInput('config-file')
const image: string = core.getInput('image')
const builderImage: string = core.getInput('builder-image')
const platform: string = core.getInput('platform') || 'linux/amd64'
Copy link
Copy Markdown
Contributor

@p5 p5 Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be best if this defaults to null or an empty string if the input is not found, rather than always linux/amd64.
Then elsewhere in the code, include conditions like (pseudocode):

if platform != null {
  podmanArgs.push("--platform ${platform}")
}

const additionalArgs: string = core.getInput('additional-args')
const chown: string = core.getInput('chown')
const rootfs: string = core.getInput('rootfs')
Expand All @@ -34,6 +35,7 @@ export async function run(): Promise<void> {
configFilePath,
image,
builderImage,
platform,
additionalArgs,
chown,
rootfs,
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface BootcImageBuilderOptions {
platform: string
configFilePath: string
image: string
builderImage: string
Expand Down
Loading