siemens / kas

Setup tool for bitbake based projects
MIT License
339 stars 145 forks source link

Add support for environment variables in the YAML file #75

Closed jclsn closed 2 years ago

jclsn commented 2 years ago

I need to expand an environment variable in one of the repository urls, because we are hosting it on our own server that demands a username. Kas doesn't seem to support ${SOME_VARIABLE} though. Can this be fixed or is it due to the .yml file extension?

For the time being I can run a sed script over the .yml file after downloading it, but I find that rather ugly.

jan-kiszka commented 2 years ago

One of the reason that speaks against injecting essential information from the build env is that kas configurations are supposed to describe what is needed in order to rebuild the same thing. There can be exceptions from that, and that's why we accept, e.g., env: in a controlled manner or allow to set refspec to floating branch names, but you should generally be careful with this.

Can't you model your case by providing kas configuration option files that contain the variations of the URL? Or use KAS_PREMIRRORS?

jclsn commented 2 years ago

I have no experience with PREMIRRORS. Will have to read about it tomorrow.

Maybe it isn't necessary, because it is about one package only, which is still on Gerrit. We want to migrate it to our self-hosted Gitlab anyway and then the issue might be resolved for my case.

henning-schild commented 2 years ago

PREMIRRORS are likely what you want, they can be applied on any layer-cake to steer it to your own mirrors in case you happen to mirror stuff for whatever reason.

It is basically a regexp to be applied on any SRC_URI ... probably much like your sed but in a bitbake way.

jclsn commented 2 years ago

Can you give me an example for my case with the environment variable? I read https://stackoverflow.com/questions/52940431/using-premirrors-in-bitbake-configuration, but I don't really get it.

jan-kiszka commented 2 years ago

https://kas.readthedocs.io/en/latest/command-line.html comes with an example.

jan-kiszka commented 2 years ago

And if you want to make that switch optional, stick it into a kas option file, analogously to https://github.com/siemens/meta-iot2050/blob/master/kas/opt/mirror-example.yml.

jclsn commented 2 years ago

Thanks, but I don't really see how this is going to solve my problem. Guess I don't understand it, but I have migrated the Gerrit repo to Gitlab by now and that has solved my problem.