Skip to content

Commit

Permalink
Fixed .env in docker directory
Browse files Browse the repository at this point in the history
  • Loading branch information
mesemus committed Jan 16, 2024
1 parent 300289f commit 43b0a25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nrp-devtools"
version = "0.1.2"
version = "0.1.3"
description = "NRP repository development tools"
readme = "README.md"
authors = [
Expand Down
3 changes: 2 additions & 1 deletion src/nrp_devtools/cli/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
check_docker_compose_version,
check_node_version,
check_npm_version,
fix_containers,
fix_containers, fix_docker_env, check_docker_env,
)
from ..commands.invenio import check_invenio_cfg, install_invenio_cfg
from ..commands.opensearch import check_search, fix_custom_fields, fix_search
Expand Down Expand Up @@ -51,6 +51,7 @@ def check_commands(context, local_packages, fix):
# infrastructure checks
#
no_args(partial(click.secho, "Checking repository requirements", fg="yellow")),
run_fixup(check_docker_env, fix_docker_env, fix=fix),
check_docker_callable,
make_step(check_docker_compose_version, expected_major=1, expected_minor=17),
make_step(check_node_version, supported_versions=(14, 16, 20, 21)),
Expand Down
12 changes: 12 additions & 0 deletions src/nrp_devtools/commands/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
from .invenio import get_invenio_configuration, get_repository_info


def check_docker_env(config: OARepoConfig, **kwargs):
if not (config.repository_dir / "docker" / ".env").exists():
check_failed(
"Docker environment file is missing. Please run this command with --fix to fix the problem."
)

def fix_docker_env(config: OARepoConfig, **kwargs):
(config.repository_dir / "docker" / ".env").symlink_to(
config.repository_dir / "variables"
)


def check_docker_callable(config: OARepoConfig):
try:
run_cmdline("docker", "ps", grab_stdout=True, raise_exception=True)
Expand Down

0 comments on commit 43b0a25

Please sign in to comment.