-
Notifications
You must be signed in to change notification settings - Fork 29
feat: support rhel bib #449
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,11 +21,11 @@ import * as extensionApi from '@podman-desktop/api'; | |
| import * as fs from 'node:fs'; | ||
| import { resolve } from 'node:path'; | ||
| import * as containerUtils from './container-utils'; | ||
| import { bootcImageBuilderContainerName, bootcImageBuilderName } from './constants'; | ||
| import { bootcImageBuilder, bootcImageBuilderCentos, bootcImageBuilderRHEL } from './constants'; | ||
| import type { BootcBuildInfo, BuildType } from '/@shared/src/models/bootc'; | ||
| import type { History } from './history'; | ||
| import * as machineUtils from './machine-utils'; | ||
| import { telemetryLogger } from './extension'; | ||
| import { getConfigurationValue, telemetryLogger } from './extension'; | ||
|
|
||
| export async function buildExists(folder: string, types: BuildType[]) { | ||
| let exists = false; | ||
|
|
@@ -100,7 +100,7 @@ export async function buildDiskImage(build: BootcBuildInfo, history: History, ov | |
| .withProgress( | ||
| { location: extensionApi.ProgressLocation.TASK_WIDGET, title: `Building disk image ${build.image}` }, | ||
| async progress => { | ||
| const buildContainerName = build.image.split('/').pop() + bootcImageBuilderContainerName; | ||
| const buildContainerName = build.image.split('/').pop() + '-' + bootcImageBuilder; | ||
| let successful: boolean = false; | ||
| let logData: string = 'Build Image Log --------\n'; | ||
| logData += 'ID: ' + build.id + '\n'; | ||
|
|
@@ -118,11 +118,14 @@ export async function buildDiskImage(build: BootcBuildInfo, history: History, ov | |
| fs.unlinkSync(logPath); | ||
| } | ||
|
|
||
| // determine which bootc image builder to use | ||
| const builder = await getBuilder(); | ||
|
|
||
| // Preliminary Step 0. Create the "bootc-image-builder" container | ||
| // options that we will use to build the image. This will help with debugging | ||
| // as well as making sure we delete the previous build, etc. | ||
| const containerName = await getUnusedName(buildContainerName); | ||
| const buildImageContainer = createBuilderImageOptions(containerName, build); | ||
| const buildImageContainer = createBuilderImageOptions(containerName, build, builder); | ||
| logData += JSON.stringify(buildImageContainer, undefined, 2); | ||
| logData += '\n----------\n'; | ||
| try { | ||
|
|
@@ -304,8 +307,24 @@ export async function getUnusedName(name: string): Promise<string> { | |
| return unusedName; | ||
| } | ||
|
|
||
| export async function getBuilder(): Promise<string> { | ||
| // use the preference to decide which builder to use | ||
| const buildProp = await getConfigurationValue<string>('builder'); | ||
|
|
||
| if (buildProp === 'RHEL') { | ||
| return bootcImageBuilderRHEL; | ||
| } | ||
|
|
||
| // always default to centos bib | ||
| return bootcImageBuilderCentos; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we fail at all if the config setting is not centos or rhel? i see in our tests it still passed. example you can pass in anything 'foobar' as the configuration setting and it'll always pick centos.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wanted to play it safe, i.e. even if config corrupted => we ignore and use CentOS anyway. |
||
| } | ||
|
|
||
| // Create builder options for the "bootc-image-builder" container | ||
| export function createBuilderImageOptions(name: string, build: BootcBuildInfo): ContainerCreateOptions { | ||
| export function createBuilderImageOptions( | ||
| name: string, | ||
| build: BootcBuildInfo, | ||
| builder?: string, | ||
| ): ContainerCreateOptions { | ||
| const cmd = [`${build.image}:${build.tag}`, '--output', '/output/', '--local']; | ||
|
|
||
| build.type.forEach(t => cmd.push('--type', t)); | ||
|
|
@@ -323,7 +342,7 @@ export function createBuilderImageOptions(name: string, build: BootcBuildInfo): | |
| // Create the image options for the "bootc-image-builder" container | ||
| const options: ContainerCreateOptions = { | ||
| name: name, | ||
| Image: bootcImageBuilderName, | ||
| Image: builder ?? bootcImageBuilderCentos, | ||
| Tty: true, | ||
| HostConfig: { | ||
| Privileged: true, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,5 +17,6 @@ | |
| ***********************************************************************/ | ||
|
|
||
| // Image related | ||
| export const bootcImageBuilderContainerName = '-bootc-image-builder'; | ||
| export const bootcImageBuilderName = 'quay.io/centos-bootc/bootc-image-builder:latest-1714633180'; | ||
| export const bootcImageBuilder = 'bootc-image-builder'; | ||
| export const bootcImageBuilderCentos = 'quay.io/centos-bootc/bootc-image-builder:latest-1714633180'; | ||
| export const bootcImageBuilderRHEL = 'registry.redhat.io/rhel9/bootc-image-builder:9.4'; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's more than one RHEL version. The 9.4 image is Tech Preview even and isn't going to be updated more and we will definitely (for rhel9.6) want to use I think in general we can just use To determine (In theory we could use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current value of that const is registry.redhat.io/rhel9/bootc-image-builder:9.5. Adding other builders to the list is simple if someone can confirm the list, but would prefer not to use :latest unless we know there is someone who understands the implications of that and agrees to support it. Is using REDHAT_SUPPORT_PRODUCT_VERSION the normal way to determine which builder you should use? i.e. if we see 9.6 we should always use the 9.6 builder? I'd be inclined to go back to the support we were planning for bootc.diskimage-builder - the default builder preference would be something like 'based on image' and we'd use the correct builder if we found the version, and default to Centos builder if it didn't exist. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm the commit message mentions the
bootc.diskimage-builderlabel but I don't see it mentioned or used in the code anywhere?Oh except...argh, we may have lost that label in some reworking of the base image builds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We didn't see it used consistently enough in the images (and sounds like it isn't going to be?), so the extension still uses a simple builder preference (under Settings > Preferences > Bootable Containers in the UI).