Skip to content

Commit 0d56b9b

Browse files
committed
Merge branch 'develop' into atg-20250219-cs60
2 parents 5972713 + e903010 commit 0d56b9b

File tree

209 files changed

+54837
-1163
lines changed

Some content is hidden

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

209 files changed

+54837
-1163
lines changed

.github/file-filters.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ poetry_files: &poetry_files
1919

2020
doc_files: &doc_files
2121
- "docs/**"
22+
- package.json
23+
- package-lock.json
2224

2325
python_all: &python_all
2426
- "**/*.py"
@@ -32,7 +34,14 @@ yaml_all: &yaml_all
3234
markdown_all: &markdown_all
3335
- "**/*.{md,mdx}"
3436

37+
infrahub_reference_generated: &infrahub_reference_generated
38+
- "docs/docs/infrahubctl/*.mdx"
39+
- "docs/docs/python-sdk/reference/config.mdx"
40+
3541
documentation_all:
3642
- *development_files
3743
- *doc_files
3844
- *markdown_all
45+
46+
documentation_generated_all:
47+
- *infrahub_reference_generated

.github/workflows/ci.yml

Lines changed: 170 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ env:
2424
INFRAHUB_IMAGE_VER: "local"
2525
PYTEST_XDIST_WORKER_COUNT: 4
2626
INFRAHUB_TEST_IN_DOCKER: 1
27-
VALE_VERSION: "3.0.7"
27+
VALE_VERSION: "3.7.1"
2828
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
2929
METRICS_ENDPOINT: ${{ secrets.METRICS_ENDPOINT }}
3030

@@ -36,6 +36,7 @@ jobs:
3636
timeout-minutes: 5
3737
outputs:
3838
documentation: ${{ steps.changes.outputs.documentation_all }}
39+
documentation_generated: ${{ steps.changes.outputs.documentation_generated_all }}
3940
helm: ${{ steps.changes.outputs.helm_all }}
4041
python: ${{ steps.changes.outputs.python_all }}
4142
yaml: ${{ steps.changes.outputs.yaml_all }}
@@ -75,7 +76,7 @@ jobs:
7576
- name: "Check out repository code"
7677
uses: "actions/checkout@v4"
7778
- name: "Setup environment"
78-
run: "pip install ruff==0.8.6"
79+
run: "pip install ruff==0.11.0"
7980
- name: "Linting: ruff check"
8081
run: "ruff check ."
8182
- name: "Linting: ruff format"
@@ -115,6 +116,91 @@ jobs:
115116
SHELLCHECK_OPTS: --exclude=SC2086 --exclude=SC2046 --exclude=SC2004 --exclude=SC2129
116117

117118

