@7n/rules-ci-azure 1.2.0
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.
- package/CHANGELOG.md +15 -0
- package/package.json +48 -0
- package/rules/azure-pipelines/lint_pipeline/concern.json +10 -0
- package/rules/azure-pipelines/lint_pipeline/lint_pipeline.rego +37 -0
- package/rules/azure-pipelines/lint_pipeline/template/azure-pipelines-lint.yml.snippet.yml +3 -0
- package/rules/azure-pipelines/main.json +1 -0
- package/rules/azure-pipelines/main.mdc +78 -0
- package/rules/azure-pipelines/pipeline_common/concern.json +10 -0
- package/rules/azure-pipelines/pipeline_common/pipeline_common.rego +55 -0
- package/rules/azure-pipelines/pipeline_common/template/azure-pipelines.yml.snippet.yml +20 -0
- package/rules/azure-pipelines/vscode_extensions/concern.json +11 -0
- package/rules/azure-pipelines/vscode_extensions/template/extensions.json.snippet.json +1 -0
- package/rules/azure-pipelines/vscode_extensions/vscode_extensions.rego +18 -0
- package/rules/docker/lint_pipeline_docker/concern.json +10 -0
- package/rules/docker/lint_pipeline_docker/lint_pipeline_docker.mdc +13 -0
- package/rules/docker/lint_pipeline_docker/lint_pipeline_docker.rego +39 -0
- package/rules/js/lint_pipeline_js/concern.json +10 -0
- package/rules/js/lint_pipeline_js/lint_pipeline_js.mdc +13 -0
- package/rules/js/lint_pipeline_js/lint_pipeline_js.rego +39 -0
- package/rules/k8s/lint_pipeline_k8s/concern.json +10 -0
- package/rules/k8s/lint_pipeline_k8s/lint_pipeline_k8s.mdc +13 -0
- package/rules/k8s/lint_pipeline_k8s/lint_pipeline_k8s.rego +39 -0
- package/rules/php/lint_pipeline_php/concern.json +10 -0
- package/rules/php/lint_pipeline_php/lint_pipeline_php.mdc +13 -0
- package/rules/php/lint_pipeline_php/lint_pipeline_php.rego +39 -0
- package/rules/python/lint_pipeline_python/concern.json +10 -0
- package/rules/python/lint_pipeline_python/lint_pipeline_python.mdc +13 -0
- package/rules/python/lint_pipeline_python/lint_pipeline_python.rego +39 -0
- package/rules/rust/lint_pipeline_rust/concern.json +10 -0
- package/rules/rust/lint_pipeline_rust/lint_pipeline_rust.mdc +13 -0
- package/rules/rust/lint_pipeline_rust/lint_pipeline_rust.rego +39 -0
- package/rules/security/lint_pipeline_security/concern.json +10 -0
- package/rules/security/lint_pipeline_security/lint_pipeline_security.mdc +13 -0
- package/rules/security/lint_pipeline_security/lint_pipeline_security.rego +39 -0
- package/rules/style/lint_pipeline_style/concern.json +10 -0
- package/rules/style/lint_pipeline_style/lint_pipeline_style.mdc +13 -0
- package/rules/style/lint_pipeline_style/lint_pipeline_style.rego +39 -0
- package/rules/text/lint_pipeline_text/concern.json +10 -0
- package/rules/text/lint_pipeline_text/lint_pipeline_text.mdc +13 -0
- package/rules/text/lint_pipeline_text/lint_pipeline_text.rego +39 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.2.0] - 2026-07-16
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Mixin-концерни `lint_pipeline_*` (js/python/docker/k8s/style/php/rust/security/text): Azure-реалізація CI-lint намірів — обов'язковий script-степ `n-rules lint … --no-fix` у azure-pipelines.yml
|
|
8
|
+
|
|
9
|
+
## [1.1.0] - 2026-07-15
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Перший реліз @7n/rules-ci-azure: правило `azure-pipelines` — базова структура azure-pipelines.yml (trigger/pool), обов'язковий lint-степ n-rules, розширення VS Code; capability `ci:azure`
|
|
14
|
+
|
|
15
|
+
All notable changes to this project will be documented in this file.
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@7n/rules-ci-azure",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "\u041f\u043b\u0430\u0433\u0456\u043d @7n/rules: \u043a\u0430\u043d\u043e\u043d Azure Pipelines (azure-pipelines.yml) \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, lint-\u0441\u0442\u0435\u043f, VS Code",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"azure-pipelines",
|
|
7
|
+
"ci",
|
|
8
|
+
"lint",
|
|
9
|
+
"n-rules-plugin"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/nitra/7n-rules#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/nitra/7n-rules/issues"
|
|
14
|
+
},
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"author": "v@nitra.ai",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/nitra/7n-rules.git",
|
|
20
|
+
"directory": "plugins/ci-azure"
|
|
21
|
+
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"files": [
|
|
24
|
+
"rules",
|
|
25
|
+
"CHANGELOG.md",
|
|
26
|
+
"!**/*.test.mjs",
|
|
27
|
+
"!**/*_test.rego",
|
|
28
|
+
"!**/fixtures/**"
|
|
29
|
+
],
|
|
30
|
+
"n-rules": {
|
|
31
|
+
"capabilities": [
|
|
32
|
+
"ci:azure"
|
|
33
|
+
],
|
|
34
|
+
"contributes": {
|
|
35
|
+
"rules": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@7n/rules": ">=1.2.0"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"bun": ">=1.3",
|
|
46
|
+
"node": ">=24"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — створи за каноном azure-pipelines.mdc (обов'язковий lint-степ n-rules)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Перевірка обов'язкового lint-степу у `azure-pipelines.yml` (azure-pipelines.mdc).
|
|
2
|
+
#
|
|
3
|
+
# Substring-перевірки по сукупному тексту всіх `script`-кроків (на будь-якій глибині —
|
|
4
|
+
# плоскі steps, jobs, stages): Azure YAML допускає різні розкладки, а команда може мати
|
|
5
|
+
# додаткові аргументи (`--full`, конкретні правила), тож exact-match був би крихким.
|
|
6
|
+
#
|
|
7
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
8
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
9
|
+
package azure_pipelines.lint_pipeline
|
|
10
|
+
|
|
11
|
+
import rego.v1
|
|
12
|
+
|
|
13
|
+
# Усі script-рядки pipeline на будь-якій глибині.
|
|
14
|
+
scripts contains s if {
|
|
15
|
+
walk(input, [_, node])
|
|
16
|
+
is_object(node)
|
|
17
|
+
s := node.script
|
|
18
|
+
is_string(s)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
22
|
+
|
|
23
|
+
# Обидві канонічні форми запуску: `bunx n-rules lint …` і `npx @7n/rules lint …`.
|
|
24
|
+
has_lint_step if contains(script_blob, "n-rules lint")
|
|
25
|
+
|
|
26
|
+
has_lint_step if contains(script_blob, "@7n/rules lint")
|
|
27
|
+
|
|
28
|
+
deny contains msg if {
|
|
29
|
+
not has_lint_step
|
|
30
|
+
msg := "azure-pipelines.yml: має бути script-крок з `n-rules lint` (azure-pipelines.mdc)"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
deny contains msg if {
|
|
34
|
+
has_lint_step
|
|
35
|
+
not contains(script_blob, "--no-fix")
|
|
36
|
+
msg := "azure-pipelines.yml: lint-степ має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "auto": "завжди" }
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Канон Azure Pipelines — структура azure-pipelines.yml, обов'язковий lint-степ n-rules, розширення VS Code
|
|
3
|
+
version: '1.0'
|
|
4
|
+
globs: "azure-pipelines.yml"
|
|
5
|
+
alwaysApply: false
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Правило **azure-pipelines** (плагін `@7n/rules-ci-azure`) перевіряє канонічну структуру `azure-pipelines.yml` у корені репозиторію та налаштування VS Code для роботи з Azure Pipelines. Аналог правила `ga` (плагін `@7n/rules-ci-github`) для репозиторіїв на Azure DevOps.
|
|
9
|
+
|
|
10
|
+
- `azure-pipelines.yml`:
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
trigger:
|
|
14
|
+
branches:
|
|
15
|
+
include:
|
|
16
|
+
- dev
|
|
17
|
+
- main
|
|
18
|
+
|
|
19
|
+
pool:
|
|
20
|
+
vmImage: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
steps:
|
|
23
|
+
- script: |
|
|
24
|
+
curl -fsSL https://bun.sh/install | bash
|
|
25
|
+
echo "##vso[task.prependpath]$HOME/.bun/bin"
|
|
26
|
+
displayName: Install bun
|
|
27
|
+
|
|
28
|
+
- script: bun install --frozen-lockfile
|
|
29
|
+
displayName: Install deps
|
|
30
|
+
|
|
31
|
+
- script: bunx n-rules lint --no-fix --full
|
|
32
|
+
displayName: Lint
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- `extensions.json`:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{ "recommendations": ["ms-azure-devops.azure-pipelines"] }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Структура `azure-pipelines.yml` — базовий канон
|
|
42
|
+
|
|
43
|
+
Rego-пакет: `azure_pipelines.pipeline_common`
|
|
44
|
+
|
|
45
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
46
|
+
|
|
47
|
+
### Що перевіряється
|
|
48
|
+
|
|
49
|
+
- `trigger` — має містити гілки з template (`dev`, `main`); приймається і shorthand-форма `trigger: [dev, main]`, і обʼєктна `trigger.branches.include`
|
|
50
|
+
- `pool.vmImage` — відповідно до template (`ubuntu-latest`); перевіряється кореневий `pool` (для multi-stage pipeline достатньо, щоб хоч один `pool.vmImage` збігався)
|
|
51
|
+
|
|
52
|
+
Канон: [azure-pipelines.yml.snippet.yml](./pipeline_common/template/azure-pipelines.yml.snippet.yml)
|
|
53
|
+
|
|
54
|
+
## Обов'язковий lint-степ — `n-rules lint --no-fix`
|
|
55
|
+
|
|
56
|
+
Rego-пакет: `azure_pipelines.lint_pipeline`
|
|
57
|
+
|
|
58
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
59
|
+
|
|
60
|
+
### Що перевіряється
|
|
61
|
+
|
|
62
|
+
- серед усіх `script`-кроків pipeline (на будь-якій глибині — steps/jobs/stages) сукупно мають бути substrings:
|
|
63
|
+
- `n-rules lint` — запуск уніфікованого лінту
|
|
64
|
+
- `--no-fix` — CI-режим без мутацій
|
|
65
|
+
|
|
66
|
+
Substring-перевірки замість exact-match — Azure YAML допускає різні розкладки (плоскі steps, jobs, stages), а команда може мати додаткові аргументи (`--full`, конкретні правила).
|
|
67
|
+
|
|
68
|
+
Канон: [azure-pipelines-lint.yml.snippet.yml](./lint_pipeline/template/azure-pipelines-lint.yml.snippet.yml)
|
|
69
|
+
|
|
70
|
+
## `.vscode/extensions.json` — розширення для Azure Pipelines
|
|
71
|
+
|
|
72
|
+
Rego-пакет: `azure_pipelines.vscode_extensions`
|
|
73
|
+
|
|
74
|
+
**Цільовий файл:** `.vscode/extensions.json`
|
|
75
|
+
|
|
76
|
+
Кожне розширення з template (`ms-azure-devops.azure-pipelines`) має бути присутнє у `recommendations`. Додаткові розширення від інших правил — допустимі (subset-перевірка).
|
|
77
|
+
|
|
78
|
+
Канон: [extensions.json.snippet.json](./vscode_extensions/template/extensions.json.snippet.json)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Перевірка базової структури `azure-pipelines.yml` (azure-pipelines.mdc).
|
|
2
|
+
#
|
|
3
|
+
# Канон надходить через --data: { "template": { "snippet": ... } }
|
|
4
|
+
# Структура --data сформована з template/azure-pipelines.yml.snippet.yml.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package azure_pipelines.pipeline_common
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
expected_trigger_branches := {b | some b in data.template.snippet.trigger.branches.include}
|
|
13
|
+
|
|
14
|
+
expected_vm_image := data.template.snippet.pool.vmImage
|
|
15
|
+
|
|
16
|
+
# `trigger` у input: обʼєктна форма `trigger.branches.include` …
|
|
17
|
+
actual_trigger_branches := {b | some b in input.trigger.branches.include} if {
|
|
18
|
+
is_object(input.trigger)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# … або shorthand `trigger: [dev, main]`.
|
|
22
|
+
actual_trigger_branches := {b | some b in input.trigger} if {
|
|
23
|
+
is_array(input.trigger)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
# Усі `pool.vmImage` на будь-якій глибині (root, stages/jobs).
|
|
27
|
+
vm_images contains img if {
|
|
28
|
+
walk(input, [_, node])
|
|
29
|
+
is_object(node)
|
|
30
|
+
img := node.pool.vmImage
|
|
31
|
+
is_string(img)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
deny contains msg if {
|
|
35
|
+
not input.trigger
|
|
36
|
+
msg := "azure-pipelines.yml: блок trigger відсутній (azure-pipelines.mdc)"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
deny contains msg if {
|
|
40
|
+
input.trigger
|
|
41
|
+
missing := expected_trigger_branches - actual_trigger_branches
|
|
42
|
+
count(missing) > 0
|
|
43
|
+
msg := sprintf("azure-pipelines.yml: trigger має містити гілки %v (azure-pipelines.mdc)", [missing])
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
deny contains msg if {
|
|
47
|
+
count(vm_images) == 0
|
|
48
|
+
msg := "azure-pipelines.yml: pool.vmImage відсутній (azure-pipelines.mdc)"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
deny contains msg if {
|
|
52
|
+
count(vm_images) > 0
|
|
53
|
+
not expected_vm_image in vm_images
|
|
54
|
+
msg := sprintf("azure-pipelines.yml: pool.vmImage має бути %s (azure-pipelines.mdc)", [expected_vm_image])
|
|
55
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
trigger:
|
|
2
|
+
branches:
|
|
3
|
+
include:
|
|
4
|
+
- dev
|
|
5
|
+
- main
|
|
6
|
+
|
|
7
|
+
pool:
|
|
8
|
+
vmImage: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- script: |
|
|
12
|
+
curl -fsSL https://bun.sh/install | bash
|
|
13
|
+
echo "##vso[task.prependpath]$HOME/.bun/bin"
|
|
14
|
+
displayName: Install bun
|
|
15
|
+
|
|
16
|
+
- script: bun install --frozen-lockfile
|
|
17
|
+
displayName: Install deps
|
|
18
|
+
|
|
19
|
+
- script: bunx n-rules lint --no-fix --full
|
|
20
|
+
displayName: Lint
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"fixability": "config",
|
|
4
|
+
"policy": {
|
|
5
|
+
"files": {
|
|
6
|
+
"single": ".vscode/extensions.json",
|
|
7
|
+
"required": true
|
|
8
|
+
},
|
|
9
|
+
"missingMessage": ".vscode/extensions.json не існує — додай ms-azure-devops.azure-pipelines (azure-pipelines.mdc)"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "recommendations": ["ms-azure-devops.azure-pipelines"] }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Перевірка `.vscode/extensions.json` для Azure Pipelines (azure-pipelines.mdc).
|
|
2
|
+
#
|
|
3
|
+
# Канон надходить через --data: { "template": { "snippet": ... } }
|
|
4
|
+
# Структура --data сформована з template/extensions.json.snippet.json.
|
|
5
|
+
# `recommendations` — subset-of: кожна рекомендація з template має бути у input.
|
|
6
|
+
# Додаткові рекомендації від інших правил дозволені.
|
|
7
|
+
#
|
|
8
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
9
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
10
|
+
package azure_pipelines.vscode_extensions
|
|
11
|
+
|
|
12
|
+
import rego.v1
|
|
13
|
+
|
|
14
|
+
deny contains msg if {
|
|
15
|
+
some rec in data.template.snippet.recommendations
|
|
16
|
+
not rec in {r | some r in object.get(input, "recommendations", [])}
|
|
17
|
+
msg := sprintf(".vscode/extensions.json: recommendations має містити %q (azure-pipelines.mdc)", [rec])
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint docker --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `docker`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `docker.lint_pipeline_docker` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint docker` (приймається і `npx @7n/rules lint docker`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-docker.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `docker`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint docker --no-fix
|
|
12
|
+
displayName: Lint docker
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `docker` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-docker.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint docker` (або `@7n/rules lint docker`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `docker` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package docker.lint_pipeline_docker
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint docker")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint docker")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий docker-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint docker --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `docker` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint js --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `js`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `js.lint_pipeline_js` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint js` (приймається і `npx @7n/rules lint js`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-js.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `js`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint js --no-fix
|
|
12
|
+
displayName: Lint js
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `js` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-js.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint js` (або `@7n/rules lint js`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `js` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package js.lint_pipeline_js
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint js")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint js")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий js-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint js --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `js` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint k8s --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `k8s`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `k8s.lint_pipeline_k8s` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint k8s` (приймається і `npx @7n/rules lint k8s`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-k8s.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `k8s`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint k8s --no-fix
|
|
12
|
+
displayName: Lint k8s
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `k8s` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-k8s.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint k8s` (або `@7n/rules lint k8s`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `k8s` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package k8s.lint_pipeline_k8s
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint k8s")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint k8s")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий k8s-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint k8s --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `k8s` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint php --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `php`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `php.lint_pipeline_php` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint php` (приймається і `npx @7n/rules lint php`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-php.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `php`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint php --no-fix
|
|
12
|
+
displayName: Lint php
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `php` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-php.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint php` (або `@7n/rules lint php`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `php` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package php.lint_pipeline_php
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint php")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint php")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий php-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint php --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `php` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint python --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `python`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `python.lint_pipeline_python` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint python` (приймається і `npx @7n/rules lint python`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-python.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `python`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint python --no-fix
|
|
12
|
+
displayName: Lint python
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `python` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-python.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint python` (або `@7n/rules lint python`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `python` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package python.lint_pipeline_python
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint python")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint python")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий python-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint python --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `python` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint rust --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `rust`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `rust.lint_pipeline_rust` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint rust` (приймається і `npx @7n/rules lint rust`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-rust.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `rust`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint rust --no-fix
|
|
12
|
+
displayName: Lint rust
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `rust` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-rust.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint rust` (або `@7n/rules lint rust`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `rust` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package rust.lint_pipeline_rust
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint rust")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint rust")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий rust-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint rust --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `rust` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint security --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `security`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `security.lint_pipeline_security` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint security` (приймається і `npx @7n/rules lint security`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-security.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `security`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint security --no-fix
|
|
12
|
+
displayName: Lint security
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `security` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-security.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint security` (або `@7n/rules lint security`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `security` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package security.lint_pipeline_security
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint security")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint security")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий security-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint security --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `security` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint style --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `style`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `style.lint_pipeline_style` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint style` (приймається і `npx @7n/rules lint style`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-style.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `style`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint style --no-fix
|
|
12
|
+
displayName: Lint style
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `style` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-style.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint style` (або `@7n/rules lint style`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `style` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package style.lint_pipeline_style
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint style")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint style")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий style-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint style --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `style` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@7n/rules/schemas/concern.json",
|
|
3
|
+
"policy": {
|
|
4
|
+
"files": {
|
|
5
|
+
"single": "azure-pipelines.yml",
|
|
6
|
+
"required": true
|
|
7
|
+
},
|
|
8
|
+
"missingMessage": "azure-pipelines.yml не існує — додай lint-степ `bunx n-rules lint text --no-fix` (azure-pipelines.mdc)"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## Azure Pipelines: обов'язковий lint-степ `text`
|
|
2
|
+
|
|
3
|
+
Rego-пакет: `text.lint_pipeline_text` (mixin з плагіна `@7n/rules-ci-azure`)
|
|
4
|
+
|
|
5
|
+
**Цільовий файл:** `azure-pipelines.yml`
|
|
6
|
+
|
|
7
|
+
Серед `script`-кроків pipeline (будь-яка глибина — steps/jobs/stages) сукупно мають бути substrings `n-rules lint text` (приймається і `npx @7n/rules lint text`) та `--no-fix`. Це провайдер-аналог GitHub-workflow `lint-text.yml` з `@7n/rules-ci-github`: намір «CI-lint домену `text`» однаковий, реалізація — своя для кожного CI-провайдера.
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
steps:
|
|
11
|
+
- script: bunx n-rules lint text --no-fix
|
|
12
|
+
displayName: Lint text
|
|
13
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Обов'язковий lint-степ домену `text` у `azure-pipelines.yml` (провайдер-аналог
|
|
2
|
+
# GitHub-workflow `lint-text.yml` з @7n/rules-ci-github): серед script-кроків pipeline
|
|
3
|
+
# на будь-якій глибині має бути запуск `n-rules lint text` (або `@7n/rules lint text`)
|
|
4
|
+
# з `--no-fix`. Mixin-концерн правила `text` — активний лише разом із правилом.
|
|
5
|
+
#
|
|
6
|
+
# Конвенція проєкту — `import rego.v1` + multi-value `deny contains msg if { … }`
|
|
7
|
+
# (conftest.mdc). Лінт — `n-rules lint rego` (regal).
|
|
8
|
+
package text.lint_pipeline_text
|
|
9
|
+
|
|
10
|
+
import rego.v1
|
|
11
|
+
|
|
12
|
+
scripts contains s if {
|
|
13
|
+
walk(input, [_, node])
|
|
14
|
+
is_object(node)
|
|
15
|
+
s := node.script
|
|
16
|
+
is_string(s)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
script_blob := concat("\n", [s | some s in scripts])
|
|
20
|
+
|
|
21
|
+
has_lint_step if contains(script_blob, "n-rules lint text")
|
|
22
|
+
|
|
23
|
+
has_lint_step if contains(script_blob, "@7n/rules lint text")
|
|
24
|
+
|
|
25
|
+
# Загальний full-прогін покриває всі домени — окремий text-степ не потрібен.
|
|
26
|
+
has_lint_step if contains(script_blob, "n-rules lint --no-fix --full")
|
|
27
|
+
|
|
28
|
+
has_lint_step if contains(script_blob, "@7n/rules lint --no-fix --full")
|
|
29
|
+
|
|
30
|
+
deny contains msg if {
|
|
31
|
+
not has_lint_step
|
|
32
|
+
msg := "azure-pipelines.yml: має бути script-крок `n-rules lint text --no-fix` (azure-pipelines.mdc)"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
deny contains msg if {
|
|
36
|
+
has_lint_step
|
|
37
|
+
not contains(script_blob, "--no-fix")
|
|
38
|
+
msg := "azure-pipelines.yml: lint-степ `text` має запускатись з `--no-fix` (CI без мутацій, azure-pipelines.mdc)"
|
|
39
|
+
}
|