saltext.noderings 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. saltext_noderings-0.1.0/.copier-answers.yml +32 -0
  2. saltext_noderings-0.1.0/.coveragerc +44 -0
  3. saltext_noderings-0.1.0/.envrc.example +7 -0
  4. saltext_noderings-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +17 -0
  5. saltext_noderings-0.1.0/.github/ISSUE_TEMPLATE/config.yml +8 -0
  6. saltext_noderings-0.1.0/.github/ISSUE_TEMPLATE/docs.md +23 -0
  7. saltext_noderings-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +11 -0
  8. saltext_noderings-0.1.0/.github/ISSUE_TEMPLATE/tech-debt.md +13 -0
  9. saltext_noderings-0.1.0/.github/dependabot.yml +31 -0
  10. saltext_noderings-0.1.0/.github/pull_request_template.md +11 -0
  11. saltext_noderings-0.1.0/.github/self-hosted-runner.md +135 -0
  12. saltext_noderings-0.1.0/.github/workflows/ci.yml +171 -0
  13. saltext_noderings-0.1.0/.github/workflows/docs.yml +54 -0
  14. saltext_noderings-0.1.0/.github/workflows/release-please.yml +56 -0
  15. saltext_noderings-0.1.0/.github/workflows/release.yml +128 -0
  16. saltext_noderings-0.1.0/.gitignore +139 -0
  17. saltext_noderings-0.1.0/.pre-commit-config.yaml +146 -0
  18. saltext_noderings-0.1.0/.pre-commit-hooks/check-cli-examples.py +64 -0
  19. saltext_noderings-0.1.0/.pre-commit-hooks/make-autodocs.py +123 -0
  20. saltext_noderings-0.1.0/.pylintrc +680 -0
  21. saltext_noderings-0.1.0/.release-please-manifest.json +1 -0
  22. saltext_noderings-0.1.0/CHANGELOG.md +12 -0
  23. saltext_noderings-0.1.0/CODE-OF-CONDUCT.md +127 -0
  24. saltext_noderings-0.1.0/CODE_OF_CONDUCT.md +4 -0
  25. saltext_noderings-0.1.0/CONTRIBUTING.md +89 -0
  26. saltext_noderings-0.1.0/LICENSE +201 -0
  27. saltext_noderings-0.1.0/Makefile +58 -0
  28. saltext_noderings-0.1.0/NOTICE +10 -0
  29. saltext_noderings-0.1.0/PKG-INFO +198 -0
  30. saltext_noderings-0.1.0/README.md +140 -0
  31. saltext_noderings-0.1.0/SECURITY.md +19 -0
  32. saltext_noderings-0.1.0/changelog/.gitkeep +0 -0
  33. saltext_noderings-0.1.0/changelog/.template.jinja +15 -0
  34. saltext_noderings-0.1.0/docs/Makefile +20 -0
  35. saltext_noderings-0.1.0/docs/_ext/saltdomain.py +18 -0
  36. saltext_noderings-0.1.0/docs/_static/.gitkeep +0 -0
  37. saltext_noderings-0.1.0/docs/changelog.md +12 -0
  38. saltext_noderings-0.1.0/docs/conf.py +194 -0
  39. saltext_noderings-0.1.0/docs/index.rst +31 -0
  40. saltext_noderings-0.1.0/docs/make.bat +35 -0
  41. saltext_noderings-0.1.0/docs/ref/.gitkeep +0 -0
  42. saltext_noderings-0.1.0/docs/ref/clouds/index.rst +12 -0
  43. saltext_noderings-0.1.0/docs/ref/clouds/saltext.noderings.clouds.noderings_mod.rst +5 -0
  44. saltext_noderings-0.1.0/docs/ref/modules/index.rst +12 -0
  45. saltext_noderings-0.1.0/docs/ref/modules/saltext.noderings.modules.noderings_mod.rst +5 -0
  46. saltext_noderings-0.1.0/docs/ref/states/index.rst +12 -0
  47. saltext_noderings-0.1.0/docs/ref/states/saltext.noderings.states.noderings_mod.rst +5 -0
  48. saltext_noderings-0.1.0/docs/ref/utils/index.rst +16 -0
  49. saltext_noderings-0.1.0/docs/ref/utils/saltext.noderings.utils.client.rst +5 -0
  50. saltext_noderings-0.1.0/docs/ref/utils/saltext.noderings.utils.compute.rst +5 -0
  51. saltext_noderings-0.1.0/docs/ref/utils/saltext.noderings.utils.dns.rst +5 -0
  52. saltext_noderings-0.1.0/docs/ref/utils/saltext.noderings.utils.firewall.rst +5 -0
  53. saltext_noderings-0.1.0/docs/ref/utils/saltext.noderings.utils.marketplace.rst +5 -0
  54. saltext_noderings-0.1.0/docs/sitevars.rst +0 -0
  55. saltext_noderings-0.1.0/docs/topics/cloud.md +62 -0
  56. saltext_noderings-0.1.0/docs/topics/configuration.md +44 -0
  57. saltext_noderings-0.1.0/docs/topics/design.md +60 -0
  58. saltext_noderings-0.1.0/docs/topics/installation.md +24 -0
  59. saltext_noderings-0.1.0/docs/topics/states.md +61 -0
  60. saltext_noderings-0.1.0/noxfile.py +530 -0
  61. saltext_noderings-0.1.0/pyproject.toml +203 -0
  62. saltext_noderings-0.1.0/pytest.ini +7 -0
  63. saltext_noderings-0.1.0/release-please-config.json +30 -0
  64. saltext_noderings-0.1.0/setup.cfg +4 -0
  65. saltext_noderings-0.1.0/setup.py +5 -0
  66. saltext_noderings-0.1.0/src/saltext/noderings/__init__.py +28 -0
  67. saltext_noderings-0.1.0/src/saltext/noderings/clouds/__init__.py +0 -0
  68. saltext_noderings-0.1.0/src/saltext/noderings/clouds/noderings_mod.py +457 -0
  69. saltext_noderings-0.1.0/src/saltext/noderings/modules/__init__.py +0 -0
  70. saltext_noderings-0.1.0/src/saltext/noderings/modules/noderings_mod.py +996 -0
  71. saltext_noderings-0.1.0/src/saltext/noderings/states/__init__.py +0 -0
  72. saltext_noderings-0.1.0/src/saltext/noderings/states/noderings_mod.py +562 -0
  73. saltext_noderings-0.1.0/src/saltext/noderings/utils/__init__.py +0 -0
  74. saltext_noderings-0.1.0/src/saltext/noderings/utils/client.py +593 -0
  75. saltext_noderings-0.1.0/src/saltext/noderings/utils/compute.py +392 -0
  76. saltext_noderings-0.1.0/src/saltext/noderings/utils/dns.py +162 -0
  77. saltext_noderings-0.1.0/src/saltext/noderings/utils/firewall.py +323 -0
  78. saltext_noderings-0.1.0/src/saltext/noderings/utils/marketplace.py +182 -0
  79. saltext_noderings-0.1.0/src/saltext/noderings/version.py +1 -0
  80. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/PKG-INFO +198 -0
  81. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/SOURCES.txt +121 -0
  82. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/dependency_links.txt +1 -0
  83. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/entry_points.txt +2 -0
  84. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/not-zip-safe +1 -0
  85. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/requires.txt +35 -0
  86. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/scm_file_list.json +115 -0
  87. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/scm_version.json +8 -0
  88. saltext_noderings-0.1.0/src/saltext.noderings.egg-info/top_level.txt +1 -0
  89. saltext_noderings-0.1.0/tests/__init__.py +0 -0
  90. saltext_noderings-0.1.0/tests/conftest.py +55 -0
  91. saltext_noderings-0.1.0/tests/functional/__init__.py +0 -0
  92. saltext_noderings-0.1.0/tests/functional/clouds/__init__.py +0 -0
  93. saltext_noderings-0.1.0/tests/functional/conftest.py +150 -0
  94. saltext_noderings-0.1.0/tests/functional/modules/__init__.py +0 -0
  95. saltext_noderings-0.1.0/tests/functional/modules/test_noderings_live.py +126 -0
  96. saltext_noderings-0.1.0/tests/functional/states/__init__.py +0 -0
  97. saltext_noderings-0.1.0/tests/functional/states/test_noderings_live.py +108 -0
  98. saltext_noderings-0.1.0/tests/integration/__init__.py +0 -0
  99. saltext_noderings-0.1.0/tests/integration/test_cloud_live.py +121 -0
  100. saltext_noderings-0.1.0/tests/live.py +35 -0
  101. saltext_noderings-0.1.0/tests/unit/__init__.py +0 -0
  102. saltext_noderings-0.1.0/tests/unit/clouds/__init__.py +0 -0
  103. saltext_noderings-0.1.0/tests/unit/clouds/test_noderings.py +108 -0
  104. saltext_noderings-0.1.0/tests/unit/conftest.py +54 -0
  105. saltext_noderings-0.1.0/tests/unit/fakeapi.py +336 -0
  106. saltext_noderings-0.1.0/tests/unit/modules/__init__.py +0 -0
  107. saltext_noderings-0.1.0/tests/unit/modules/test_noderings.py +158 -0
  108. saltext_noderings-0.1.0/tests/unit/states/__init__.py +0 -0
  109. saltext_noderings-0.1.0/tests/unit/states/test_noderings.py +116 -0
  110. saltext_noderings-0.1.0/tests/unit/utils/__init__.py +0 -0
  111. saltext_noderings-0.1.0/tests/unit/utils/test_client.py +168 -0
  112. saltext_noderings-0.1.0/tests/unit/utils/test_dns.py +30 -0
  113. saltext_noderings-0.1.0/tests/unit/utils/test_firewall.py +87 -0
  114. saltext_noderings-0.1.0/tests/unit/utils/test_marketplace.py +61 -0
  115. saltext_noderings-0.1.0/tools/helpers/__init__.py +0 -0
  116. saltext_noderings-0.1.0/tools/helpers/cmd.py +297 -0
  117. saltext_noderings-0.1.0/tools/helpers/copier.py +114 -0
  118. saltext_noderings-0.1.0/tools/helpers/git.py +30 -0
  119. saltext_noderings-0.1.0/tools/helpers/pre_commit.py +115 -0
  120. saltext_noderings-0.1.0/tools/helpers/prompt.py +54 -0
  121. saltext_noderings-0.1.0/tools/helpers/venv.py +128 -0
  122. saltext_noderings-0.1.0/tools/initialize.py +26 -0
  123. saltext_noderings-0.1.0/tools/version.py +92 -0
