Skip to content

add oci config#40

Open
mac641 wants to merge 6 commits intomainfrom
oci-puller
Open

add oci config#40
mac641 wants to merge 6 commits intomainfrom
oci-puller

Conversation

@mac641
Copy link
Copy Markdown
Contributor

@mac641 mac641 commented Nov 18, 2025

@mac641 mac641 requested a review from a team as a code owner November 18, 2025 14:38
@mac641 mac641 requested a review from majst01 November 20, 2025 15:17
@mac641
Copy link
Copy Markdown
Contributor Author

mac641 commented Nov 20, 2025

@majst01 I added a way of parsing multiple oci configs using StringSlice. I think this is a little ugly, if you know a better way to solve this, please let me know.

Besides, how can I test pixiecore's grpccmd?

@mac641
Copy link
Copy Markdown
Contributor Author

mac641 commented Mar 16, 2026

@majst01 As discussed, this the updated version of the oci pull config where a yaml file is used in order to pass over registry-urls and optional login info.

My implementation expects the file to look something like this:

oci-configs:
  - registry-url: oci://ghcr.io/metal-images/debian:12
    username: bla
    password: blub
  - registry-url: oci://ghcr.io/metal-images/debian:12
    username: ""
    password: ""
  - registry-url: oci://ghcr.io/metal-images/almalinux:9
    username: foo
    password: bar

Since we don't have any login info at this point, I have a couple of questions about this:

  • How is grpccmd tested? How can I test it locally?
  • What do I need to adjust in the mini-lab in order to have this file present?
  • and - generally speaking - where does pixiecore get the infos for MetalConfig from, especially in the case of the mini-lab?

Comment on lines +233 to +257
metalHammerOciConfigFileContent, err := os.ReadFile(metalHammerOciConfigFilePath)
if err != nil {
return nil, fmt.Errorf("error retrieving oci configs file: %w", err)
}

type MetalHammerOciConfig struct {
RegistryURL string `yaml:"registry-url"`
Credentials *api.OciCredentials
}
type MetalHammerOciConfigs struct {
OciConfigs []MetalHammerOciConfig `yaml:"oci-configs"`
}
var metalHammerOciConfigs MetalHammerOciConfigs
err = yaml.Unmarshal(metalHammerOciConfigFileContent, &metalHammerOciConfigs)
if err != nil {
return nil, fmt.Errorf("error parsing oci configs: %w", err)
}

for _, config := range metalHammerOciConfigs.OciConfigs {
if config.RegistryURL == "" {
return nil, fmt.Errorf("no registry url specified for oci config: %+v", config)
}

ociConfigs[config.RegistryURL] = config.Credentials
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would it make sense to put this into a separate function? The getMetalAPIConfig function is pretty long already.
Looks fine though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants