Skip to content

Commit 7c65729

Browse files
authored
Merge pull request #298 from opsmill/dga-20250309-stable-2-develop
Merge stable into develop
2 parents 825363c + 0f3b003 commit 7c65729

File tree

98 files changed

+20530
-19
lines changed

Some content is hidden

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

98 files changed

+20530
-19
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: 87 additions & 1 deletion
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 }}
@@ -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==1.8.5
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

.github/workflows/sync-docs.yml

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

.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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
(?i:[^/]Github): GitHub
10+
(?i:gitpod): GitPod
11+
(?i:[^/]Graphql): GraphQL
12+
infrahub(?:\s|$): Infrahub
13+
(?i:Openconfig): OpenConfig
14+
opsmill(?:\s|$): OpsMill
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+[.?!]'
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
extends: capitalization
3+
message: "'%s' should use sentence case"
4+
level: warning
5+
scope:
6+
- heading.h1
7+
- heading.h2
8+
- heading.h3
9+
- heading.h4
10+
- heading.h5
11+
- heading.h6
12+
match: $sentence
13+
exceptions:
14+
- Alpha
15+
- Ansible
16+
- API
17+
- Attributes
18+
- AWS S3
19+
- Beta
20+
- BGP
21+
- CA certificates
22+
- CI
23+
- Codespaces
24+
- Computed Attribute
25+
- Computed Attributes
26+
- CoreArtifactTarget
27+
- CoreRepository
28+
- CoreGroup
29+
- Docker Compose
30+
- E2E
31+
- Generics
32+
- Git
33+
- GitHub
34+
- GitHub Codespaces
35+
- GitLab
36+
- GitPod
37+
- GraphQL
38+
- GraphQLQuery
39+
- include_in_menu & menu_placement
40+
- Helm
41+
- High Availability
42+
- Human Friendly Identifier
43+
- Infrahub
44+
- infrahubctl
45+
- IPHost
46+
- IP
47+
- IPAM
48+
- IPNetwork
49+
- IP Fabric
50+
- JavaScript
51+
- JetStream
52+
- Jinja
53+
- Jinja2
54+
- JWT
55+
- Namespace
56+
- NATS
57+
- Node
58+
- OAuth2
59+
- OIDC
60+
- Open ID Connect
61+
- OpsMill
62+
- Pydantic
63+
- Python
64+
- RabbitMQ
65+
- REST
66+
- RFile
67+
- SDK
68+
- Single sign-on
69+
- SSO
70+
- TLS
71+
- Tony Stark
72+
- TransformPython
73+
- Trusted Root Certificate Store
74+
- UI
75+
- Vale
76+
- VS Code
77+
- VS Code extensions
78+
- WebUI
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
extends: existence
3+
message: "Remove %s and avoid words that minimize the effort level required."
4+
level: warning
5+
ignorecase: true
6+
tokens:
7+
- easy
8+
- simple
9+
- simply

0 commit comments

Comments
 (0)