Skip to content
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

refactor: neutral layer, pub key lookup, multiconfig #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

fnerdman
Copy link
Contributor

No description provided.

Comment on lines -11 to -27
python () {
# Check if SEARCHER_SSH_KEY is set in the environment or in local.conf
searcher_ssh_key = d.getVar('SEARCHER_SSH_KEY')

if searcher_ssh_key is None:
# If not set, check the original environment
origenv = d.getVar("BB_ORIGENV", False)
if origenv:
searcher_ssh_key = origenv.getVar('SEARCHER_SSH_KEY')

if searcher_ssh_key:
# If SEARCHER_SSH_KEY is set, keep its value
d.setVar('SEARCHER_SSH_KEY', searcher_ssh_key)
else:
# If SEARCHER_SSH_KEY is not set, raise an error
bb.fatal("SEARCHER_SSH_KEY must be set. Please provide an SSH public key.")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why remove this?
Passing custom env variables cant be caught directly without either setting them manually in local.conf or building with a specific yocto env variable enabled or with this python to capture it.
I believe the export below will not capture the custom env variables and didn't work for me before

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've removed this because it's to broad of a check. If you haven't added this recipe in your build it will still complain about the variable missing. In favor of neutral layers I've moved the check of the variable right before it's used.
I wasn't aware that we don't want to touch the local.conf for configuration. How would you implement this method such that it takes this env var from the origenv but without failing if it doesn't exist?

Copy link
Collaborator

Choose a reason for hiding this comment

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

For that specific use case we chose to fail because the SEARCHER_SSH_KEY was mandatory in BoBv1.
Which still is in BoBv2 if I am not wrong.
So making it fail, is like a reminder to rebuild with that env var set.

ow would you implement this method such that it takes this env var from the origenv but without failing if it doesn't exist?

You can do that by switching the bb.fatal to bb.info instead or bb.warn
But that would defeat the purpose of stopping the image build if the searcher ssh key was not set, otherwise, the searcher won't be able to log inside its container

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