119+
documentation:
120+
defaults:
121+
run:
122+
working-directory: ./docs
123+
if: |
124+
always() && !cancelled() &&
125+
!contains(needs.*.result, 'failure') &&
126+
!contains(needs.*.result, 'cancelled') &&
127+
needs.files-changed.outputs.documentation == 'true'
128+
needs: ["files-changed", "yaml-lint", "python-lint"]
129+
runs-on: "ubuntu-22.04"
130+
timeout-minutes: 5
131+
steps:
132+
- name: "Check out repository code"
133+
uses: "actions/checkout@v4"
134+
with:
135+
submodules: true
136+
- name: Install NodeJS
137+
uses: actions/setup-node@v4
138+
with:
139+
node-version: 20
140+
cache: 'npm'
141+
cache-dependency-path: docs/package-lock.json
142+
- name: "Install dependencies"
143+
run: npm install
144+
- name: "Setup Python environment"
145+
run: "pip install invoke toml"
146+
- name: "Build docs website"
147+
run: "invoke docs"
148+
149+
validate-generated-documentation:
150+
if: |
151+
always() && !cancelled() &&
152+
!contains(needs.*.result, 'failure') &&
153+
!contains(needs.*.result, 'cancelled') &&
154+
(needs.files-changed.outputs.python == 'true') || (needs.files-changed.outputs.documentation_generated == 'true')
155+
needs: ["files-changed", "yaml-lint", "python-lint"]
156+
runs-on: "ubuntu-22.04"
157+
timeout-minutes: 5
158+
steps:
159+
- name: "Check out repository code"
160+
uses: "actions/checkout@v4"
161+
with:
162+
submodules: true
163+
- name: Set up Python
164+
uses: actions/setup-python@v5
165+
with:
166+
python-version: "3.12"
167+
- name: "Setup Python environment"
168+
run: |
169+
pipx install poetry==2.1
170+
poetry config virtualenvs.create true --local
171+
poetry env use 3.12
172+
- name: "Install dependencies"
173+
run: "poetry install --no-interaction --no-ansi --extras ctl"
174+
- name: "Setup environment"
175+
run: "pip install invoke toml"
176+
- name: "Validate generated documentation"
177+
run: "poetry run invoke docs-validate"
178+
179+
validate-documentation-style:
180+
if: |
181+
always() && !cancelled() &&
182+
!contains(needs.*.result, 'failure') &&
183+
!contains(needs.*.result, 'cancelled')
184+
needs: ["files-changed", "yaml-lint", "python-lint"]
185+
runs-on: "ubuntu-22.04"
186+
timeout-minutes: 5
187+
steps:
188+
- name: "Check out repository code"
189+
uses: "actions/checkout@v4"
190+
with:
191+
submodules: true
192+
193+
# The official GitHub Action for Vale doesn't work, installing manually instead:
194+
# https://github.com/errata-ai/vale-action/issues/103
195+
- name: Download Vale
196+
run: |
197+
curl -sL "https://github.com/errata-ai/vale/releases/download/v${VALE_VERSION}/vale_${VALE_VERSION}_Linux_64-bit.tar.gz" -o vale.tar.gz
198+
tar -xzf vale.tar.gz
199+
env:
200+
VALE_VERSION: ${{ env.VALE_VERSION }}
201+
- name: "Validate documentation style"
202+
run: ./vale $(find ./docs -type f \( -name "*.mdx" -o -name "*.md" \) )
203+
118204
unit-tests:
119205
env:
120206
# workaround for Rich table column width
@@ -144,7 +230,7 @@ jobs:
144230
python-version: ${{ matrix.python-version }}
145231
- name: "Setup environment"
146232
run: |
147-
pipx install poetry==1.8.5
233+
pipx install poetry==2.1 --python python${{ matrix.python-version }}
148234
poetry config virtualenvs.create true --local
149235
pip install invoke toml codecov
150236
- name: "Install Package"
@@ -174,7 +260,7 @@ jobs:
174260
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
175261

