Skip to content

Commit dd96217

Browse files
committed
merge origin/release-1.2
2 parents 7e84745 + c7ce291 commit dd96217

File tree

1,124 files changed

+55474
-27755
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,124 files changed

+55474
-27755
lines changed

.devcontainer/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ RUN pip install toml invoke
3838

3939
RUN curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.8.5 python3 - \
4040
&& echo "export PATH=\"$HOME/.local/bin:$PATH\"" >> $HOME/.bashrc
41+
42+
RUN bash -c "$(curl -sL https://get.containerlab.dev)"

.github/CODEOWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/backend/ @opsmill/backend
2+
/frontend/ @opsmill/frontend
3+
/docs/ @opsmill/customer-success @opsmill/backend @opsmill/frontend
4+
/docker-compose.yml @opsmill/cloud

.github/file-filters.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ sdk_files: &sdk_files
1717
- "python_sdk" # Catch updates to the submodule commit
1818

1919
infrahub_poetry_files: &infrahub_poetry_files
20-
- "pyproject.toml"
21-
- "poetry.lock"
20+
- "**/pyproject.toml"
21+
- "**/poetry.lock"
2222

2323
frontend_files: &frontend_files
2424
- "frontend/app/**"

.github/workflows/ci.yml

Lines changed: 57 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
with:
123123
submodules: true
124124
- name: "Linting: markdownlint"
125-
uses: DavidAnson/markdownlint-cli2-action@v18
125+
uses: DavidAnson/markdownlint-cli2-action@v19
126126
with:
127127
config: .markdownlint.yaml
128128
globs: |
@@ -157,6 +157,45 @@ jobs:
157157
with:
158158
directory: "./"
159159

