Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
python-version: 3.x
- name: Install dependencies
run: |
pip install --user strato-skipper
pip install --user .

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

?

mkdir -p ~/.docker
echo "{}" > ~/.docker/config.json
touch ${HOME}/.gitconfig
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ dependencies = [
"requests-bearer==0.5.1",
"retry",
"setuptools",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

"pbr"
"pbr",
"importlib_metadata; python_version < '3.8'",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

how come we rely on different python versions?

"importlib_resources; python_version < '3.9'"
]

[project.optional-dependencies]
Expand Down
11 changes: 9 additions & 2 deletions skipper/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
import six
import tabulate
from pbr import packaging
from pkg_resources import get_distribution
try:
from importlib.metadata import version as get_distribution
except ImportError:
from importlib_metadata import version as get_distribution

from skipper import builder, git, runner, utils
from skipper.builder import BuildOptions, Image
Expand Down Expand Up @@ -91,6 +94,7 @@ def cli(
ctx.obj["env"] = ctx.default_map.get("env", {})
ctx.obj["containers"] = ctx.default_map.get("containers")
ctx.obj["volumes"] = ctx.default_map.get("volumes")
ctx.obj["entrypoint"] = ctx.default_map.get("entrypoint")
ctx.obj["workdir"] = ctx.default_map.get("workdir")
ctx.obj["workspace"] = ctx.default_map.get("workspace", None)
ctx.obj["container_context"] = ctx.default_map.get("container_context")
Expand Down Expand Up @@ -269,6 +273,7 @@ def run(ctx, interactive, name, env, publish, cache, command):
net=ctx.obj["build_container_net"],
publish=publish,
volumes=ctx.obj.get("volumes"),
entrypoint=ctx.obj.get("entrypoint"),
workdir=ctx.obj.get("workdir"),
use_cache=cache,
workspace=ctx.obj.get("workspace"),
Expand Down Expand Up @@ -310,6 +315,7 @@ def make(ctx, interactive, name, env, makefile, cache, publish, make_params):
net=ctx.obj["build_container_net"],
publish=publish,
volumes=ctx.obj.get("volumes"),
entrypoint=ctx.obj.get("entrypoint"),
workdir=ctx.obj.get("workdir"),
use_cache=cache,
workspace=ctx.obj.get("workspace"),
Expand Down Expand Up @@ -347,6 +353,7 @@ def shell(ctx, env, name, cache, publish):
net=ctx.obj["build_container_net"],
publish=publish,
volumes=ctx.obj.get("volumes"),
entrypoint=ctx.obj.get("entrypoint"),
workdir=ctx.obj.get("workdir"),
use_cache=cache,
workspace=ctx.obj.get("workspace"),
Expand All @@ -360,7 +367,7 @@ def version():
output skipper version
"""
utils.logger.debug("printing skipper version")
click.echo(get_distribution("strato-skipper").version) # pylint: disable=no-member
click.echo(get_distribution("strato-skipper")) # pylint: disable=no-member


@cli.command()
Expand Down
8 changes: 4 additions & 4 deletions skipper/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ def get_default_net():
# pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments
def run(command, fqdn_image=None, environment=None, interactive=False, name=None, net=None, publish=(), volumes=None,
workdir=None, use_cache=False, workspace=None, env_file=(), stdout_to_stderr=False):
entrypoint=None, workdir=None, use_cache=False, workspace=None, env_file=(), stdout_to_stderr=False):

if not net:
net = get_default_net()

if fqdn_image is not None:
return _run_nested(fqdn_image, environment, command, interactive, name, net, publish, volumes,
workdir, use_cache, workspace, env_file)
entrypoint, workdir, use_cache, workspace, env_file)

return _run(command, stdout_to_stderr=stdout_to_stderr)

Expand All @@ -50,7 +50,7 @@ def _run(cmd_args, stdout_to_stderr=False):
# pylint: disable=too-many-branches
# pylint: disable=too-many-arguments
# pylint: disable=too-many-positional-arguments
def _run_nested(fqdn_image, environment, command, interactive, name, net, publish, volumes, workdir, use_cache, workspace, env_file):
def _run_nested(fqdn_image, environment, command, interactive, name, net, publish, volumes, entrypoint, workdir, use_cache, workspace, env_file):
cwd = os.getcwd()
if workspace is None:
workspace = os.path.dirname(cwd)
Expand Down Expand Up @@ -114,7 +114,7 @@ def _run_nested(fqdn_image, environment, command, interactive, name, net, publis

cmd = handle_workdir(cmd, cwd, workdir)

cmd += ['--entrypoint', '/opt/skipper/skipper-entrypoint.sh']
cmd += ['--entrypoint', entrypoint or '/opt/skipper/skipper-entrypoint.sh']
cmd += [fqdn_image]
cmd += [' '.join(command)]

Expand Down
7 changes: 5 additions & 2 deletions skipper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import requests
from requests_bearer import HttpBearerAuth
import urllib3
import pkg_resources
try:
from importlib.resources import files
except ImportError:
from importlib_resources import files


REGISTRY_BASE_URL = 'https://%(registry)s/v2/'
Expand Down Expand Up @@ -178,7 +181,7 @@ def get_runtime_command():


def get_extra_file(filename):
return pkg_resources.resource_filename("skipper", f"data/{filename}")
return str(files("skipper").joinpath(f"data/{filename}"))


def run_container_command(args):
Expand Down
Loading
Loading