Skip to content

Commit

Permalink
[fix] Fix Version handling + passing entrypoint
Browse files Browse the repository at this point in the history
this fixes version handling when doing so seperately from the image
string as well as passing an entrypoint to the image. the nixos module
requires the `entrypoint` to be a single file in PATH and all arguments
for that file in `cmd`.
  • Loading branch information
PhilTaken committed Aug 3, 2023
1 parent c7d6e39 commit 5a69f5d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/batou_ext/oci.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class Container(Component):

# specific options
entrypoint: Optional[str] = None
docker_cmd: str = ""
envfile: Optional[str] = None
mounts: dict = {}
ports: dict = {}
Expand Down Expand Up @@ -66,6 +67,9 @@ def configure(self):
# spec version overrides the argument provided or default version
if spec_tag:
self.version = spec_tag
else:
# append version to image string when passed seperately
self.image = f"{self.image}:{self.version}"
else:
raise RuntimeError(
f"could not match the docker spec against the provided container image string: '{self.image}'"
Expand Down
6 changes: 5 additions & 1 deletion src/batou_ext/resources/oci-template.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
virtualisation.oci-containers = {
backend = "docker";
containers."{{component.container_name}}" = {
# {% if component.entrypoint != None %}
# {% if component.entrypoint %}
entrypoint = "{{component.entrypoint}}";
# {% endif %}

# {% if component.docker_cmd %}
cmd = [ {% for cmd in component.docker_cmd.split(" ") %} "{{cmd}}" {% endfor %} ];
# {% endif %}

# {% if component.registry_address %}
login = {
registry = "{{component.registry_address}}";
Expand Down
8 changes: 7 additions & 1 deletion src/batou_ext/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@


class S3(batou.component.Component):
"""Configuration for an S3 connection and its credentials."""
"""Configuration for an S3 connection and its credentials.
Keyword arguments:
access_key_id -- The S3 access key ID
secret_access_key -- The S3 secret access key
endpoint_url -- The S3 enpoint's URL
"""

_required_params_ = {
"access_key_id": "value",
Expand Down

0 comments on commit 5a69f5d

Please sign in to comment.