@7n/rules-ci-azure 1.4.1 → 1.4.2
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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.2] - 2026-07-18
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- fix-service_deploy_pipeline: `parseNRulesCmd`/`relevantDomains` перенесено в спільний `@7n/rules/scripts/lib/lint-surface/ci-plan.mjs` (jscpd-дублікат із ci-github), без зміни поведінки
|
|
8
|
+
|
|
3
9
|
## [1.4.1] - 2026-07-18
|
|
4
10
|
|
|
5
11
|
### Fixed
|
package/package.json
CHANGED
|
@@ -3,9 +3,8 @@ type: JS Module
|
|
|
3
3
|
title: fix-service_deploy_pipeline.mjs
|
|
4
4
|
resource: plugins/ci-azure/rules/azure-pipelines/service_deploy_pipeline/fix-service_deploy_pipeline.mjs
|
|
5
5
|
docgen:
|
|
6
|
-
crc:
|
|
6
|
+
crc: 0080ec86
|
|
7
7
|
model: openai-codex/gpt-5.4-mini
|
|
8
|
-
tier: cloud-min
|
|
9
8
|
score: 100
|
|
10
9
|
issues: judge:inaccurate:0.99
|
|
11
10
|
judgeModel: openai-codex/gpt-5.4-mini
|
|
@@ -23,16 +23,13 @@
|
|
|
23
23
|
* Template-розкладка (`- template:`) не мігрується — фіксеру не видно
|
|
24
24
|
* розгорнутих джоб.
|
|
25
25
|
*/
|
|
26
|
-
import { readFileSync, writeFileSync, existsSync
|
|
27
|
-
import { join
|
|
26
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs'
|
|
27
|
+
import { join } from 'node:path'
|
|
28
28
|
|
|
29
29
|
import { parseDocument } from 'yaml'
|
|
30
30
|
|
|
31
|
-
import {
|
|
32
|
-
import { collectPathScopedFiles } from '@7n/rules/scripts/lib/lint-surface/path-scope.mjs'
|
|
33
|
-
import { domainKey } from '@7n/rules/scripts/lib/lint-surface/ci-plan.mjs'
|
|
31
|
+
import { domainKey, parseNRulesCmd, relevantDomains } from '@7n/rules/scripts/lib/lint-surface/ci-plan.mjs'
|
|
34
32
|
|
|
35
|
-
const WS_RE = /\s+/u
|
|
36
33
|
const GLOB_SUFFIX_RE = /\/\*+$/u
|
|
37
34
|
|
|
38
35
|
/** Канонічні prep-кроки, якщо в pipeline немає власного зразка. */
|
|
@@ -79,34 +76,6 @@ function stepCmdPath(step) {
|
|
|
79
76
|
return ['inputs', 'script']
|
|
80
77
|
}
|
|
81
78
|
|
|
82
|
-
/**
|
|
83
|
-
* Розбирає команду `n-rules lint …`/`n-rules ci plan …` токенами (без regex —
|
|
84
|
-
* стійко до багаторядкових script-ів і без бектрекінгу).
|
|
85
|
-
* @param {string} cmd повний текст команди кроку
|
|
86
|
-
* @param {string} marker підрядок-початок (`n-rules lint` | `n-rules ci plan`)
|
|
87
|
-
* @returns {{ domain: string|null, path: string|null }|null} розбір або null, якщо маркера немає
|
|
88
|
-
*/
|
|
89
|
-
function parseNRulesCmd(cmd, marker) {
|
|
90
|
-
const at = cmd.indexOf(marker)
|
|
91
|
-
if (at === -1) return null
|
|
92
|
-
const tokens = cmd
|
|
93
|
-
.slice(at + marker.length)
|
|
94
|
-
.split(WS_RE)
|
|
95
|
-
.filter(Boolean)
|
|
96
|
-
let domain = null
|
|
97
|
-
let path = null
|
|
98
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
99
|
-
const t = tokens[i]
|
|
100
|
-
if (t === '--path') {
|
|
101
|
-
path = tokens[i + 1] ?? null
|
|
102
|
-
i++
|
|
103
|
-
continue
|
|
104
|
-
}
|
|
105
|
-
if (!t.startsWith('-') && domain === null && path === null) domain = t
|
|
106
|
-
}
|
|
107
|
-
return { domain, path }
|
|
108
|
-
}
|
|
109
|
-
|
|
110
79
|
/**
|
|
111
80
|
* Prep-кроки для нових джоб: зразок із першої джоби, що робить
|
|
112
81
|
* `bun install` (кроки від початку до нього включно, checkout → fetchDepth: 0),
|
|
@@ -191,27 +160,6 @@ function buildLintJob(domain, servicePath, prep) {
|
|
|
191
160
|
}
|
|
192
161
|
}
|
|
193
162
|
|
|
194
|
-
/**
|
|
195
|
-
* Релевантні домени сервісу: enabled-правила, чиї per-file glob-и матчать
|
|
196
|
-
* бодай один файл піддерева (та сама таблиця, що `ci plan` по не-дельті).
|
|
197
|
-
* @param {string} cwd корінь consumer-репо
|
|
198
|
-
* @param {string} servicePath каталог сервісу
|
|
199
|
-
* @returns {Promise<string[]>} відсортовані rule-id
|
|
200
|
-
*/
|
|
201
|
-
async function relevantDomains(cwd, servicePath) {
|
|
202
|
-
const abs = resolve(cwd, servicePath)
|
|
203
|
-
if (!existsSync(abs) || !statSync(abs).isDirectory()) return []
|
|
204
|
-
const files = await collectPathScopedFiles(cwd, servicePath)
|
|
205
|
-
const { byRule, enabledSet } = await loadEnabledLintRules({ cwd })
|
|
206
|
-
const active = computeActiveDomains(byRule, enabledSet, files)
|
|
207
|
-
return active
|
|
208
|
-
.entries()
|
|
209
|
-
.filter(([, st]) => st.triggered)
|
|
210
|
-
.map(([id]) => id)
|
|
211
|
-
.toArray()
|
|
212
|
-
.toSorted((a, b) => a.localeCompare(b))
|
|
213
|
-
}
|
|
214
|
-
|
|
215
163
|
/**
|
|
216
164
|
* Розбір lint-команди джоби: `{ legacy, domain, path, stepIndex }` або null.
|
|
217
165
|
* @param {Array<Record<string, unknown>>} steps кроки джоби (plain JS)
|