160+
infrahub-testcontainers-check:
161+
if: needs.files-changed.outputs.infrahub_poetry_files == 'true'
162+
needs: ["files-changed"]
163+
runs-on: ubuntu-latest
164+
timeout-minutes: 5
165+
steps:
166+
- name: "Check out repository code"
167+
uses: "actions/checkout@v4"
168+
with:
169+
submodules: true
170+
171+
- name: Set up Python
172+
uses: actions/setup-python@v5
173+
with:
174+
python-version: "3.12"
175+
176+
- name: "Setup Python environment"
177+
run: |
178+
pipx install poetry==1.8.5
179+
poetry config virtualenvs.create true --local
180+
poetry env use 3.12
181+
182+
- name: Compare package versions
183+
run: |
184+
INFRAHUB_VERSION=$(poetry version --short)
185+
echo "Infrahub version: $INFRAHUB_VERSION"
186+
187+
cd python_testcontainers
188+
TESTCONTAINERS_VERSION=$(poetry version --short)
189+
echo "Testcontainers version: $TESTCONTAINERS_VERSION"
190+
191+
if [ "$INFRAHUB_VERSION" != "$TESTCONTAINERS_VERSION" ]; then
192+
echo "Error: Version mismatch!"
193+
echo "infrahub version: $INFRAHUB_VERSION"
194+
echo "infrahub-testcontainers version: $TESTCONTAINERS_VERSION"
195+
echo "The version of infrahub-testcontainers must match the version of infrahub"
196+
exit 1
197+
fi
198+
160199
# TODO NEED TO REVISIT THIS ONE
161200
# python-sdk-poetry-check:
162201
# if: |
@@ -217,7 +256,7 @@ jobs:
217256
!contains(needs.*.result, 'failure') &&
218257
!contains(needs.*.result, 'cancelled') &&
219258
needs.files-changed.outputs.backend == 'true'
220-
needs: ["files-changed", "yaml-lint", "python-lint"]
259+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
221260
runs-on:
222261
group: huge-runners
223262
timeout-minutes: 45
@@ -270,7 +309,7 @@ jobs:
270309
!contains(needs.*.result, 'failure') &&
271310
!contains(needs.*.result, 'cancelled') &&
272311
needs.files-changed.outputs.backend == 'true'
273-
needs: ["files-changed", "yaml-lint", "python-lint"]
312+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
274313
runs-on:
275314
group: "huge-runners"
276315
timeout-minutes: 30
@@ -316,7 +355,7 @@ jobs:
316355
!contains(needs.*.result, 'failure') &&
317356
!contains(needs.*.result, 'cancelled') &&
318357
needs.files-changed.outputs.backend == 'true'
319-
needs: ["files-changed", "yaml-lint", "python-lint"]
358+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
320359
runs-on:
321360
group: "huge-runners"
322361
timeout-minutes: 30
@@ -345,8 +384,6 @@ jobs:
345384
run: "poetry install --no-interaction --no-ansi"
346385
- name: "Mypy Tests"
347386
run: "poetry run invoke backend.mypy"
348-
- name: "Pylint Tests"
349-
run: "poetry run invoke backend.pylint"
350387
- name: "Functional Tests"
351388
run: "poetry run invoke backend.test-functional"
352389
- name: "Coveralls : Functional Tests"
@@ -466,7 +503,7 @@ jobs:
466503
!contains(needs.*.result, 'cancelled') &&
467504
(needs.files-changed.outputs.backend == 'true' ||
468505
needs.files-changed.outputs.documentation == 'true')
469-
needs: ["files-changed", "yaml-lint", "python-lint"]
506+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
470507
runs-on: ubuntu-latest
471508
steps:
472509
- name: Check out repository code
@@ -550,7 +587,7 @@ jobs:
550587
!contains(needs.*.result, 'failure') &&
551588
!contains(needs.*.result, 'cancelled') &&
552589
needs.files-changed.outputs.documentation == 'true'
553-
needs: ["files-changed", "yaml-lint", "python-lint"]
590+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
554591
runs-on: "ubuntu-22.04"
555592
timeout-minutes: 5
556593
steps:
@@ -576,8 +613,8 @@ jobs:
576613
always() && !cancelled() &&
577614
!contains(needs.*.result, 'failure') &&
578615
!contains(needs.*.result, 'cancelled') &&
579-
(needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation_generated == 'true')
580-
needs: ["files-changed", "yaml-lint", "python-lint"]
616+
(needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation == 'true')
617+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
581618
runs-on: "ubuntu-22.04"
582619
timeout-minutes: 5
583620
steps:
@@ -606,8 +643,8 @@ jobs:
606643
always() && !cancelled() &&
607644
!contains(needs.*.result, 'failure') &&
608645
!contains(needs.*.result, 'cancelled') &&
609-
needs.files-changed.outputs.release == 'true'
610-
needs: ["files-changed", "yaml-lint", "python-lint"]
646+
(needs.files-changed.outputs.release == 'true') || (needs.files-changed.outputs.documentation == 'true')
647+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
611648
runs-on: "ubuntu-22.04"
612649
timeout-minutes: 5
613650
steps:
@@ -632,7 +669,7 @@ jobs:
632669
!contains(needs.*.result, 'failure') &&
633670
!contains(needs.*.result, 'cancelled') &&
634671
needs.files-changed.outputs.release == 'true'
635-
needs: ["files-changed", "yaml-lint", "python-lint"]
672+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
636673
runs-on: "ubuntu-22.04"
637674
timeout-minutes: 5
638675
steps:
@@ -661,6 +698,7 @@ jobs:
661698
- files-changed
662699
- yaml-lint
663700
- python-lint
701+
- infrahub-testcontainers-check
664702
if: |
665703
always() && !cancelled() &&
666704
!contains(needs.*.result, 'failure') &&
@@ -756,14 +794,6 @@ jobs:
756794
- name: Install Playwright Browsers
757795
run: npx playwright install chromium
758796

759-
# Make chromium ignore netlink messages by returning HandleMessage early
760-
- name: Chrome path
761-
run: echo CHROME_BIN_PATH="$(npx playwright install chromium --dry-run | grep Install | grep chromium- | awk '{print $3}')/chrome-linux/chrome" >> $GITHUB_ENV
762-
- name: Chrome func offset
763-
run: echo FUNC_OFFSET="$(objdump -C --file-offsets --disassemble='net::internal::AddressTrackerLinux::HandleMessage(char const*, int, bool*, bool*, bool*)' $CHROME_BIN_PATH | grep 'File Offset' | sed -n 1p | sed -E 's/.*File Offset. (.*)\).*/\1/')" >> $GITHUB_ENV
764-
- name: Patch chromium
765-
run: printf '\xc3' | dd of=$CHROME_BIN_PATH bs=1 seek=$(($FUNC_OFFSET)) conv=notrunc
766-
767797
- name: Wait for artifacts to be generated before restarting infrahub
768798
if: needs.files-changed.outputs.e2e_tests == 'true'
769799
run: npx playwright test artifact
@@ -850,11 +880,12 @@ jobs:
850880
- files-changed
851881
- yaml-lint
852882
- python-lint
883+
- infrahub-testcontainers-check
853884
if: |
854885
always() && !cancelled() &&
855886
!contains(needs.*.result, 'failure') &&
856887
!contains(needs.*.result, 'cancelled') &&
857-
github.base_ref == 'develop'
888+
github.base_ref == 'stable'
858889
runs-on:
859890
group: huge-runners
860891
steps:
@@ -876,7 +907,8 @@ jobs:
876907
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV
877908

