Skip to content

Commit 8fe7630

Browse files
committed
merge origin/release-1.2
2 parents eb60128 + 9bcb57c commit 8fe7630

File tree

1,040 files changed

+43384
-19784
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,040 files changed

+43384
-19784
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/workflows/ci.yml

Lines changed: 55 additions & 21 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.python == '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"
@@ -464,7 +501,7 @@ jobs:
464501
!contains(needs.*.result, 'cancelled') &&
465502
(needs.files-changed.outputs.backend == 'true' ||
466503
needs.files-changed.outputs.documentation == 'true')
467-
needs: ["files-changed", "yaml-lint", "python-lint"]
504+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
468505
runs-on: ubuntu-latest
469506
steps:
470507
- name: Check out repository code
@@ -548,7 +585,7 @@ jobs:
548585
!contains(needs.*.result, 'failure') &&
549586
!contains(needs.*.result, 'cancelled') &&
550587
needs.files-changed.outputs.documentation == 'true'
551-
needs: ["files-changed", "yaml-lint", "python-lint"]
588+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
552589
runs-on: "ubuntu-22.04"
553590
timeout-minutes: 5
554591
steps:
@@ -575,7 +612,7 @@ jobs:
575612
!contains(needs.*.result, 'failure') &&
576613
!contains(needs.*.result, 'cancelled') &&
577614
(needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation_generated == 'true')
578-
needs: ["files-changed", "yaml-lint", "python-lint"]
615+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
579616
runs-on: "ubuntu-22.04"
580617
timeout-minutes: 5
581618
steps:
@@ -605,7 +642,7 @@ jobs:
605642
!contains(needs.*.result, 'failure') &&
606643
!contains(needs.*.result, 'cancelled') &&
607644
needs.files-changed.outputs.release == 'true'
608-
needs: ["files-changed", "yaml-lint", "python-lint"]
645+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
609646
runs-on: "ubuntu-22.04"
610647
timeout-minutes: 5
611648
steps:
@@ -630,7 +667,7 @@ jobs:
630667
!contains(needs.*.result, 'failure') &&
631668
!contains(needs.*.result, 'cancelled') &&
632669
needs.files-changed.outputs.release == 'true'
633-
needs: ["files-changed", "yaml-lint", "python-lint"]
670+
needs: ["files-changed", "yaml-lint", "python-lint", "infrahub-testcontainers-check"]
634671
runs-on: "ubuntu-22.04"
635672
timeout-minutes: 5
636673
steps:
@@ -659,6 +696,7 @@ jobs:
659696
- files-changed
660697
- yaml-lint
661698
- python-lint
699+
- infrahub-testcontainers-check
662700
if: |
663701
always() && !cancelled() &&
664702
!contains(needs.*.result, 'failure') &&
@@ -754,14 +792,6 @@ jobs:
754792
- name: Install Playwright Browsers
755793
run: npx playwright install chromium
756794

757-
# Make chromium ignore netlink messages by returning HandleMessage early
758-
- name: Chrome path
759-
run: echo CHROME_BIN_PATH="$(npx playwright install chromium --dry-run | grep Install | grep chromium- | awk '{print $3}')/chrome-linux/chrome" >> $GITHUB_ENV
760-
- name: Chrome func offset
761-
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
762-
- name: Patch chromium
763-
run: printf '\xc3' | dd of=$CHROME_BIN_PATH bs=1 seek=$(($FUNC_OFFSET)) conv=notrunc
764-
765795
- name: Wait for artifacts to be generated before restarting infrahub
766796
if: needs.files-changed.outputs.e2e_tests == 'true'
767797
run: npx playwright test artifact
@@ -848,11 +878,12 @@ jobs:
848878
- files-changed
849879
- yaml-lint
850880
- python-lint
881+
- infrahub-testcontainers-check
851882
if: |
852883
always() && !cancelled() &&
853884
!contains(needs.*.result, 'failure') &&
854885
!contains(needs.*.result, 'cancelled') &&
855-
github.base_ref == 'develop'
886+
github.base_ref == 'stable'
856887
runs-on:
857888
group: huge-runners
858889
steps:
@@ -874,7 +905,8 @@ jobs:
874905
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV
875906

876907
- name: "Set environment variables"
877-
run: echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV
908+
run: |
909+
echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV
878910
- name: "Clear docker environment"
879911
run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local
880912

@@ -921,6 +953,7 @@ jobs:
921953
- files-changed
922954
- yaml-lint
923955
- python-lint
956+
- infrahub-testcontainers-check
924957
if: |
925958
always() && !cancelled() &&
926959
!contains(needs.*.result, 'failure') &&
@@ -934,6 +967,7 @@ jobs:
934967
- files-changed
935968
- yaml-lint
936969
- python-lint
970+
- infrahub-testcontainers-check
937971
if: |
938972
always() && !cancelled() &&
939973
!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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,40 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang
1111

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

14+
## [Infrahub - v1.2.0rc0](https://github.com/opsmill/infrahub/tree/infrahub-v1.2.0rc0) - 2025-02-23
15+
16+
### Added
17+
18+
- Added Containerlab to the codespace base image. ([#458](https://github.com/opsmill/infrahub/issues/458))
19+
- - We added validation on UI for `min_count` and `max_count` in relationships fields. ([#5661](https://github.com/opsmill/infrahub/issues/5661))
20+
- - Improved Infrahub app layout for a cleaner look.
21+
- Made the top menu more compact.
22+
- Add activities logs in the nodes details view
23+
- Add new feature to create object templates when setting `generate_template: true` in a schema on a node
24+
25+
### Changed
26+
27+
- Replace PrefixPool with netaddr.IPSet ([#3547](https://github.com/opsmill/infrahub/issues/3547))
28+
- Modified 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+
- - We made object list retrieval faster with an optimized query.
30+
- Improve typing of GraphQL schema by defining list as non-nullable and ensure that top level item are mandatory.
31+
- Reorganized builtin/default menu to provide a better user experience.
32+
- Updated Infrahub account tokens view:
33+
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+
38+
### Fixed
39+
40+
- Set correct state in events after merging a proposed change, they were incorrectly set as "merging" instead of "merged" ([#5600](https://github.com/opsmill/infrahub/issues/5600))
41+
42+
### Housekeeping
43+
44+
- Activate ruff B rules. ([#2193](https://github.com/opsmill/infrahub/issues/2193))
45+
- Activate ruff C4 rule. ([#2194](https://github.com/opsmill/infrahub/issues/2194))
46+
- Add basic integration test for the HTTP service adapter ([#5553](https://github.com/opsmill/infrahub/issues/5553))
47+
1448
## [Infrahub - v1.1.7](https://github.com/opsmill/infrahub/tree/infrahub-v1.1.7) - 2025-02-18
1549

1650
### 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)