@@ -0,0 +1,32 @@
1
+ # Autogenerated. Do not edit this by hand, use `copier update`.
2
+ ---
3
+ _commit: 0.10.0
4
+ _src_path: gh:salt-extensions/salt-extension-copier
5
+ author: NodeRings
6
+ author_email: partners@noderings.com
7
+ coc_contact: partners@noderings.com
8
+ copyright_begin: 2026
9
+ deploy_docs: rolling
10
+ docs_url: https://noderings.github.io/saltext-noderings/
11
+ integration_name: NodeRings
12
+ license: apache
13
+ loaders:
14
+ - cloud
15
+ - module
16
+ - state
17
+ max_salt_version: '3008'
18
+ no_saltext_namespace: false
19
+ os_support:
20
+ - Linux
21
+ package_name: noderings
22
+ project_name: noderings
23
+ python_requires: '3.11'
24
+ relax_pylint: false
25
+ salt_version: '3006'
26
+ source_url: https://github.com/noderings/saltext-noderings
27
+ ssh_fixtures: false
28
+ summary: Salt Extension for ordering servers and managing DNS, firewalls and SSH keys
29
+ on the NodeRings cloud marketplace
30
+ test_containers: false
31
+ tracker_url: https://github.com/noderings/saltext-noderings/issues
32
+ url: https://github.com/noderings/saltext-noderings
@@ -0,0 +1,44 @@
1
+ [run]
2
+ branch = True
3
+ cover_pylib = False
4
+ relative_files = True
5
+ parallel = True
6
+ concurrency = multiprocessing
7
+
8
+ omit =
9
+ .nox/*
10
+ setup.py
11
+
12
+ [report]
13
+ # Regexes for lines to exclude from consideration
14
+ exclude_also =
15
+ # Don't complain about missing debug-only code:
16
+ def __repr__
17
+
18
+ # Don't complain if tests don't hit defensive assertion code:
19
+ raise AssertionError
20
+ raise NotImplementedError
21
+
22
+ # Don't complain if non-runnable code isn't run:
23
+ if 0:
24
+ if False:
25
+ if __name__ == .__main__.:
26
+ if TYPE_CHECKING:
27
+ @(abc\.)?abstractmethod
28
+
29
+ # Add markers which exclude statements in between.
30
+ # Requires coverage>=7.6.0.
31
+ no cover: start(?s:.)*?no cover: stop
32
+
33
+ omit =
34
+ .nox/*
35
+ setup.py
36
+
37
+ ignore_errors = True
38
+
39
+ [paths]
40
+ source =
41
+ saltext/noderings
42
+ src/saltext/noderings
43
+ testsuite =
44
+ tests/
@@ -0,0 +1,7 @@
1
+ layout_saltext() {
2
+ VIRTUAL_ENV="$(python3 tools/initialize.py --print-venv)"
3
+ PATH_add "$VIRTUAL_ENV/bin"
4
+ export VIRTUAL_ENV
5
+ }
6
+
7
+ layout_saltext
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: Bug report
3
+ about: Something in the NodeRings Salt extension does not work
4
+ labels: bug
5
+ ---
6
+
7
+ **What happened**
8
+
9
+ **What you expected**
10
+
11
+ **How to reproduce** (the state or command, without tokens)
12
+
13
+ **Versions**
14
+ - `salt --versions-report` (Salt and Python):
15
+ - `pip show saltext.noderings`:
16
+
17
+ **Output** (`salt-call -l debug ...`, with tokens removed)
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: true
2
+ contact_links:
3
+ - name: Security issue
4
+ url: https://github.com/noderings/saltext-noderings/security/policy
5
+ about: Report security problems privately, not in a public issue.
6
+ - name: NodeRings support
7
+ url: https://noderings.com
8
+ about: Questions about your account, billing or a server go to NodeRings support.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Docs
3
+ about: Issue related to Salt Documentation
4
+ title: "[DOCS]"
5
+ labels: documentation, needs-triage
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Description**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Suggested Fix**
14
+ What did you expect to see in the documentation that is missing or needs updating?
15
+
16
+ **Type of documentation**
17
+ This could be module documentation or a guide.
18
+
19
+ **Location or format of documentation**
20
+ Insert page URL if applicable.
21
+
22
+ **Additional context**
23
+ Add any other context or screenshots here.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest a new resource, option or improvement
4
+ labels: enhancement
5
+ ---
6
+
7
+ **What you want to do**
8
+
9
+ **How you would like it to work**
10
+
11
+ **Anything else** (links to the NodeRings API, other providers that do it, ...)
@@ -0,0 +1,13 @@
1
+ ---
2
+ name: Tech Debt
3
+ about: Issue is related to tech debt. This includes compatibility changes for newer versions of software and OSes that salt interacts with.
4
+ title: "[TECH DEBT]"
5
+ labels: tech-debt
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ### Description of the tech debt to be addressed, include links and screenshots
11
+
12
+ ### Versions Report
13
+ (Provided by running `salt --versions-report`. Please also mention any differences in master/minion versions.)
@@ -0,0 +1,31 @@
1
+ # Commit messages use Conventional Commits so release-please can sort them.
2
+ # Both groups only touch CI and development tools, so they stay out of the
3
+ # changelog ("ci" and "build" are hidden sections).
4
+ version: 2
5
+ updates:
6
+ - package-ecosystem: "github-actions"
7
+ directory: "/"
8
+ schedule:
9
+ interval: "weekly"
10
+ day: "monday"
11
+ time: "09:00"
12
+ timezone: "Etc/UTC"
13
+ commit-message:
14
+ prefix: "ci"
15
+ groups:
16
+ "github-actions":
17
+ patterns:
18
+ - "*"
19
+ - package-ecosystem: "pip"
20
+ directory: "/"
21
+ schedule:
22
+ interval: "weekly"
23
+ day: "monday"
24
+ time: "09:00"
25
+ timezone: "Etc/UTC"
26
+ commit-message:
27
+ prefix: "build"
28
+ groups:
29
+ "pip":
30
+ patterns:
31
+ - "*"
@@ -0,0 +1,11 @@
1
+ #### What this changes
2
+
3
+ #### Why
4
+
5
+ #### How it was tested
6
+
7
+ - [ ] Unit tests and linters pass locally
8
+ - [ ] Live test against the NodeRings API, if the change touches API calls
9
+ - [ ] `CHANGELOG.md` updated, if users will notice the change
10
+
11
+ Fixes #
@@ -0,0 +1,135 @@
1
+ # Running CI on a NodeRings self-hosted runner
2
+
3
+ CI runs on GitHub-hosted runners by default. It moves to our own runner when
4
+ both of these are true:
5
+
6
+ 1. A runner with the labels `self-hosted` and `noderings` is online.
7
+ 2. The repository variable `NODERINGS_RUNNER` is `true`.
8
+
9
+ Clear the variable (or set it to anything else) to go back to GitHub-hosted
10
+ runners at once, for example while the runner is down.
11
+
12
+ These always stay on GitHub-hosted runners, whatever the variable says:
13
+
14
+ - pull requests from forks (their code is untrusted)
15
+ - the `CI result` summary job
16
+ - building and publishing releases (`release.yml`)
17
+ - the GitHub Pages deploy job
18
+
19
+ ## Recommended setup: one dedicated NodeRings VM, repository-level runner
20
+
21
+ Use a small Ubuntu 24.04 (x64) virtual machine ordered on NodeRings, used for
22
+ nothing else, with the GitHub Actions runner installed as a service.
23
+
24
+ Why this option:
25
+
26
+ - **A dedicated VM, not the production Kubernetes cluster.** CI runs code from
27
+ pull requests. Keep it away from production workloads, cluster credentials
28
+ and Argo CD. actions-runner-controller on the prod cluster would put CI
29
+ pods next to production.
30
+ - **The GitHub Actions runner, not Woodpecker or Forgejo.** The code, pull
31
+ requests and branch protection live on GitHub. The native runner reports
32
+ ordinary check runs, so branch protection, approvals and logs work
33
+ unchanged. Woodpecker or a Forgejo runner would need a separate CI server,
34
+ webhooks and mirroring for the same result.
35
+ - **Repository-level, not organization-level.** The noderings organization
36
+ is on the Free plan, which only has the Default runner group. An
37
+ organization runner there would serve every public repository in the
38
+ organization. A repository runner only takes jobs from this repository.
39
+ Register one per repository (one VM can host several runner services, each
40
+ in its own directory and user), or move to an organization runner group
41
+ limited to selected repositories once the organization is on a paid plan.
42
+
43
+ ### 1. Lock down fork pull requests first
44
+
45
+ GitHub warns that self-hosted runners on public repositories can run code
46
+ from anyone who can open a pull request. A fork can edit the workflow files in
47
+ its own pull request, so the `runs-on` guard in our workflows is not enough by
48
+ itself.
49
+
50
+ - Repository → Settings → Actions → General → *Approval for running fork pull
51
+ request workflows from contributors* → **Require approval for all external
52
+ contributors**. (This repository already has this setting.)
53
+ - Before approving a fork run, read every change under `.github/`. Never
54
+ approve a run that changes `runs-on` or adds `self-hosted`.
55
+ - Never use `pull_request_target` together with a checkout of the pull
56
+ request's code.
57
+
58
+ ### 2. Prepare the VM
59
+
60
+ As root on the new VM:
61
+
62
+ ```bash
63
+ apt-get update
64
+ apt-get install -y --no-install-recommends \
65
+ git curl ca-certificates jq make build-essential \
66
+ libenchant-2-2 python3-dev python3-venv
67
+ # An unprivileged user for the runner, without sudo.
68
+ useradd --create-home --shell /bin/bash runner
69
+ # Tool cache for actions/setup-python.
70
+ install -d -o runner -g runner /opt/hostedtoolcache
71
+ ```
72
+
73
+ Keep the VM patched (`unattended-upgrades`), open no inbound ports (the runner
74
+ only makes outbound HTTPS connections to GitHub), and do not store other
75
+ credentials on it.
76
+
77
+ ### 3. Register the runner
78
+
79
+ 1. Open <https://github.com/noderings/saltext-noderings/settings/actions/runners/new>
80
+ (Settings → Actions → Runners → **New self-hosted runner**), pick
81
+ **Linux** and **x64**. The page shows a registration token that is valid
82
+ for one hour. Use it only in the VM's shell. Do not paste it anywhere else.
83
+ 2. As the `runner` user on the VM:
84
+
85
+ ```bash
86
+ mkdir -p ~/actions-runner && cd ~/actions-runner
87
+ curl -fsSLO https://github.com/actions/runner/releases/download/v2.338.2/actions-runner-linux-x64-2.338.2.tar.gz
88
+ echo "baebf204307bac6193480852732f0aba2ae97b6c5597c244f4d5558390147c40 actions-runner-linux-x64-2.338.2.tar.gz" | sha256sum -c
89
+ tar xzf actions-runner-linux-x64-2.338.2.tar.gz
90
+ echo "AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache" >> .env
91
+ ./config.sh --unattended \
92
+ --url https://github.com/noderings/saltext-noderings \
93
+ --token <TOKEN FROM THE PAGE> \
94
+ --name noderings-ci-1 \
95
+ --labels noderings \
96
+ --work _work
97
+ ```
98
+
99
+ `self-hosted`, `Linux` and `X64` are added automatically. `noderings` is
100
+ the label the workflows ask for.
101
+ 3. Back as root, install and start the service:
102
+
103
+ ```bash
104
+ cd /home/runner/actions-runner
105
+ ./svc.sh install runner
106
+ ./svc.sh start
107
+ ```
108
+
109
+ 4. The runner should now show as **Idle** on
110
+ <https://github.com/noderings/saltext-noderings/settings/actions/runners>.
111
+
112
+ ### 4. Switch CI over
113
+
114
+ Repository → Settings → Secrets and variables → Actions → **Variables** →
115
+ New repository variable: `NODERINGS_RUNNER` = `true`.
116
+ Then re-run CI on `main` (Actions → CI → Run workflow) and check that the jobs
117
+ show the runner name `noderings-ci-1`.
118
+
119
+ To switch back, delete the variable or set it to `false`.
120
+
121
+ ### Optional: live API tests
122
+
123
+ Live tests run only when the repository secret `NODERINGS_TOKEN` exists. It
124
+ should be a service account token for a separate test organization with a
125
+ small credit balance. Fork pull requests never get secrets. Tests that order
126
+ billed servers only run from a manual CI run with *billed* ticked.
127
+
128
+ ### Later: ephemeral runners
129
+
130
+ A persistent runner keeps its work directory between jobs. Our workflows clean
131
+ up after themselves and only trusted code reaches the runner, so this is
132
+ acceptable to start with. To give every job a fresh machine, register with
133
+ `--ephemeral`, then re-register after each job. This needs a GitHub App with
134
+ the *Administration: write* repository permission so the VM can request
135
+ registration tokens itself.
@@ -0,0 +1,171 @@
1
+ name: CI
2
+
3
+ # Runs on GitHub-hosted runners until a NodeRings self-hosted runner exists.
4
+ # To switch, register a runner with the labels "self-hosted" and "noderings"
5
+ # (see .github/self-hosted-runner.md) and set the repository variable
6
+ # NODERINGS_RUNNER=true. Pull requests from forks always stay on
7
+ # GitHub-hosted runners: never run untrusted code on our own machines.
8
+ "on":
9
+ push:
10
+ branches: [main]
11
+ pull_request:
12
+ workflow_dispatch:
13
+ inputs:
14
+ billed:
15
+ description: Also run tests that order billed servers
16
+ type: boolean
17
+ default: false
18
+
19
+ permissions:
20
+ contents: read
21
+
22
+ concurrency:
23
+ group: ci-${{ github.ref }}
24
+ cancel-in-progress: true
25
+
26
+ env:
27
+ PIP_DISABLE_PIP_VERSION_CHECK: "1"
28
+ FORCE_COLOR: "1"
29
+
30
+ jobs:
31
+ pre-commit:
32
+ name: Pre-commit
33
+ runs-on: ${{ (vars.NODERINGS_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","noderings"]') || 'ubuntu-latest' }}
34
+ timeout-minutes: 30
35
+ steps:
36
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
37
+ with:
38
+ fetch-depth: 0
39
+ persist-credentials: false
40
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
41
+ with:
42
+ python-version: "3.12"
43
+ - run: python -m pip install pre-commit nox uv
44
+ - name: Run all hooks (format, docs stubs, bandit, pylint, actionlint)
45
+ run: pre-commit run --all-files --show-diff-on-failure --color=always
46
+
47
+ unit:
48
+ name: Unit (Salt ${{ matrix.salt }}, Python ${{ matrix.python }})
49
+ runs-on: ${{ (vars.NODERINGS_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","noderings"]') || 'ubuntu-latest' }}
50
+ timeout-minutes: 20
51
+ strategy:
52
+ fail-fast: false
53
+ matrix:
54
+ include:
55
+ - {salt: "3006", python: "3.11"}
56
+ - {salt: "3007", python: "3.12"}
57
+ - {salt: "3008", python: "3.12"}
58
+ - {salt: "3008", python: "3.13"}
59
+ steps:
60
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
61
+ with:
62
+ fetch-depth: 0
63
+ persist-credentials: false
64
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
65
+ with:
66
+ python-version: ${{ matrix.python }}
67
+ - run: python -m pip install nox uv
68
+ - name: Unit tests (nox session from the copier template)
69
+ env:
70
+ SALT_REQUIREMENT: salt~=${{ matrix.salt }}.0
71
+ run: nox -e "tests-${{ matrix.python }}" -- tests/unit
72
+
73
+ docs:
74
+ name: Docs
75
+ runs-on: ${{ (vars.NODERINGS_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","noderings"]') || 'ubuntu-latest' }}
76
+ timeout-minutes: 20
77
+ steps:
78
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
79
+ with:
80
+ fetch-depth: 0
81
+ persist-credentials: false
82
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
83
+ with:
84
+ python-version: "3.12"
85
+ - name: Check system packages (make, enchant for the spelling extension)
86
+ run: |
87
+ missing=()
88
+ command -v make >/dev/null || missing+=(make)
89
+ ldconfig -p | grep -q libenchant-2 || missing+=(libenchant-2-2)
90
+ if [ "${#missing[@]}" -gt 0 ]; then
91
+ sudo apt-get update -qq && sudo apt-get install -y -qq "${missing[@]}"
92
+ fi
93
+ - run: python -m pip install nox uv
94
+ - name: Build the docs (linkcheck, coverage, HTML; warnings fail)
95
+ run: nox -e docs
96
+
97
+ package:
98
+ name: Package
99
+ runs-on: ${{ (vars.NODERINGS_RUNNER == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)) && fromJSON('["self-hosted","noderings"]') || 'ubuntu-latest' }}
100
+ timeout-minutes: 15
101
+ steps:
102
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
103
+ with:
104
+ fetch-depth: 0
105
+ persist-credentials: false
106
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
107
+ with:
108
+ python-version: "3.12"
109
+ - run: python -m pip install build twine
110
+ - run: python -m build
111
+ - run: python -m twine check --strict dist/*
112
+ - name: Install the wheel and check that Salt loads the extension
113
+ run: |
114
+ python -m venv /tmp/wheel-venv
115
+ /tmp/wheel-venv/bin/pip install -q dist/*.whl
116
+ /tmp/wheel-venv/bin/python - <<'PY'
117
+ from importlib.metadata import entry_points
118
+ eps = [ep for ep in entry_points(group="salt.loader") if ep.name == "saltext.noderings"]
119
+ assert eps and eps[0].value == "saltext.noderings", eps
120
+ import saltext.noderings.clouds.noderings_mod
121
+ import saltext.noderings.modules.noderings_mod
122
+ import saltext.noderings.states.noderings_mod
123
+ print("entry point and modules OK")
124
+ PY
125
+ mkdir -p /tmp/salt-root
126
+ printf 'root_dir: /tmp/salt-root\nfile_client: local\nuser: %s\n' "$(id -un)" > /tmp/salt-root/minion
127
+ /tmp/wheel-venv/bin/salt-call -c /tmp/salt-root --local --out=json sys.list_functions noderings | grep -q '"noderings.list_regions"'
128
+ /tmp/wheel-venv/bin/salt-call -c /tmp/salt-root --local --out=json sys.list_state_functions noderings | grep -q '"noderings.vm_present"'
129
+
130
+ live:
131
+ name: Live tests (NodeRings API)
132
+ needs: [unit]
133
+ # Only where the secret exists; forks and outside pull requests skip.
134
+ if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
135
+ runs-on: ${{ vars.NODERINGS_RUNNER == 'true' && fromJSON('["self-hosted","noderings"]') || 'ubuntu-latest' }}
136
+ timeout-minutes: 45
137
+ env:
138
+ NODERINGS_TOKEN: ${{ secrets.NODERINGS_TOKEN }}
139
+ NODERINGS_TEST_BILLED: ${{ inputs.billed && '1' || '' }}
140
+ steps:
141
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
142
+ with:
143
+ fetch-depth: 0
144
+ persist-credentials: false
145
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
146
+ with:
147
+ python-version: "3.12"
148
+ - run: python -m pip install "salt~=3008.0" -e ".[tests]"
149
+ - name: Functional and integration tests
150
+ if: env.NODERINGS_TOKEN != ''
151
+ run: pytest -ra tests/functional tests/integration
152
+ - name: Note the skip
153
+ if: env.NODERINGS_TOKEN == ''
154
+ run: echo "::notice title=Live tests skipped::Add the repository secret NODERINGS_TOKEN (a service account token for a test organization) to run them."
155
+
156
+ result:
157
+ name: CI result
158
+ # The one required status check: it fails if any job above failed.
159
+ if: always()
160
+ needs: [pre-commit, unit, docs, package, live]
161
+ runs-on: ubuntu-latest
162
+ timeout-minutes: 5
163
+ steps:
164
+ - name: Check the job results
165
+ env:
166
+ RESULTS: ${{ join(needs.*.result, ' ') }}
167
+ run: |
168
+ echo "Job results: $RESULTS"
169
+ for r in $RESULTS; do
170
+ case "$r" in success|skipped) ;; *) exit 1 ;; esac
171
+ done
@@ -0,0 +1,54 @@
1
+ # Publishes the documentation to GitHub Pages on every push to main
2
+ # (copier answer deploy_docs: rolling).
3
+ # One-time setup: Settings, Pages, Source "GitHub Actions" (done).
4
+ name: Docs
5
+
6
+ "on":
7
+ push:
8
+ branches: [main]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ concurrency:
15
+ group: pages
16
+ cancel-in-progress: true
17
+
18
+ jobs:
19
+ build:
20
+ name: Build docs
21
+ runs-on: ${{ vars.NODERINGS_RUNNER == 'true' && fromJSON('["self-hosted","noderings"]') || 'ubuntu-latest' }}
22
+ timeout-minutes: 20
23
+ steps:
24
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
25
+ with:
26
+ fetch-depth: 0
27
+ persist-credentials: false
28
+ - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
29
+ with:
30
+ python-version: "3.12"
31
+ - name: Check system packages (enchant for the spelling extension)
32
+ run: ldconfig -p | grep -q libenchant-2 || { sudo apt-get update -qq && sudo apt-get install -y -qq libenchant-2-2; }
33
+ - run: python -m pip install -e ".[docs]"
34
+ - name: Build the HTML docs
35
+ working-directory: docs
36
+ run: sphinx-build -W -b html . _build/html
37
+ - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
38
+ with:
39
+ path: docs/_build/html
40
+
41
+ deploy:
42
+ name: Deploy to GitHub Pages
43
+ needs: build
44
+ runs-on: ubuntu-latest
45
+ timeout-minutes: 10
46
+ permissions:
47
+ pages: write
48
+ id-token: write
49
+ environment:
50
+ name: github-pages
51
+ url: ${{ steps.deployment.outputs.page_url }}
52
+ steps:
53
+ - id: deployment
54
+ uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
@@ -0,0 +1,56 @@
1
+ name: release-please
2
+
3
+ # Keeps one open release pull request that collects the Conventional Commits
4
+ # merged since the last release into CHANGELOG.md and picks the next version.
5
+ # Merging it pushes the vX.Y.Z tag and a draft GitHub release; the tag starts
6
+ # release.yml, which builds the package (setuptools_scm reads the version from
7
+ # the tag), publishes it to PyPI and then publishes the GitHub release.
8
+ #
9
+ # Needs the organization's release bot GitHub App, because tags and pull
10
+ # requests made with the workflow's own GITHUB_TOKEN do not start other
11
+ # workflows:
12
+ # variable RELEASE_BOT_APP_ID (or RELEASE_BOT_CLIENT_ID) and
13
+ # secret RELEASE_BOT_PRIVATE_KEY.
14
+ "on":
15
+ push:
16
+ branches: [main]
17
+ workflow_dispatch:
18
+
19
+ permissions:
20
+ contents: read
21
+
22
+ concurrency:
23
+ group: release-please
24
+ cancel-in-progress: false
25
+
26
+ jobs:
27
+ release-please:
28
+ runs-on: ubuntu-latest
29
+ timeout-minutes: 10
30
+ steps:
31
+ - name: Check the release bot is set up
32
+ id: bot
33
+ env:
34
+ APP_ID: ${{ vars.RELEASE_BOT_APP_ID }}
35
+ CLIENT_ID: ${{ vars.RELEASE_BOT_CLIENT_ID }}
36
+ HAS_KEY: ${{ secrets.RELEASE_BOT_PRIVATE_KEY != '' }}
37
+ run: |
38
+ if { [ -n "${APP_ID}" ] || [ -n "${CLIENT_ID}" ]; } && [ "${HAS_KEY}" = "true" ]; then
39
+ echo "ready=true" >> "$GITHUB_OUTPUT"
40
+ else
41
+ echo "::warning title=release-please skipped::Set the variable RELEASE_BOT_APP_ID and secret RELEASE_BOT_PRIVATE_KEY (see CONTRIBUTING.md, Releasing)."
42
+ echo "ready=false" >> "$GITHUB_OUTPUT"
43
+ fi
44
+ - uses: actions/create-github-app-token@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
45
+ if: steps.bot.outputs.ready == 'true'
46
+ id: app
47
+ with:
48
+ # GitHub accepts either the App ID or the Client ID here.
49
+ client-id: ${{ vars.RELEASE_BOT_CLIENT_ID || vars.RELEASE_BOT_APP_ID }}
50
+ private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
51
+ - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
52
+ if: steps.bot.outputs.ready == 'true'
53
+ with:
54
+ token: ${{ steps.app.outputs.token }}
55
+ config-file: release-please-config.json
56
+ manifest-file: .release-please-manifest.json