878909
- name: "Set environment variables"
879-
run: echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV
910+
run: |
911+
echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV
880912
- name: "Clear docker environment"
881913
run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local
882914

@@ -923,6 +955,7 @@ jobs:
923955
- files-changed
924956
- yaml-lint
925957
- python-lint
958+
- infrahub-testcontainers-check
926959
if: |
927960
always() && !cancelled() &&
928961
!contains(needs.*.result, 'failure') &&
@@ -936,6 +969,7 @@ jobs:
936969
- files-changed
937970
- yaml-lint
938971
- python-lint
972+
- infrahub-testcontainers-check
939973
if: |
940974
always() && !cancelled() &&
941975
!contains(needs.*.result, 'failure') &&

.github/workflows/version-upgrade.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,21 @@ jobs:
7171
- name: Initialize Demo
7272
id: init-demo
7373
run: invoke demo.start demo.load-infra-schema
74+
env:
75+
PREFECT_SERVER_COMMAND: "prefect server start --host 0.0.0.0 --ui"
7476
- name: Check Demo Status
7577
run: invoke demo.status
7678
- name: Load Data
7779
run: invoke demo.load-infra-data
80+
env:
81+
PREFECT_SERVER_COMMAND: "prefect server start --host 0.0.0.0 --ui"
7882
- name: Stop Demo
7983
run: invoke demo.stop
8084

8185
# Build the local version and run the migrations
8286
- name: "Set environment variables"
83-
run: echo INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }} >> $GITHUB_ENV
87+
run: |
88+
echo INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }} >> $GITHUB_ENV
8489
8590
- name: Build Demo
8691
run: invoke dev.build
@@ -111,6 +116,10 @@ jobs:
111116
if: always()
112117
run: docker logs "${INFRAHUB_BUILD_NAME}-database-1"
113118

119+
- name: Display task-manager logs
120+
if: always()
121+
run: docker logs "${INFRAHUB_BUILD_NAME}-task-manager-1"
122+
114123
- name: Display server status
115124
if: always()
116125
run: invoke demo.status

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,42 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang
1111

1212
<!-- towncrier release notes start -->
1313