176262
# ------------------------------------------ Integration Tests ------------------------------------------
177-
integration-tests:
263+
integration-tests-latest-infrahub:
178264
if: |
179265
always() && !cancelled() &&
180266
!contains(needs.*.result, 'failure') &&
@@ -197,15 +283,93 @@ jobs:
197283
echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
198284
- name: "Setup environment"
199285
run: |
200-
pipx install poetry==1.8.5
286+
pipx install poetry==2.1
201287
poetry config virtualenvs.create true --local
202288
pip install invoke toml codecov
203289
- name: "Install Package"
204290
run: "poetry install --all-extras"
205291
- name: "Integration Tests"
206-
run: "poetry run pytest --cov infrahub_sdk tests/integration/"
292+
run: |
293+
poetry run pytest --cov infrahub_sdk tests/integration/
207294
- name: "Upload coverage to Codecov"
208295
run: |
209296
codecov --flags integration-tests
210297
env:
211298
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
299+
300+
# NOTE: Disabling this test for now because it's expected that we can't start the latest version of infrahub
301+
# with the current shipping version of infrahub-testcontainers
302+
# integration-tests-local-infrahub:
303+
# if: |
304+
# always() && !cancelled() &&
305+
# !contains(needs.*.result, 'failure') &&
306+
# !contains(needs.*.result, 'cancelled') &&
307+
# needs.files-changed.outputs.python == 'true' &&
308+
# (github.base_ref == 'stable' || github.base_ref == 'develop')
309+
# needs: ["files-changed", "yaml-lint", "python-lint"]
310+
# runs-on:
311+
# group: "huge-runners"
312+
# timeout-minutes: 30
313+
# steps:
314+
# - name: "Check out repository code"
315+
# uses: "actions/checkout@v4"
316+
317+
# - name: "Extract target branch name"
318+
# id: extract_branch
319+
# run: echo "TARGET_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
320+
321+
# - name: "Checkout infrahub repository"
322+
# uses: "actions/checkout@v4"
323+
# with:
324+
# repository: "opsmill/infrahub"
325+
# path: "infrahub-server"
326+
# ref: ${{ github.base_ref }}
327+
# submodules: true
328+
329+
# - name: Set up Python
330+
# uses: actions/setup-python@v5
331+
# with:
332+
# python-version: "3.12"
333+
334+
# - name: "Setup git credentials prior dev.build"
335+
# run: |
336+
# cd infrahub-server
337+
# git config --global user.name 'Infrahub'
338+
# git config --global user.email '[email protected]'
339+
# git config --global --add safe.directory '*'
340+
# git config --global credential.usehttppath true
341+
# git config --global credential.helper /usr/local/bin/infrahub-git-credential
342+
343+
# - name: "Set environment variables prior dev.build"
344+
# run: |
345+
# echo "INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }}" >> $GITHUB_ENV
346+
# RUNNER_NAME=$(echo "${{ runner.name }}" | grep -o 'ghrunner[0-9]\+' | sed 's/ghrunner\([0-9]\+\)/ghrunner_\1/')
347+
# echo "PYTEST_DEBUG_TEMPROOT=/var/lib/github/${RUNNER_NAME}/_temp" >> $GITHUB_ENV
348+
# echo "INFRAHUB_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV
349+
# echo "INFRAHUB_TESTING_IMAGE_VER=local-${{ runner.name }}-${{ github.sha }}" >> $GITHUB_ENV
350+
# echo "INFRAHUB_TESTING_DOCKER_IMAGE=opsmill/infrahub" >> $GITHUB_ENV
351+
352+
# - name: "Build container"
353+
# run: |
354+
# cd infrahub-server
355+
# inv dev.build
356+
357+
# - name: "Setup environment"
358+
# run: |
359+
# pipx install poetry==2.1
360+
# poetry config virtualenvs.create true --local
361+
# pip install invoke toml codecov
362+
363+
# - name: "Install Package"
364+
# run: "poetry install --all-extras"
365+
366+
# - name: "Integration Tests"
367+
# run: |
368+
# echo "Running tests for version: $INFRAHUB_TESTING_IMAGE_VER"
369+
# poetry run pytest --cov infrahub_sdk tests/integration/
370+
371+
# - name: "Upload coverage to Codecov"
372+
# run: |
373+
# codecov --flags integration-tests
374+
# env:
375+
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/sync-docs.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# yamllint disable rule:truthy rule:line-length
3+
name: Sync Folders
4+
5+
on:
6+
push:
7+
branches:
8+
- stable
9+
paths:
10+
- 'docs/docs/**'
11+
- 'docs/sidebars-infrahubctl.ts'
12+
- 'docs/sidebars-python-sdk.ts'
13+
pull_request:
14+
branches:
15+
- stable
16+
17+
jobs:
18+
sync:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout source repository
22+
uses: actions/checkout@v4
23+
with:
24+
path: source-repo
25+
26+
- name: Checkout target repository
27+
uses: actions/checkout@v4
28+
with:
29+
repository: opsmill/infrahub-docs
30+
token: ${{ secrets.PAT_TOKEN }}
31+
path: target-repo
32+
33+
- name: Sync folders
34+
run: |
35+
rm -rf target-repo/docs/docs-python-sdk/*
36+
rm -f target-repo/docs/sidebars-python-sdk.ts
37+
rm -f target-repo/docs/sidebars-infrahubctl.ts
38+
cp -r source-repo/docs/docs/* target-repo/docs/docs-python-sdk/
39+
cp source-repo/docs/sidebars-infrahubctl.ts target-repo/docs/
40+
cp source-repo/docs/sidebars-python-sdk.ts target-repo/docs/
41+
cd target-repo
42+
git config user.name github-actions
43+
git config user.email [email protected]
44+
git add .
45+
if ! (git diff --quiet && git diff --staged --quiet); then git commit -m "Sync doc Python SDK from infrahub repo" && git push; fi

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ dist/*
2727
**/*.csv
2828

