Skip to content

Commit

Permalink
Merge pull request #3833 from opsmill/release-0.15
Browse files Browse the repository at this point in the history
Release 0.15 into stable
  • Loading branch information
dgarros authored Jul 15, 2024
2 parents 9b65ea8 + 8d923e0 commit 47430b1
Show file tree
Hide file tree
Showing 1,056 changed files with 65,802 additions and 61,724 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ coverage.xml
.git*
.devcontainer
.husky
frontend/node_modules
frontend/playwright-report
frontend/**/node_modules
frontend/**/playwright-report

# Direnv files (https://direnv.net/)
.direnv/
Expand Down
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ body:
- Python SDK
- infrahubctl CLI
- Not Sure
- type: input
attributes:
label: Infrahub version
description: Infrahub version (e.g. 0.14.2)
validations:
required: true
- type: textarea
attributes:
label: Current Behavior
Expand Down
4 changes: 2 additions & 2 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ sync_poetry_files: &sync_poetry_files
- "sync/poetry.lock"

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

e2e_test_files:
- "frontend/tests/e2e/**"
- "frontend/app/tests/e2e/**"

demo_files: &demo_files
- "models/**"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
password: ${{ secrets.HARBOR_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
id: push
with:
context: .
Expand Down
44 changes: 21 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ jobs:
with:
node-version: 20
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
cache-dependency-path: frontend/app/package-lock.json
- name: Install frontend dependencies
working-directory: ./frontend
working-directory: ./frontend/app
run: npm install
- name: Run ESLint
working-directory: ./frontend
working-directory: ./frontend/app
run: npm run eslint

python-lint:
Expand All @@ -117,9 +117,9 @@ jobs:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Setup environment"
run: "pip install ruff==0.4.3"
run: "pip install ruff==0.4.6"
- name: "Linting: ruff check"
run: "ruff check --diff ."
run: "ruff check ."
- name: "Linting: ruff format"
run: "ruff format --check --diff ."

Expand Down Expand Up @@ -194,7 +194,6 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
pydantic-version: ["1.10.14", "^2"]
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
Expand All @@ -220,14 +219,12 @@ jobs:
pipx install poetry
poetry config virtualenvs.prefer-active-python true
pip install invoke toml
- name: Set Version of Pydantic
run: poetry add pydantic@${{ matrix.pydantic-version }}
- name: "Install Package"
run: "poetry install --all-extras"
- name: "Pylint Tests"
run: "poetry run pylint infrahub_sdk/"
- name: "Mypy Tests"
run: "poetry run mypy --show-error-codes infrahub_sdk/"
- name: "Pylint Tests"
run: "poetry run pylint infrahub_sdk/"
- name: "Unit Tests"
run: "poetry --directory python_sdk run coverage run --source=infrahub_sdk -m pytest python_sdk/tests/unit/"
working-directory: ./
Expand Down Expand Up @@ -360,7 +357,7 @@ jobs:
flag-name: backend-unit
parallel: true
- name: Generate tracing spans
if: always()
if: always() && github.event.pull_request.head.repo.fork == false
uses: inception-health/otel-upload-test-artifact-action@v1
with:
jobName: "backend-tests-unit"
Expand Down Expand Up @@ -396,10 +393,10 @@ jobs:
run: "invoke dev.build"
- name: "Pull External Docker Images"
run: "invoke dev.pull"
- name: "Pylint Tests"
run: "invoke backend.pylint --docker"
- name: "Mypy Tests"
run: "invoke backend.mypy --docker"
- name: "Pylint Tests"
run: "invoke backend.pylint --docker"
- name: "Integration Tests"
run: "invoke backend.test-integration"
- name: "Coveralls : Integration Tests"
Expand Down Expand Up @@ -500,15 +497,15 @@ jobs:
with:
node-version: 20
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
cache-dependency-path: frontend/app/package-lock.json
- name: "Install frontend"
working-directory: ./frontend
working-directory: ./frontend/app
run: npm install
- name: "Run unit tests"
working-directory: ./frontend
working-directory: ./frontend/app
run: "npm run test:coverage"
- name: "Run integration tests"
working-directory: ./frontend
working-directory: ./frontend/app
run: "npm run cypress:run"
- name: Upload cypress screenshots
if: failure()
Expand All @@ -521,7 +518,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: screenshots
path: frontend/cypress/videos/*
path: frontend/app/cypress/videos/*
- name: "Coveralls : Unit Tests"
uses: coverallsapp/github-action@v2
continue-on-error: true
Expand All @@ -530,7 +527,7 @@ jobs:
with:
flag-name: frontend-unit
parallel: true
file: frontend/coverage/lcov.info
file: frontend/app/coverage/lcov.info

documentation:
defaults:
Expand Down Expand Up @@ -609,7 +606,7 @@ jobs:
E2E-testing-playwright:
defaults:
run:
working-directory: ./frontend
working-directory: ./frontend/app
needs:
- javascript-lint
- files-changed
Expand Down Expand Up @@ -664,6 +661,7 @@ jobs:
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV

- name: Enable tracing
if: github.event.pull_request.head.repo.fork == false
run: echo "INFRAHUB_TRACE_ENABLE=true" >> $GITHUB_ENV
- name: Set tracing configuration
run: echo "INFRAHUB_TRACE_INSECURE=false" >> $GITHUB_ENV
Expand Down Expand Up @@ -734,12 +732,12 @@ jobs:
run: npm run ci:test:e2e

- name: Generate tracing spans
if: always()
if: always() && github.event.pull_request.head.repo.fork == false
uses: inception-health/otel-upload-test-artifact-action@v1
with:
jobName: "E2E-testing-playwright"
stepName: "Run Playwright tests"
path: "frontend/playwright-junit.xml"
path: "frontend/app/playwright-junit.xml"
type: "junit"
githubToken: ${{ secrets.GH_TRACING_REPO_TOKEN }}

Expand All @@ -748,7 +746,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: frontend/playwright-report/
path: frontend/app/playwright-report/

- name: Containers after tests
if: always()
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
triage:
if: github.event.pull_request.head.repo.fork == false
permissions:
contents: read
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-bench-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
latest=true
- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
id: push
with:
context: utilities/benchmark
Expand Down
18 changes: 6 additions & 12 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: New Preview Release
on:
push:
tags:
- 'infrahub-v*rc*'
- 'infrahub-v*-*'

jobs:
meta_data:
Expand All @@ -21,11 +21,13 @@ jobs:
images: |
${{ vars.HARBOR_HOST }}/${{ github.repository }}
tags: |
type=match,pattern=infrahub-v(\d+\.\d+\.\d+rc\d+),group=1
type=match,pattern=infrahub-v(\d+\.\d+rc\d+),group=1
type=raw,value=rc
type=match,pattern=infrahub-v(\d+\.\d+\.\d+-\w+),group=1
type=match,pattern=infrahub-v(\d+\.\d+-\w+),group=1
type=raw,value=preview
labels: |
org.opencontainers.image.source=${{ github.repository }}
flavor: |
latest=false
# Commented until we agree to link Infrahub version and chart version
# extract-version:
Expand All @@ -47,11 +49,3 @@ jobs:
ref: ${{ github.sha }}
tags: ${{ needs.meta_data.outputs.tags }}
labels: ${{ needs.meta_data.outputs.labels }}

publish-helm-chart:
uses: ./.github/workflows/publish-helm-chart.yml
secrets: inherit
# needs: extract-version
with:
publish: true
# version: ${{ needs.extract-version.outputs.version }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
tags:
- 'infrahub-v*'
- '!infrahub-v*rc*'
- '!infrahub-v*-*'

jobs:
meta_data:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.6
rev: v0.4.6
hooks:
# Run the linter.
- id: ruff
Expand Down
2 changes: 1 addition & 1 deletion .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ignore: |
/.venv
/examples
/repositories
/frontend/playwright-report
/frontend/**/playwright-report
**/node_modules
# https://github.com/sbaudoin/yamllint/issues/16
/helm/templates
Expand Down
6 changes: 3 additions & 3 deletions backend/infrahub/api/artifact.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING, List
from typing import TYPE_CHECKING

from fastapi import APIRouter, Body, Depends, Request, Response
from pydantic import BaseModel, Field
Expand All @@ -21,11 +21,11 @@


class ArtifactGeneratePayload(BaseModel):
nodes: List[str] = Field(default_factory=list)
nodes: list[str] = Field(default_factory=list)


class ArtifactGenerateResponse(BaseModel):
nodes: List[str]
nodes: list[str]


@router.get("/{artifact_id:str}")
Expand Down
5 changes: 2 additions & 3 deletions backend/infrahub/api/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from fastapi import Depends, Query, Request
from fastapi.security import APIKeyHeader, HTTPAuthorizationCredentials, HTTPBearer
from pydantic.v1 import BaseModel
from pydantic import BaseModel, ConfigDict

from infrahub import config
from infrahub.auth import AccountSession, authentication_token, validate_jwt_access_token, validate_jwt_refresh_token
Expand All @@ -31,8 +31,7 @@ class BranchParams(BaseModel):
branch: Branch
at: Timestamp

class Config:
arbitrary_types_allowed = True
model_config = ConfigDict(arbitrary_types_allowed=True)


async def get_session(request: Request) -> AsyncIterator[AsyncSession]:
Expand Down
12 changes: 6 additions & 6 deletions backend/infrahub/api/diff/diff.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from collections import defaultdict
from typing import TYPE_CHECKING, Dict, Optional, Tuple
from typing import TYPE_CHECKING, Optional

from fastapi import APIRouter, Depends, Request
from infrahub_sdk.utils import compare_lists
Expand Down Expand Up @@ -91,8 +91,8 @@ async def get_diff_files(
time_to: Optional[str] = None,
branch_only: bool = True,
_: str = Depends(get_current_user),
) -> Dict[str, Dict[str, BranchDiffRepository]]:
response: Dict[str, Dict[str, BranchDiffRepository]] = defaultdict(dict)
) -> dict[str, dict[str, BranchDiffRepository]]:
response: dict[str, dict[str, BranchDiffRepository]] = defaultdict(dict)
service: InfrahubServices = request.app.state.service

# Query the Diff for all files and repository from the database
Expand Down Expand Up @@ -126,7 +126,7 @@ async def get_diff_artifacts(
time_to: Optional[str] = None,
branch_only: bool = False,
_: str = Depends(get_current_user),
) -> Dict[str, BranchDiffArtifact]:
) -> dict[str, BranchDiffArtifact]:
response = {}

default_branch_name = registry.default_branch
Expand Down Expand Up @@ -167,7 +167,7 @@ async def get_diff_artifacts(
targets += targets_in_main

target_per_kinds = defaultdict(list)
target_per_artifact: Dict[str, ArtifactTarget] = {}
target_per_artifact: dict[str, ArtifactTarget] = {}
for target in targets:
for artifact_id in await target.artifacts.get_peers(db=db):
target_per_artifact[artifact_id] = ArtifactTarget(id=target.id, kind=target.get_kind())
Expand All @@ -179,7 +179,7 @@ async def get_diff_artifacts(

# If an artifact has been already created in main, it will appear as CREATED insted of UPDATED
# To fix that situation, we extract all unique identifier for an artifact (target_id, definition_id) in order to make it easier to search later
artifacts_in_main: Dict[Tuple[str, str], BranchDiffNode] = {}
artifacts_in_main: dict[tuple[str, str], BranchDiffNode] = {}
for node in payload[default_branch_name]:
if (
node.action != DiffAction.ADDED
Expand Down
Loading

0 comments on commit 47430b1

Please sign in to comment.