14+
## [Infrahub - v1.2.0b1](https://github.com/opsmill/infrahub/tree/infrahub-v1.2.0b1) - 2025-03-03
15+
16+
### Added
17+
18+
- Added Containerlab to the GitHub Codespace base image. ([#458](https://github.com/opsmill/infrahub/issues/458))
19+
- Added validation to the UI for `min_count` and `max_count` in relationships fields. ([#5661](https://github.com/opsmill/infrahub/issues/5661))
20+
- Added a new feature to create object templates when setting `generate_template: true` in a schema on a node.
21+
- Added activities logs into the node details view.
22+
- Added icon support to sub-menu items in the sidebar.
23+
- Improved Infrahub app layout for a cleaner look. Made the top menu more compact.
24+
25+
### Changed
26+
27+
- Replaced `PrefixPool` with `netaddr.IPSet`. ([#3547](https://github.com/opsmill/infrahub/issues/3547))
28+
- Modified the query analyzer to not list all potential meta data models when only querying for "source" or "owner" ID. The full models will still show up if a fragment is used under the meta data properties. This change makes it easier to setup fine grained permissions and also speeds up the permission lookup as it doesn't require as many checks. ([#4644](https://github.com/opsmill/infrahub/issues/4644))
29+
- Improved the performance of the cypher query that saves a diff.
30+
- Improved typing of GraphQL schema by defining list as non-nullable and ensure that top level item are mandatory.
31+
- Made object list retrieval faster with an optimized query.
32+
- Reorganized builtin/default menu to provide a better user experience.
33+
- Updated Infrahub account tokens view:
34+
- Redesigned for a faster, cleaner experience.
35+
- Improved clarity and formatting of expiration dates.
36+
- Resolved an issue where expiration data was not being sent to the API.
37+
- Updated the `DiffUpdate` mutation to return the id of the task when `wait_until_completion` is False. Also the argument `wait_for_completion` under data is deprecated and it has been replaced with `wait_until_completion` at the root of the mutation instead to align with the format of the other mutations.
38+
39+
### Fixed
40+
41+
- Fixed an event error in event state after merging a proposed change, they were incorrectly set as "merging" instead of "merged". ([#5600](https://github.com/opsmill/infrahub/issues/5600))
42+
- Fixed an error in the query to count the number of peers for a given cardinality-many relationship. Previous logic could have resulted in the count being multiplied by a power of 2 if changes were made to the relationship during a merge.
43+
44+
### Housekeeping
45+
46+
- Activated `ruff` B rules. ([#2193](https://github.com/opsmill/infrahub/issues/2193))
47+
- Activated `ruff` C4 rule. ([#2194](https://github.com/opsmill/infrahub/issues/2194))
48+
- Added a basic integration test for the HTTP service adapter. ([#5553](https://github.com/opsmill/infrahub/issues/5553))
49+
1450
## [Infrahub - v1.1.7](https://github.com/opsmill/infrahub/tree/infrahub-v1.1.7) - 2025-02-18
1551

1652
### Added

backend/infrahub/api/artifact.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
from fastapi import APIRouter, Body, Depends, Request, Response
66
from pydantic import BaseModel, Field
77

8-
from infrahub.api.dependencies import BranchParams, get_branch_params, get_current_user, get_db, get_permission_manager
8+
from infrahub.api.dependencies import (
9+
BranchParams,
10+
get_branch_params,
11+
get_context,
12+
get_current_user,
13+
get_db,
14+
get_permission_manager,
15+
)
916
from infrahub.core import registry
1017
from infrahub.core.account import ObjectPermission
1118
from infrahub.core.constants import GLOBAL_BRANCH_NAME, InfrahubKind, PermissionAction
@@ -19,7 +26,9 @@
1926

2027
if TYPE_CHECKING:
2128
from infrahub.auth import AccountSession
29+
from infrahub.context import InfrahubContext
2230
from infrahub.permissions import PermissionManager
31+
from infrahub.services import InfrahubServices
2332

2433
log = get_logger()
2534
router = APIRouter(prefix="/artifact")
@@ -57,12 +66,13 @@ async def generate_artifact(
5766
request: Request,
5867
artifact_definition_id: str,
5968
payload: ArtifactGeneratePayload = Body(
60-
ArtifactGeneratePayload(),
69+
ArtifactGeneratePayload(), # noqa: B008
6170
description="Payload of the request, can be used to limit the scope of the query to a specific list of hosts",
6271
),
6372
db: InfrahubDatabase = Depends(get_db),
6473
branch_params: BranchParams = Depends(get_branch_params),
6574
permission_manager: PermissionManager = Depends(get_permission_manager),
75+
context: InfrahubContext = Depends(get_context),
6676
) -> None:
6777
permission_decision = (
6878
PermissionDecisionFlag.ALLOW_DEFAULT
@@ -83,12 +93,14 @@ async def generate_artifact(
8393
branch=branch_params.branch,
8494
)
8595

86-
service = request.app.state.service
96+
service: InfrahubServices = request.app.state.service
8797
model = RequestArtifactDefinitionGenerate(
8898
artifact_definition_id=artifact_definition.id,
8999
artifact_definition_name=artifact_definition.name.value,
90100
branch=branch_params.branch.name,
91101
limit=payload.nodes,
92102
)
93103

94-
await service.workflow.submit_workflow(workflow=REQUEST_ARTIFACT_DEFINITION_GENERATE, parameters={"model": model})
104+
await service.workflow.submit_workflow(
105+
workflow=REQUEST_ARTIFACT_DEFINITION_GENERATE, context=context, parameters={"model": model}
106+
)

backend/infrahub/api/dependencies.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from infrahub import config
1010
from infrahub.auth import AccountSession, authentication_token, validate_jwt_access_token, validate_jwt_refresh_token
11+
from infrahub.context import InfrahubContext
1112
from infrahub.core.branch import Branch # noqa: TC001
1213
from infrahub.core.registry import registry
1314
from infrahub.core.timestamp import Timestamp
@@ -133,3 +134,10 @@ async def get_permission_manager(
133134
await permission_manager.load_permissions(db=db, branch=branch_params.branch)
134135

135136
return permission_manager
137+
138+
139+
async def get_context(
140+
branch: Branch = Depends(get_branch_dep),
141+
account_session: AccountSession = Depends(get_current_user),
142+
) -> InfrahubContext:
143+
return InfrahubContext.init(branch=branch, account=account_session)

backend/infrahub/api/oauth2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from infrahub.database import InfrahubDatabase
2323
from infrahub.services import InfrahubServices
2424

25-
# pylint: disable=R0801
2625

2726
log = get_logger()
2827
router = APIRouter(prefix="/oauth2")

backend/infrahub/api/oidc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from infrahub.database import InfrahubDatabase
2525
from infrahub.services import InfrahubServices
2626

27-
# pylint: disable=R0801
2827

2928
log = get_logger()
3029
router = APIRouter(prefix="/oidc")

0 commit comments

Comments
 (0)