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

Update develop environment #63

Merged
merged 4 commits into from
Aug 8, 2023
Merged
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ jobs:
tag: "${{ github.ref }}"
overwrite: true
file_glob: true
# yamllint disable-line rule:comments-indentation
# publish_pypi:
# needs:
# - "unittest"
Expand Down
11 changes: 7 additions & 4 deletions development/docker-compose.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ services:
timeout: "10s"
start_period: "120s"
retries: 3
<<:
- *nautobot-build
- *nautobot-base
<<: [*nautobot-build, *nautobot-base]
worker:
entrypoint:
- "sh"
Expand All @@ -41,5 +39,10 @@ services:
timeout: "10s"
start_period: "30s"
retries: 3
test: ["CMD", "bash", "-c", "nautobot-server celery inspect ping --destination celery@$$HOSTNAME"] ## $$ because of docker-compose
test: [
"CMD",
"bash",
"-c",
"nautobot-server celery inspect ping --destination celery@$$HOSTNAME",
] ## $$ because of docker-compose
<<: *nautobot-base
14 changes: 7 additions & 7 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,26 @@ def task_wrapper(function=None):


def docker_compose(context, command, **kwargs):
"""Helper function for running a specific docker-compose command with all appropriate parameters and environment.
"""Helper function for running a specific docker compose command with all appropriate parameters and environment.

Args:
context (obj): Used to run specific commands
command (str): Command string to append to the "docker-compose ..." command, such as "build", "up", etc.
command (str): Command string to append to the "docker compose ..." command, such as "build", "up", etc.
**kwargs: Passed through to the context.run() call.
"""
build_env = {
# Note: 'docker-compose logs' will stop following after 60 seconds by default,
# Note: 'docker compose logs' will stop following after 60 seconds by default,
# so we are overriding that by setting this environment variable.
"COMPOSE_HTTP_TIMEOUT": context.design_builder.compose_http_timeout,
"NAUTOBOT_VER": context.design_builder.nautobot_ver,
"PYTHON_VER": context.design_builder.python_ver,
}
compose_command = f'docker-compose --project-name {context.design_builder.project_name} --project-directory "{context.design_builder.compose_dir}"'
compose_command = f'docker compose --project-name {context.design_builder.project_name} --project-directory "{context.design_builder.compose_dir}"'
for compose_file in context.design_builder.compose_files:
compose_file_path = os.path.join(context.design_builder.compose_dir, compose_file)
compose_command += f' -f "{compose_file_path}"'
compose_command += f" {command}"
print(f'Running docker-compose command "{command}"')
print(f'Running docker compose command "{command}"')
return context.run(compose_command, env=build_env, **kwargs)


Expand Down Expand Up @@ -193,13 +193,13 @@ def vscode(context):

@task(
help={
"service": "Docker-compose service name to view (default: nautobot)",
"service": "docker compose service name to view (default: nautobot)",
"follow": "Follow logs",
"tail": "Tail N number of lines or 'all'",
}
)
def logs(context, service="nautobot", follow=False, tail=None):
"""View the logs of a docker-compose service."""
"""View the logs of a docker compose service."""
command = "logs "

if follow:
Expand Down
Loading