2929
# Generated files
30-
generated/
30+
generated/
31+
sandbox/

.vale.ini

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
StylesPath = .vale/styles
2+
3+
MinAlertLevel = warning
4+
5+
[formats]
6+
mdx = md
7+
8+
[docs/**/*.md]
9+
BasedOnStyles = Infrahub
10+
;(import.*?\n) to ignore import statement in .mdx
11+
;(```.*?```\n) to ignore code block in .mdx
12+
BlockIgnores = (?s) *((import.*?\n)|(```.*?```\n))
13+
14+
[*]
15+
BasedOnStyles = Infrahub
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
extends: substitution
3+
message: Use '%s' instead of '%s'
4+
level: error
5+
ignorecase: false
6+
action:
7+
name: replace
8+
swap:
9+
(?:ansible): Ansible
10+
(?:[^"]docker): Docker
11+
(?:[Dd]ockerhub): DockerHub
12+
(?:[^/][Gg]ithub): GitHub
13+
(?:[Gg]itlab): GitLab
14+
(?:gitpod): GitPod
15+
(?:grafana): Grafana
16+
(?:[^/][Gg]raphql): GraphQL
17+
(?:[Ii]nflux[Dd]b): InfluxDB
18+
infrahub(?:\s|$): Infrahub
19+
(?:jinja2): Jinja2
20+
(?:k3s): K3s
21+
(?:k8s): K8s
22+
(?:kubernetes): Kubernetes
23+
(?:[^/][Mm]y[Ss]ql): MySQL
24+
(?:neo4j): Neo4j
25+
(?:[^/][Nn]ginx): NGINX
26+
(?:[Nn]odejs): Node.js
27+
(?:[^/][Oo]penapi): OpenAPI
28+
(?:Openconfig): OpenConfig
29+
opsmill(?:\s|$): OpsMill
30+
(?:[Pp]ostgre[Ss]ql): PostgreSQL
31+
(?:[^/]prometheus): Prometheus
32+
(?:[^/-]python): Python
33+
(?:[Rr]abbitmq): RabbitMQ
34+
(?:[^/]terraform): Terraform
35+
(?:ubuntu): Ubuntu
36+
(?:[Vv]s\W?[Cc]ode): VS Code
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
extends: substitution
3+
message: "Use a space after a colon, but not before"
4+
level: warning
5+
ignorecase: true
6+
nonword: true
7+
swap:
8+
'(?<=\s):(?=\s+)': ': '

.vale/styles/Infrahub/eg-ie.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
extends: substitution
3+
message: "Instead of %s, use ',i.e.,' or 'for example:'."
4+
level: warning
5+
ignorecase: true
6+
nonword: true
7+
action:
8+
name: replace
9+
swap:
10+
- e\.g\.: i.e.
11+
- e\. g\.: i.e.
12+
- i\. e\.: i.e.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
extends: existence
3+
message: "Use a comma before the last 'and' or 'or' in a list of items."
4+
level: suggestion
5+
scope: sentence
6+
nonword: true
7+
tokens:
8+
- '(?:[^\s,]+,){1,} \w+ (?:and|or) \w+[.?!]'

0 commit comments

Comments
 (0)