Skip to content

list-images: add --datadir override for e.g. custom repositories#2

Merged
mvo5 merged 1 commit intoosbuild:mainfrom
mvo5:add-repository-switch
Nov 29, 2024
Merged

list-images: add --datadir override for e.g. custom repositories#2
mvo5 merged 1 commit intoosbuild:mainfrom
mvo5:add-repository-switch

Conversation

@mvo5
Copy link
Copy Markdown
Contributor

@mvo5 mvo5 commented Nov 18, 2024

[I'm not 100% certain about this tbh, it feels a bit inelegant but it seems a super common request to be able to have a --repositores overrride switch - I initially added --repositories but that feels a bit akward as it needs to point to the parent of the repositories/ directory so I name it --datadir. I guess alternatively we could define a --repository /path/to/repositories/actual-file.json and leave it to the user to pick the right one, I'm not sure which is nicer as I'm not sure what the use-case is]

This commit adds a --datadir override that allows overriding
the default search paths for e.g. the custom repositories. In
practise only repository overrides are supported because that
is the only data stored there.

@mvo5 mvo5 assigned achilleas-k and unassigned achilleas-k Nov 18, 2024
@mvo5 mvo5 requested a review from achilleas-k November 20, 2024 14:32
@mvo5 mvo5 force-pushed the add-repository-switch branch from 58c1bfe to 6edc7f3 Compare November 27, 2024 08:05
@achilleas-k
Copy link
Copy Markdown
Member

achilleas-k commented Nov 28, 2024

Do we expect the datadir to contain other types of data in the future, beyond just repositories? If this is strictly meant for repo configs, maybe the CLI flag name should reflect that?

@mvo5 mvo5 force-pushed the add-repository-switch branch from 6edc7f3 to 10e2eed Compare November 28, 2024 15:39
@mvo5 mvo5 marked this pull request as ready for review November 28, 2024 15:40
@mvo5
Copy link
Copy Markdown
Contributor Author

mvo5 commented Nov 28, 2024

Do we expect the datadir to contain other types of data in the future, beyond just repositories? If this is strictly meant for repo configs, maybe the CLI flag name should reflect that?

Thank you, it's a very good question. I started with --repository-dir but then "images" in "reporegistry" will automatically append "repositories" to the "conf-path" (c.f. https://github.com/osbuild/images/blob/main/pkg/reporegistry/repository.go#L21) - which makes it a bit awkward because this naive usage --repository-directory ~/devel/osbuild-composer/repositories would not work. It would have to be --repository-directory ~/devel/osbuild-composer/ which is (to me) a bit unexpected. So I went with datadir, I guess the alternative would be to switch images so that it does not append repositories automatically and fix the consuemrs (but it would be an API break).

@achilleas-k
Copy link
Copy Markdown
Member

It would have to be --repository-directory ~/devel/osbuild-composer/ which is (to me) a bit unexpected. So I went with datadir, I guess the alternative would be to switch images so that it does not append repositories automatically and fix the consuemrs (but it would be an API break).

ah, I see. In that case --datadir makes sense. It also leaves the door open for other things, which I think is a good idea.

I don't have any good ideas for what else it might include. Perhaps some defaults for how osbuild is run in a osbuild.conf file. Not important right now though :)

This commit adds a `--datadir` override that allows overriding
the default search paths for e.g. the custom repositories. In
practise only repository overrides are supported because that
is the only data stored there.
@mvo5 mvo5 force-pushed the add-repository-switch branch from 10e2eed to 9d86006 Compare November 28, 2024 16:53
@mvo5
Copy link
Copy Markdown
Contributor Author

mvo5 commented Nov 28, 2024

@achilleas-k Thanks! I tweaked one tiny detail and made "--datadir" a persistent flag as this will also be useful for manifest and build

@mvo5 mvo5 requested a review from achilleas-k November 28, 2024 16:54
@mvo5 mvo5 added this pull request to the merge queue Nov 29, 2024
Merged via the queue into osbuild:main with commit 2719f3f Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants