Skip to content

Commit cc4a08d

Browse files
authored
docs: use GitHub alerts instead of mkdocs admonitions (#592)
* docs: use GitHub alerts instead of mkdocs admonitions Signed-off-by: Michael Crenshaw <[email protected]> * add back the thing copilot removed Signed-off-by: Michael Crenshaw <[email protected]> * fix ci order Signed-off-by: Michael Crenshaw <[email protected]> --------- Signed-off-by: Michael Crenshaw <[email protected]>
1 parent 60bbfb2 commit cc4a08d

File tree

10 files changed

+115
-81
lines changed

10 files changed

+115
-81
lines changed

.github/copilot-instructions.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,31 @@ make docker-build
214214
- If deepcopy methods are missing, run `make generate`
215215
- If UI builds fail, check Node.js version and run `npm install` in the UI directory
216216

217+
# Setting up MkDocs and Python Virtual Environment
218+
219+
To build and serve documentation locally, set up a Python virtual environment at the repository root:
220+
221+
```fish
222+
python3 -m venv .venv
223+
source .venv/bin/activate.fish
224+
pip install -r docs/requirements.txt
225+
mkdocs serve
226+
```
227+
228+
- This will install all MkDocs dependencies, including plugins for GitHub-style alerts.
229+
230+
## Verifying Documentation Linting
231+
232+
To check that your documentation changes do not introduce any MkDocs warnings, run:
233+
234+
```bash
235+
make lint-docs
236+
```
237+
238+
This will build the documentation and fail if any warnings are present. The full MkDocs output will be shown if there are issues, making it easy to debug. This check is also run automatically in CI for every pull request.
239+
240+
Make sure you have activated your Python virtual environment and installed dependencies as described above before running this command.
241+
217242
## Additional Resources
218243

219244
- Main documentation: https://gitops-promoter.readthedocs.io/

.github/workflows/ci.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ jobs:
3131
make build-extension
3232
- name: UI Checks
3333
run: make lint-ui
34+
- name: Set up Python and venv for docs
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.11'
38+
- name: Create venv and install MkDocs requirements
39+
run: |
40+
python3 -m venv .venv
41+
. .venv/bin/activate
42+
pip install -r docs/requirements.txt
43+
- name: Lint Docs
44+
run: . .venv/bin/activate && make lint-docs
3445
- name: Get dependencies
3546
run: go mod download
3647
- name: Restore build output from cache

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ yarn-error.log*
8383

8484
# Built UI static files
8585
ui/web/static/
86+
87+
# MkDocs build output
88+
mkdocs-lint.log
89+
# MkDocs build site directory
90+
site/

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,15 @@ $(GORELEASER): $(LOCALBIN)
298298
serve-docs:
299299
$(CONTAINER_TOOL) run ${MKDOCS_RUN_ARGS} --rm -it -p 8000:8000 -v ${CURRENT_DIR}:/docs -w /docs --entrypoint "" ${MKDOCS_DOCKER_IMAGE} sh -c 'pip install mkdocs; pip install $$(mkdocs get-deps); mkdocs serve -a $$(ip route get 1 | awk '\''{print $$7}'\''):8000'
300300

301+
.PHONY: lint-docs
302+
lint-docs: ## Build docs and fail if there are warnings
303+
@mkdocs build 2>&1 | tee mkdocs-lint.log
304+
@if grep -q 'WARNING' mkdocs-lint.log; then \
305+
echo "MkDocs build produced warnings!"; \
306+
cat mkdocs-lint.log; \
307+
exit 1; \
308+
fi
309+
301310
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
302311
# $1 - target path with name of binary (ideally with version)
303312
# $2 - package url which can be installed

docs/commit-status-controllers/argocd.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@ based on Argo CD's concept of a healthy application. The controller listens for
55
Applications based on a common label on the Application resources managed by a particular
66
PromotionStrategy.
77

8-
!!! important
9-
Currently this controller only works with Argo CD Applications that are configured to use the [Source Hydrator](https://argo-cd.readthedocs.io/en/stable/user-guide/source-hydrator/).
8+
> [!IMPORTANT]
9+
> Currently this controller only works with Argo CD Applications that are configured to use the [Source Hydrator](https://argo-cd.readthedocs.io/en/stable/user-guide/source-hydrator/).
1010
11-
!!! important
12-
Currently the repo URL configured in the PromotionStrategy must be exactly the same as the repo URL configured in the Argo CD Application.
11+
> [!IMPORTANT]
12+
> Currently the repo URL configured in the PromotionStrategy must be exactly the same as the repo URL configured in the Argo CD Application.
1313
14-
!!! note
15-
16-
GitOps Promoter provides several opt-in Argo CD integrations that improve the user experience. Check out the
17-
[Argo CD Integrations](./argocd-integrations.md) page for more information.
14+
> [!NOTE]
15+
> GitOps Promoter provides several opt-in Argo CD integrations that improve the user experience. Check out the
16+
> [Argo CD Integrations](../argocd-integrations.md) page for more information.
1817
1918
## Example Configurations
2019

@@ -61,14 +60,14 @@ spec:
6160
### Commit Status URL Template
6261
To configure setting the url of a commit status, for example, a link to an Argo CD instance, set the `url.template` field. The template uses [Go templates](https://pkg.go.dev/text/template) syntax and most [Sprig](https://masterminds.github.io/sprig/) functions (excluding `env`, `expandenv` and `getHostByName`) are supported as well as an additional [`urlQueryEscape`](https://pkg.go.dev/net/url#QueryEscape) function for escaping url query parameters. The template receives `.Environment` and `.ArgoCDCommitStatus` variables.
6362

64-
!!! important
65-
The rendered URL must use a scheme of either 'http' or 'https'
63+
> [!IMPORTANT]
64+
> The rendered URL must use a scheme of either 'http' or 'https'
6665

6766
#### Template Variables
6867
The following variables are available in the template:
6968

7069
- `.Environment` - string holding the environment name (i.e. environment branch name) for the group of Applications the URL is being generated for.
71-
- `.ArgoCDCommitStatus` - holds the whole [CR](../../crd-specs#argocdcommitstatus) in its current state
70+
- `.ArgoCDCommitStatus` - holds the whole [CR](../crd-specs.md#argocdcommitstatus) in its current state
7271

7372
#### Template Options
7473
Template options can be configured for how missing variables are handled.
@@ -130,9 +129,7 @@ To enable multi-cluster support, you need to configure two components:
130129
- Create a secret with key `kubeconfig` containing a standard `~/.kube/config` file as its value and label `sigs.k8s.io/multicluster-runtime-kubeconfig: "true"`
131130
- The secret must be created in the same namespace where gitops-promoter runs
132131
- The controller uses the `current context` from the kubeconfig to determine which cluster to use
133-
134-
!!! note
135-
Remove any additional clusters from the `kubeconfig` as they will be ignored
132+
- Remove any additional clusters from the `kubeconfig` as they will be ignored
136133

137134
#### RBAC Configuration
138135
- Create a ClusterRole and binding in the external cluster for the service account associated with the kubeconfig

docs/getting-started.md

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,12 @@ During the creation the GitHub App, you will need to configure the following set
3636

3737
### Webhooks (Optional - but highly recommended)
3838

39-
!!! note "Configure your webhook ingress"
40-
41-
We do support configuration of a GitHub App webhook that triggers PR creation upon Push. However, we do not configure
42-
the ingress to allow GitHub to reach the GitOps Promoter. You will need to configure the ingress to allow GitHub to reach
43-
the GitOps Promoter via the service promoter-webhook-receiver which listens on port `3333`. If you do not use webhooks
44-
you might want to adjust the auto reconciliation interval to a lower value using these `promotionStrategyRequeueDuration` and
45-
`changeTransferPolicyRequeueDuration` fields of the `ControllerConfiguration` resource.
39+
> [!NOTE]
40+
> We do support configuration of a GitHub App webhook that triggers PR creation upon Push. However, we do not configure
41+
> the ingress to allow GitHub to reach the GitOps Promoter. You will need to configure the ingress to allow GitHub to reach
42+
> the GitOps Promoter via the service promoter-webhook-receiver which listens on port `3333`. If you do not use webhooks
43+
> you might want to adjust the auto reconciliation interval to a lower value using these `promotionStrategyRequeueDuration` and
44+
> `changeTransferPolicyRequeueDuration` fields of the `ControllerConfiguration` resource.
4645
4746
Webhook URL: `https://<your-promoter-webhook-receiver-ingress>/`
4847

@@ -87,9 +86,8 @@ stringData:
8786
githubAppPrivateKey: <your-private-key>
8887
```
8988
90-
!!! note
91-
92-
This Secret will need to be installed to the same namespace that you plan on creating PromotionStrategy resources in.
89+
> [!NOTE]
90+
> This Secret will need to be installed to the same namespace that you plan on creating PromotionStrategy resources in.
9391
9492
We also need a GitRepository and ScmProvider, which is are custom resources that represents a git repository and a provider.
9593
Here is an example of both resources:
@@ -118,10 +116,9 @@ spec:
118116
name: <your-scmprovider-name>
119117
```
120118
121-
!!! note
122-
123-
The GitRepository and ScmProvider also need to be installed to the same namespace that you plan on creating PromotionStrategy
124-
resources in, and it also needs to be in the same namespace of the secret it references.
119+
> [!NOTE]
120+
> The GitRepository and ScmProvider also need to be installed to the same namespace that you plan on creating PromotionStrategy
121+
> resources in, and it also needs to be in the same namespace of the secret it references.
125122
126123
## GitLab Configuration
127124
@@ -217,9 +214,8 @@ spec:
217214
name: <your-scmprovider-name> # The secret that contains the GitLab Access Token
218215
```
219216

220-
!!! note
221-
222-
The GitRepository and ScmProvider also need to be installed to the same namespace that you plan on creating PromotionStrategy resources in, and it also needs to be in the same namespace of the secret it references.
217+
> [!NOTE]
218+
> The GitRepository and ScmProvider also need to be installed to the same namespace that you plan on creating PromotionStrategy resources in, and it also needs to be in the same namespace of the secret it references.
223219

224220

225221
## Promotion Strategy
@@ -244,23 +240,20 @@ spec:
244240
name: <git-repository-ref-name> # The name of the GitRepository resource
245241
```
246242

247-
!!! important
248-
249-
Each `branch` configured here is the branch that GitOps Promoter will merge into. Your [hydrator](index.md#prerequisites)
250-
configuration must hydrate to these branch names, but **suffixed with `-next`**. This convention is hard-coded in
251-
GitOps Promoter.
252-
253-
For an example of how to configure the Argo CD Source Hydrator, see the [Argo CD tutorial](tutorial-argocd-apps.md#deploy-an-application-for-3-environments).
254-
(Note the difference between the `syncSource` and the `hydrateTo` fields.)
255-
256-
!!! note
257-
258-
Notice that the branches are prefixed with `environment/`. This is a convention that we recommend you follow.
243+
> [!IMPORTANT]
244+
> Each `branch` configured here is the branch that GitOps Promoter will merge into. Your [hydrator](index.md#prerequisites)
245+
> configuration must hydrate to these branch names, but **suffixed with `-next`**. This convention is hard-coded in
246+
> GitOps Promoter.
247+
>
248+
> For an example of how to configure the Argo CD Source Hydrator, see the [Argo CD tutorial](tutorial-argocd-apps.md#deploy-an-application-for-3-environments).
249+
> (Note the difference between the `syncSource` and the `hydrateTo` fields.)
259250

260-
!!! note
251+
> [!NOTE]
252+
> Notice that the branches are prefixed with `environment/`. This is a convention that we recommend you follow.
261253

262-
The `autoMerge` field is optional and defaults to `true`. We set it to `false` here because we do not have any
263-
CommitStatus checks configured. With these all set to `false` we will have to manually merge the PRs.
254+
> [!NOTE]
255+
> The `autoMerge` field is optional and defaults to `true`. We set it to `false` here because we do not have any
256+
> CommitStatus checks configured. With these all set to `false` we will have to manually merge the PRs.
264257

265258
## Launching the UI
266259

docs/monitoring/metrics.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
GitOps Promoter produces metrics counter and histogram metrics for all network-bound operations.
44

5-
!!!important "Metrics Subject to Change"
6-
7-
The metrics produced by GitOps Promoter are subject to change as the project evolves until the 1.0 release.
8-
Please refer to this document for the latest metrics.
5+
> [!IMPORTANT]
6+
> The metrics produced by GitOps Promoter are subject to change as the project evolves until the 1.0 release.
7+
> Please refer to this document for the latest metrics.
98
109
## git_operations_total
1110

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ mkdocs-material==9.5.42
55
mkdocs-material-extensions==1.3.1
66
pygments==2.18.0
77
mkdocs-redirects==1.2.2
8+
mkdocs-github-admonitions-plugin==0.1.1

docs/tutorial-argocd-apps.md

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,18 @@ To complete this tutorial, you will need the following:
1919
* [A GitHub Account](https://github.com/)
2020
* [Git](https://git-scm.com/)
2121

22-
!!! note
23-
24-
GitOps Promoter provides several opt-in Argo CD integrations that improve the user experience. Check out the
25-
[Argo CD Integrations](./argocd-integrations.md) page for more information.
22+
> [!NOTE]
23+
> GitOps Promoter provides several opt-in Argo CD integrations that improve the user experience. Check out the
24+
> [Argo CD Integrations](./argocd-integrations.md) page for more information.
2625
2726
## Set up the test cluster
2827

2928
### Create the cluster
3029

3130
If you don't have a test cluster yet, create one. With kind, simply run `kind create cluster`
3231

33-
!!! tip "Alternatively"
34-
35-
You can name the cluster with `kind create cluster --name promoter`
32+
> [!TIP]
33+
> You can name the cluster with `kind create cluster --name promoter`
3634
3735
Confirm that your access works with `kubectl get nodes`. Nodes should have a name starting with the name of your cluster (per example: `promoter-control-plane`)
3836

@@ -71,9 +69,8 @@ Connect with this password for the `admin` user.
7169
kubectl apply -f https://github.com/argoproj-labs/gitops-promoter/releases/download/v0.14.0/install.yaml
7270
```
7371

74-
!!! note
75-
76-
You may want to run the command twice to deploy the controller configuration after the CRDs were deployed.
72+
> [!NOTE]
73+
> You may want to run the command twice to deploy the controller configuration after the CRDs were deployed.
7774
7875
## Set up a sample repository
7976

@@ -110,17 +107,16 @@ However, we are running the workload locally and the webhook is not required for
110107

111108
If you want to set up the webhook, read [Getting started](./getting-started.md) and try to use [https://smee.io/](https://smee.io/).
112109

113-
!!! tip "Alternatively"
114-
115-
You can adjust the setting down to something like 15 or 30 seconds.
116-
117-
See the [default config](https://github.com/argoproj-labs/gitops-promoter/blob/65d5905c51acac5d1caf3af01ceb0747795207e5/config/config/controllerconfiguration.yaml#L14-L17) for the config location.
118-
119-
```shell
120-
kubectl patch -n promoter-system controllerconfiguration promoter-controller-configuration \
121-
--type merge \
122-
-p '{"spec": {"promotionStrategyRequeueDuration": "30s", "changeTransferPolicyRequeueDuration": "30s", "argocdCommitStatusRequeueDuration": "30s", "pullRequestRequeueDuration": "30s"}}'
123-
```
110+
> [!TIP]
111+
> You can adjust the setting down to something like 15 or 30 seconds.
112+
>
113+
> See the [default config](https://github.com/argoproj-labs/gitops-promoter/blob/65d5905c51acac5d1caf3af01ceb0747795207e5/config/config/controllerconfiguration.yaml#L14-L17) for the config location.
114+
>
115+
> ```shell
116+
> kubectl patch -n promoter-system controllerconfiguration promoter-controller-configuration \
117+
> --type merge \
118+
> -p '{"spec": {"promotionStrategyRequeueDuration": "30s", "changeTransferPolicyRequeueDuration": "30s", "argocdCommitStatusRequeueDuration": "30s", "pullRequestRequeueDuration": "30s"}}'
119+
> ```
124120
125121
#### Generate a key
126122
@@ -216,10 +212,9 @@ If you go to the Argo CD UI, in the applications, you should now see the "SOURCE
216212
217213
It should have the message "from HEAD (...) to environment/development-next (...)"
218214
219-
!!! important
220-
221-
The Application will have an error under "APP CONDITIONS" that "app path does not exist." That's because the
222-
Promoter has not yet moved the hydrated manifests to the syncSource branches. That's the next step.
215+
> [!IMPORTANT]
216+
> The Application will have an error under "APP CONDITIONS" that "app path does not exist." That's because the
217+
> Promoter has not yet moved the hydrated manifests to the syncSource branches. That's the next step.
223218
224219
This means three things in case of a change in the main branch:
225220
@@ -322,16 +317,14 @@ Here, we implement a simple strategy:
322317
2. Auto-merge on staging (if development is successful)
323318
3. Manual merge on production
324319
325-
!!! note
326-
327-
You should see 2 PRs getting merged automatically and 1 PR to merge manually for the production. That is normal: we branched from the main branch wich is DRY. The promoter detects change and do what's needed to sync the two branches.
320+
> [!NOTE]
321+
> You should see 2 PRs getting merged automatically and 1 PR to merge manually for the production. That is normal: we branched from the main branch wich is DRY. The promoter detects change and do what's needed to sync the two branches.
328322
329323
## Play with your environment
330324
331325
We deployed the application "helm-guestbook" from the example repository.
332326
333327
Try editing the main branch: number of replicas, helm templates... And see the PRs getting promoted from development to staging, then wait for your approval for the prod.
334328
335-
!!! note
336-
337-
Since we are not using the webhook. It can takes 5 to 15 minutes to complete the cycle unless you've set the requeue duration to a lower value.
329+
> [!NOTE]
330+
> Since we are not using the webhook. It can takes 5 to 15 minutes to complete the cycle unless you've set the requeue duration to a lower value.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ nav:
4242
- Argo CD Apps: tutorial-argocd-apps.md
4343
- Argo CD Integrations: argocd-integrations.md
4444
plugins:
45+
- gh-admonitions
4546
- redirects:
4647
redirect_maps:
4748
'metrics.md': 'monitoring/metrics.md' # Page was moved to a subdirectory.

0 commit comments

Comments
 (0)