Skip to content

Commit

Permalink
Merge pull request #4811 from opsmill/stable
Browse files Browse the repository at this point in the history
Sync develop with Stable
  • Loading branch information
dgarros authored Nov 1, 2024
2 parents 65ff6be + b2928f9 commit 69160f3
Show file tree
Hide file tree
Showing 27 changed files with 270 additions and 141 deletions.
1 change: 1 addition & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ignore: |
**/node_modules
# https://github.com/sbaudoin/yamllint/issues/16
/helm/templates
/python_sdk
rules:
new-lines: disable
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang

<!-- towncrier release notes start -->

## [1.0.1](https://github.com/opsmill/infrahub/tree/v1.0.1) - 2024-10-31

### Fixed

- When a user is not logged in and the branch name is not found, hide the quick-create action and display the message: 'No branch found' ([#4801](https://github.com/opsmill/infrahub/issues/4801))
- Fix automation to trigger generation of artifacts after merging a branch ([#4804](https://github.com/opsmill/infrahub/issues/4804))
- Avoid sending an empty list to the load schema API on repository import if it's not required
- Update demo environment to work with Infrahub 1.0

## [1.0.0](https://github.com/opsmill/infrahub/tree/v1.0.0) - 2024-10-30

### Removed
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/core/ipam/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


@flow(
name="ipam-reconciliation",
name="ipam_reconciliation",
flow_run_name="branch-{branch}",
description="Ensure the IPAM Tree is up to date",
persist_result=False,
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/core/migrations/schema/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from infrahub.core.schema import MainSchemaTypes


@flow(name="schema-migrations-apply")
@flow(name="schema_apply_migrations")
async def schema_apply_migrations(message: SchemaApplyMigrationData) -> list[str]:
service = services.service
await add_branch_tag(branch_name=message.branch.name)
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/core/validators/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from .models.validate_migration import SchemaValidateMigrationData # noqa: TCH001


@flow(name="schema-migrations-validate")
@flow(name="schema_validate_migrations")
async def schema_validate_migrations(message: SchemaValidateMigrationData) -> list[str]:
batch = InfrahubBatch(return_exceptions=True)
error_messages: list[str] = []
Expand Down
5 changes: 5 additions & 0 deletions backend/infrahub/git/integrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,11 @@ async def import_schema_files(self, branch_name: str, commit: str, config_file:
schema_file.load_content()
schemas_data.append(schema_file)

if not schemas_data:
# If the repository doesn't contain any schema files there is no reason to continue
# and send an empty list to the API
return

for schema_file in schemas_data:
if schema_file.valid:
continue
Expand Down
6 changes: 3 additions & 3 deletions backend/infrahub/git/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
log = get_logger()


@flow(name="git-repositories-branch-create")
@flow(name="git_repositories_create_branch")
async def create_branch(branch: str, branch_id: str) -> None:
"""Request to the creation of git branches in available repositories."""
service = services.service
Expand All @@ -42,7 +42,7 @@ async def create_branch(branch: str, branch_id: str) -> None:
pass


@flow(name="git-repository-sync")
@flow(name="git_repositories_sync")
async def sync_remote_repositories() -> None:
service = services.service

Expand Down Expand Up @@ -162,7 +162,7 @@ async def generate_artifact(model: RequestArtifactGenerate) -> None:
await artifact.save()


@flow(name="artifact-definition-generate")
@flow(name="request_artifact_definitions_generate")
async def generate_request_artifact_definition(model: RequestArtifactDefinitionGenerate) -> None:
await add_branch_tag(branch_name=model.branch)

Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/tasks/telemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async def post_telemetry_data(service: InfrahubServices, url: str, payload: dict
response.raise_for_status()


@flow(name="anonymous-telemetry-push")
@flow(name="anonymous_telemetry_send")
async def send_telemetry_push() -> None:
service = services.service
log = get_run_logger()
Expand Down
4 changes: 2 additions & 2 deletions backend/infrahub/transformations/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
log = get_logger()


@flow(name="transform-render-python")
@flow(name="transform_render_python")
async def transform_python(message: TransformPythonData) -> Any:
service = services.service
await add_branch_tag(branch_name=message.branch)
Expand All @@ -35,7 +35,7 @@ async def transform_python(message: TransformPythonData) -> Any:
return transformed_data


@flow(name="transform-render-jinja2")
@flow(name="transform_render_jinja2_template")
async def transform_render_jinja2_template(message: TransformJinjaTemplateData) -> str:
service = services.service
await add_branch_tag(branch_name=message.branch)
Expand Down
2 changes: 1 addition & 1 deletion backend/infrahub/workflows/catalogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
)

REQUEST_ARTIFACT_DEFINITION_GENERATE = WorkflowDefinition(
name="artifact-definition-generate",
name="request_artifact_definitions_generate",
type=WorkflowType.INTERNAL,
module="infrahub.git.tasks",
function="generate_request_artifact_definition",
Expand Down
17 changes: 17 additions & 0 deletions backend/tests/unit/workflows/test_catalogue.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from collections import Counter
from typing import TYPE_CHECKING

import pytest
Expand All @@ -14,3 +15,19 @@
def test_workflow_definition(workflow: WorkflowDefinition) -> None:
"""Validate that we can import the function for each workflow."""
workflow.validate_workflow()


@pytest.mark.parametrize("workflow", [pytest.param(workflow, id=workflow.name) for workflow in workflows])
def test_workflow_definition_matches(workflow: WorkflowDefinition) -> None:
"""Validate that the name of the workflow matches the name of the flow"""
flow = workflow.get_function()
assert hasattr(flow, "name")
assert workflow.name == flow.name


def test_workflow_definition_flow_names() -> None:
"""Validate that each workflow has a unique name defined"""
flow_names = [workflow.name for workflow in workflows]
name_counter = Counter(flow_names)
duplicates = [name for name, count in name_counter.items() if count > 1]
assert not duplicates, f"Duplicate flow names found: {', '.join(duplicates)}"
4 changes: 2 additions & 2 deletions development/docker-compose-deps-nats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
retries: 20
start_period: 10s
task-manager:
profiles: [dev]
profiles: [demo, dev]
image: "${TASK_MANAGER_DOCKER_IMAGE:-prefecthq/prefect:3.0.3-python3.12}"
command: prefect server start --host 0.0.0.0 --ui
environment:
Expand All @@ -40,7 +40,7 @@ services:
depends_on:
- task-manager-db
task-manager-db:
profiles: [dev]
profiles: [demo, dev]
image: postgres:16-alpine
environment:
- POSTGRES_USER=postgres
Expand Down
4 changes: 2 additions & 2 deletions development/docker-compose-deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ services:
timeout: 5s
retries: 3
task-manager:
profiles: [dev]
profiles: [demo, dev]
image: "${TASK_MANAGER_DOCKER_IMAGE:-prefecthq/prefect:3.0.3-python3.12}"
command: prefect server start --host 0.0.0.0 --ui
environment:
Expand All @@ -37,7 +37,7 @@ services:
depends_on:
- task-manager-db
task-manager-db:
profiles: [dev]
profiles: [demo, dev]
image: postgres:16-alpine
environment:
- POSTGRES_USER=postgres
Expand Down
41 changes: 1 addition & 40 deletions development/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,47 +148,8 @@ services:
timeout: 5s
retries: 20
start_period: 10s
infrahub-git:
profiles: [demo]
deploy:
mode: replicated
replicas: 2
build:
context: ../
dockerfile: development/Dockerfile
target: backend
image: "${IMAGE_NAME}:${IMAGE_VER}"
pull_policy: always
command: infrahub git-agent start --debug
restart: unless-stopped
depends_on:
- server
environment:
<<: *infrahub_config
INFRAHUB_ADDRESS: http://server:8000
INFRAHUB_INTERNAL_ADDRESS: "http://server:8000"
INFRAHUB_GIT_REPOSITORIES_DIRECTORY: "/opt/infrahub/git"
INFRAHUB_PRODUCTION: false
INFRAHUB_LOG_LEVEL: DEBUG
INFRAHUB_API_TOKEN: 06438eb2-8019-4776-878c-0941b1f1d1ec
INFRAHUB_TIMEOUT: "${INFRAHUB_TIMEOUT:-60}"
INFRAHUB_BROKER_ADDRESS: message-queue
INFRAHUB_CACHE_ADDRESS: "${INFRAHUB_CACHE_ADDRESS:-cache}"
INFRAHUB_DB_ADDRESS: database
INFRAHUB_DB_USERNAME: neo4j
INFRAHUB_DB_PASSWORD: admin
INFRAHUB_DB_PORT: 7687
INFRAHUB_DB_PROTOCOL: bolt
INFRAHUB_STORAGE_DRIVER: local
volumes:
- "git_data:/opt/infrahub/git"
- "git_remote_data:/remote"
tty: true
labels:
com.github.run_id: "${GITHUB_RUN_ID:-unknown}"
com.github.job: "${JOB_NAME:-unknown}"
task-worker:
profiles: [dev]
profiles: [demo, dev]
deploy:
mode: replicated
replicas: 2
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ services:
retries: 5

infrahub-server:
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-0.16.2}"
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-1.0.0}"
restart: unless-stopped
command: >
gunicorn --config backend/infrahub/serve/gunicorn_config.py
Expand Down Expand Up @@ -241,7 +241,7 @@ services:
deploy:
mode: replicated
replicas: 2
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-0.16.2}"
image: "${INFRAHUB_DOCKER_IMAGE:-registry.opsmill.io/opsmill/infrahub}:${VERSION:-1.0.0}"
command: prefect worker start --type infrahubasync --pool infrahub-worker --with-healthcheck
restart: unless-stopped
depends_on:
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/guides/menu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Load the schema into Infrahub using the following command
infrahubctl schema load /path/to/schema.yml
```

In the web interface you will now see that all the nodes defined in the schema are available in the Other section.
In the web interface you will now see that all the nodes defined in the schema are available in the top section of the menu.

## Defining a menu file

Expand Down
9 changes: 9 additions & 0 deletions docs/docs/release-notes/infrahub/release-1_0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ organization where it needs to be.

## Other

### New task-manager component

A new component called `Task Manager` has been introduced within Infrahub, and along with this change the Git-Agent has been renamed to `Task Worker`.
The task manager is based on Prefect, a popular workflow orchestration system.

The Task Manager is used internally to improve the execution and the visibility of all background tasks.
In future releases, we are planning to bring these additional information within Infrahub itself.
Stay tuned for more information and more exciting features around task management in upcoming releases.

### Removed

- Remove previously deprecated GET API endpoint "/api/schema/" ([#3884](https://github.com/opsmill/infrahub/issues/3884))
Expand Down
69 changes: 0 additions & 69 deletions docs/docs/release-notes/infrahub/release-1_0_1-DRAFT.mdx

This file was deleted.

Loading

0 comments on commit 69160f3

Please sign in to comment.