-
Notifications
You must be signed in to change notification settings - Fork 72
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
clp-package: Package building platform's /etc/os-release
and determine execution_container
from the file.
#322
Conversation
…n_container` from the file.
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.
In general, the change makes sense to me. It's not entirely clear to me that how we will support custom container name and container tags, but I assume you will have a plan for it?
parsed[var] = val | ||
|
||
self.execution_container = "ghcr.io/y-scope/clp/" | ||
if "ubuntu" == parsed["ID"]: |
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.
can we store parsed["ID"] in a local variable?
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.
When I drafted the code, I thought about extracting those into variables parsed_id
, parsed_version_id
/ parsed_version_codename
, and even better we break
the for-loop if all info we need has been parsed. However, that might be less clean and less extensible if we (ever) plan to support CentOS / RHEL in the future. That's because VERSION_ID
is common across all Linux distributions, but VERSION_CODENAME
is specific to Ubuntu / Debian distributions.
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.
Should we add Debian into the if condition?
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.
I thought about adding Debian and other RHEL distributions here, but that does not seem meaningful until we add (building support and most importantly,) execution container support in tools/docker-images
. For now, I think raising an NotImplementedError here is a good notification to users.
with open(self.os_release_file_path) as os_release_file: | ||
parsed = {} | ||
for line in os_release_file: | ||
var, val = line.strip().split("=") |
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.
technically we can add a guard to ensure split does return two items, but since the os release file should have a relatively fixed format, this code should be fine
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.
Right, I was thinking about adding try ... except
blocks to handle such errors / FileNotFoundError, but since users are not expected to modify this <clp-package>/etc/os-release
file, such handlings could be redundant. In any case, users will get notified by the Exception stack.
@@ -355,6 +359,27 @@ def validate_logs_dir(self): | |||
except ValueError as ex: | |||
raise ValueError(f"logs_directory is invalid: {ex}") | |||
|
|||
def load_execution_container_name(self): | |||
if self.execution_container is not None: |
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.
Just for sanity check, have you tested and made sure that the container specified in the clp-config will be properly picked up?
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.
Yes. I have updated the "Validation" section in the PR description to include the related instructions.
Users can configure a string field |
parsed[var] = val | ||
|
||
self.execution_container = "ghcr.io/y-scope/clp/" | ||
if "ubuntu" == parsed["ID"]: |
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.
Should we add Debian into the if condition?
…ncy `package` already has the file on the sources list; Reorder `os-release` in tasks sources.
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.
How about:
clp-package: Include build-platform's /etc/os-release
and determine execution_container
from it. (#322)
References
Internally, it was found that when the CLP Package is built with container clp-core-dependencies-x86-ubuntu-jammy:main, running the package starting script (entry point
<clp-package>/sbin/start-clp.sh
leads to missing Python dependencies failures. Further investigation found that the failures indicates Python version discrepancy in the built package virtual environment and execution container. Previously, users could mitigate such discrepancy in the building environment versus the execution container by specifying a matchingexecution_container
inclp-config.yml
. However, the configuration field is not publicly documented and encouraged to be used. Instead, the CLP Package should include information about the building platform and determine which Docker image to generate theexecution_container
.This PR depends on #321 which adds a GitHub workflow to build and push Ubuntu Jammy execution container to the GitHub Docker Registry.
Description
/etc/os-release
.execution_container
name from the<clp-package>/etc/os-release
file./etc/os-release
to Taskfile building platform dependent tasks to trigger rebuild when the building container changes.Validation performed
Sanity test with Ubuntu Focal Built Package
task
under project root to build the package.<clp-package>/sbin/start-clp.sh
.docker ps
and observed all CLP component dockers created by IMAGEghcr.io/y-scope/clp/clp-execution-x86-ubuntu-focal:main
.Sanity test with Custom
exexcution_container
task
under project root to build the package.<clp-package>/etc/clp-config.yml
to include a string fieldexecution_container
with valueclp-execution-x86-ubuntu-focal:dev
. e.g.,<clp-package>/sbin/start-clp.sh
.docker ps
and observed all CLP component dockers created by IMAGEclp-execution-x86-ubuntu-focal:dev
.Test with Ubuntu Jammy Built Package
task
under project root to build the package.<clp-package>/sbin/start-clp.sh
.docker ps
and observe all CLP component dockers created by IMAGEghcr.io/y-scope/clp/clp-execution-x86-ubuntu-jammy:main
.