@peterhauge/apiops-cli 0.2.1-alpha.0 → 0.4.0-alpha.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 +166 -0
- package/README.md +173 -169
- package/dist/cli/extract-command.d.ts +2 -2
- package/dist/cli/extract-command.d.ts.map +1 -1
- package/dist/cli/extract-command.js +3 -5
- package/dist/cli/extract-command.js.map +1 -1
- package/dist/cli/index.js +2 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init-command.d.ts +1 -1
- package/dist/cli/init-command.js +6 -6
- package/dist/cli/init-command.js.map +1 -1
- package/dist/cli/publish-command.d.ts +2 -2
- package/dist/cli/publish-command.js +3 -3
- package/dist/clients/apim-client.d.ts +16 -5
- package/dist/clients/apim-client.d.ts.map +1 -1
- package/dist/clients/apim-client.js +22 -7
- package/dist/clients/apim-client.js.map +1 -1
- package/dist/clients/artifact-store.d.ts +4 -4
- package/dist/clients/artifact-store.d.ts.map +1 -1
- package/dist/clients/artifact-store.js +10 -4
- package/dist/clients/artifact-store.js.map +1 -1
- package/dist/clients/iapim-client.d.ts +14 -2
- package/dist/clients/iapim-client.d.ts.map +1 -1
- package/dist/clients/iapim-client.js +1 -1
- package/dist/clients/iartifact-store.d.ts +10 -5
- package/dist/clients/iartifact-store.d.ts.map +1 -1
- package/dist/clients/iartifact-store.js +1 -1
- package/dist/lib/cloud-config.d.ts +1 -1
- package/dist/lib/cloud-config.js +1 -1
- package/dist/lib/config-loader.d.ts +2 -7
- package/dist/lib/config-loader.d.ts.map +1 -1
- package/dist/lib/config-loader.js +3 -22
- package/dist/lib/config-loader.js.map +1 -1
- package/dist/lib/dependency-graph.d.ts +1 -1
- package/dist/lib/dependency-graph.js +1 -1
- package/dist/lib/exit-codes.d.ts +1 -1
- package/dist/lib/exit-codes.js +1 -1
- package/dist/lib/logger.js +1 -1
- package/dist/lib/parallel-runner.d.ts +2 -2
- package/dist/lib/parallel-runner.js +2 -2
- package/dist/lib/render-template.d.ts +10 -0
- package/dist/lib/render-template.d.ts.map +1 -0
- package/dist/lib/render-template.js +14 -0
- package/dist/lib/render-template.js.map +1 -0
- package/dist/lib/resource-path.d.ts +1 -1
- package/dist/lib/resource-path.js +1 -1
- package/dist/lib/resource-uri.d.ts +1 -1
- package/dist/lib/resource-uri.js +1 -1
- package/dist/lib/workspace-link.d.ts +31 -3
- package/dist/lib/workspace-link.d.ts.map +1 -1
- package/dist/lib/workspace-link.js +49 -3
- package/dist/lib/workspace-link.js.map +1 -1
- package/dist/models/config.d.ts +2 -4
- package/dist/models/config.d.ts.map +1 -1
- package/dist/models/config.js +1 -1
- package/dist/models/resource-types.d.ts +1 -1
- package/dist/models/resource-types.d.ts.map +1 -1
- package/dist/models/resource-types.js +5 -3
- package/dist/models/resource-types.js.map +1 -1
- package/dist/models/types.d.ts +22 -1
- package/dist/models/types.d.ts.map +1 -1
- package/dist/models/types.js +1 -1
- package/dist/services/api-extractor.d.ts +1 -1
- package/dist/services/api-extractor.d.ts.map +1 -1
- package/dist/services/api-extractor.js +39 -133
- package/dist/services/api-extractor.js.map +1 -1
- package/dist/services/api-publisher.d.ts +1 -1
- package/dist/services/api-publisher.d.ts.map +1 -1
- package/dist/services/api-publisher.js +50 -18
- package/dist/services/api-publisher.js.map +1 -1
- package/dist/services/delete-unmatched-service.d.ts +1 -1
- package/dist/services/delete-unmatched-service.js +1 -1
- package/dist/services/dry-run-reporter.d.ts +1 -1
- package/dist/services/dry-run-reporter.js +1 -1
- package/dist/services/extract-service.d.ts +1 -1
- package/dist/services/extract-service.d.ts.map +1 -1
- package/dist/services/extract-service.js +5 -3
- package/dist/services/extract-service.js.map +1 -1
- package/dist/services/filter-service.d.ts +19 -1
- package/dist/services/filter-service.d.ts.map +1 -1
- package/dist/services/filter-service.js +40 -2
- package/dist/services/filter-service.js.map +1 -1
- package/dist/services/git-diff-service.d.ts +1 -1
- package/dist/services/git-diff-service.js +1 -1
- package/dist/services/identity-guide-service.d.ts +4 -5
- package/dist/services/identity-guide-service.d.ts.map +1 -1
- package/dist/services/identity-guide-service.js +7 -41
- package/dist/services/identity-guide-service.js.map +1 -1
- package/dist/services/init-service.d.ts +1 -1
- package/dist/services/init-service.d.ts.map +1 -1
- package/dist/services/init-service.js +62 -29
- package/dist/services/init-service.js.map +1 -1
- package/dist/services/override-merger.d.ts +1 -1
- package/dist/services/override-merger.js +1 -1
- package/dist/services/product-extractor.d.ts +1 -1
- package/dist/services/product-extractor.d.ts.map +1 -1
- package/dist/services/product-extractor.js +31 -28
- package/dist/services/product-extractor.js.map +1 -1
- package/dist/services/product-publisher.d.ts.map +1 -1
- package/dist/services/product-publisher.js +25 -9
- package/dist/services/product-publisher.js.map +1 -1
- package/dist/services/prompt-service.d.ts +1 -1
- package/dist/services/prompt-service.js +1 -1
- package/dist/services/publish-service.d.ts +1 -1
- package/dist/services/publish-service.d.ts.map +1 -1
- package/dist/services/publish-service.js +31 -1
- package/dist/services/publish-service.js.map +1 -1
- package/dist/services/resource-extractor.d.ts +1 -1
- package/dist/services/resource-extractor.js +1 -1
- package/dist/services/resource-publisher.d.ts +14 -1
- package/dist/services/resource-publisher.d.ts.map +1 -1
- package/dist/services/resource-publisher.js +45 -10
- package/dist/services/resource-publisher.js.map +1 -1
- package/dist/services/secret-redaction-guard.d.ts +40 -0
- package/dist/services/secret-redaction-guard.d.ts.map +1 -0
- package/dist/services/secret-redaction-guard.js +92 -0
- package/dist/services/secret-redaction-guard.js.map +1 -0
- package/dist/services/secret-redactor.d.ts +19 -1
- package/dist/services/secret-redactor.d.ts.map +1 -1
- package/dist/services/secret-redactor.js +173 -1
- package/dist/services/secret-redactor.js.map +1 -1
- package/dist/services/transitive-resolver.d.ts +1 -1
- package/dist/services/transitive-resolver.js +1 -1
- package/dist/services/workspace-extractor.d.ts +7 -1
- package/dist/services/workspace-extractor.d.ts.map +1 -1
- package/dist/services/workspace-extractor.js +75 -10
- package/dist/services/workspace-extractor.js.map +1 -1
- package/dist/templates/azure-devops/extract-pipeline.d.ts +1 -1
- package/dist/templates/azure-devops/extract-pipeline.js +142 -142
- package/dist/templates/azure-devops/publish-pipeline.d.ts +1 -1
- package/dist/templates/azure-devops/publish-pipeline.d.ts.map +1 -1
- package/dist/templates/azure-devops/publish-pipeline.js +151 -117
- package/dist/templates/azure-devops/publish-pipeline.js.map +1 -1
- package/dist/templates/configs/filter-config.d.ts +1 -1
- package/dist/templates/configs/filter-config.d.ts.map +1 -1
- package/dist/templates/configs/filter-config.js +7 -110
- package/dist/templates/configs/filter-config.js.map +1 -1
- package/dist/templates/configs/override-config.d.ts +1 -1
- package/dist/templates/configs/override-config.d.ts.map +1 -1
- package/dist/templates/configs/override-config.js +8 -92
- package/dist/templates/configs/override-config.js.map +1 -1
- package/dist/templates/configs/schema-ref.d.ts +18 -0
- package/dist/templates/configs/schema-ref.d.ts.map +1 -0
- package/dist/templates/configs/schema-ref.js +26 -0
- package/dist/templates/configs/schema-ref.js.map +1 -0
- package/dist/templates/copilot/configure-filter-prompt.d.ts +10 -0
- package/dist/templates/copilot/configure-filter-prompt.d.ts.map +1 -0
- package/dist/templates/copilot/configure-filter-prompt.js +14 -0
- package/dist/templates/copilot/configure-filter-prompt.js.map +1 -0
- package/dist/templates/copilot/configure-overrides-prompt.d.ts +7 -0
- package/dist/templates/copilot/configure-overrides-prompt.d.ts.map +1 -0
- package/dist/templates/copilot/configure-overrides-prompt.js +12 -0
- package/dist/templates/copilot/configure-overrides-prompt.js.map +1 -0
- package/dist/templates/copilot/identity-setup-prompt.d.ts.map +1 -1
- package/dist/templates/copilot/identity-setup-prompt.js +19 -24
- package/dist/templates/copilot/identity-setup-prompt.js.map +1 -1
- package/dist/templates/generated/embedded-markdown.d.ts +8 -5
- package/dist/templates/generated/embedded-markdown.d.ts.map +1 -1
- package/dist/templates/generated/embedded-markdown.js +8 -5
- package/dist/templates/generated/embedded-markdown.js.map +1 -1
- package/dist/templates/github-actions/extract-workflow.d.ts +1 -1
- package/dist/templates/github-actions/extract-workflow.js +119 -119
- package/dist/templates/github-actions/publish-workflow.d.ts +3 -2
- package/dist/templates/github-actions/publish-workflow.d.ts.map +1 -1
- package/dist/templates/github-actions/publish-workflow.js +180 -112
- package/dist/templates/github-actions/publish-workflow.js.map +1 -1
- package/package.json +72 -69
|
@@ -1,129 +1,163 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Azure DevOps publish pipeline template
|
|
5
5
|
* Multi-stage pipeline with commit ID choice, environment selection, and variable groups
|
|
6
6
|
*/
|
|
7
7
|
export function generatePublishPipeline(config) {
|
|
8
8
|
const defaultEnvironment = config.environments[0] ?? 'dev';
|
|
9
9
|
const envValues = config.environments.map((env) => ` - '${env}'`).join('\n');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
--
|
|
77
|
-
--
|
|
78
|
-
--
|
|
79
|
-
--
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
--
|
|
94
|
-
--
|
|
10
|
+
// A single parameterized stage drives all environments. The ENVIRONMENT
|
|
11
|
+
// parameter is resolved at template (compile) time, so it can select the
|
|
12
|
+
// variable group, deployment environment, config file, and env-suffixed
|
|
13
|
+
// variable names (via upper()) without duplicating the stage per environment.
|
|
14
|
+
const stage = `- stage: Publish
|
|
15
|
+
displayName: 'Publish to \${{ parameters.ENVIRONMENT }}'
|
|
16
|
+
variables:
|
|
17
|
+
- group: apim-\${{ parameters.ENVIRONMENT }}
|
|
18
|
+
jobs:
|
|
19
|
+
- deployment: Deploy
|
|
20
|
+
displayName: 'Deploy to \${{ parameters.ENVIRONMENT }}'
|
|
21
|
+
environment: \${{ parameters.ENVIRONMENT }}
|
|
22
|
+
pool:
|
|
23
|
+
vmImage: 'ubuntu-latest'
|
|
24
|
+
strategy:
|
|
25
|
+
runOnce:
|
|
26
|
+
deploy:
|
|
27
|
+
steps:
|
|
28
|
+
- checkout: self
|
|
29
|
+
fetchDepth: 2
|
|
30
|
+
|
|
31
|
+
- task: UseNode@1
|
|
32
|
+
displayName: 'Setup Node.js'
|
|
33
|
+
inputs:
|
|
34
|
+
version: '22.x'
|
|
35
|
+
|
|
36
|
+
- script: |
|
|
37
|
+
node -v
|
|
38
|
+
npm -v
|
|
39
|
+
displayName: 'Verify Node.js version'
|
|
40
|
+
|
|
41
|
+
- script: |
|
|
42
|
+
if [[ -f package-lock.json || -f npm-shrinkwrap.json ]]; then
|
|
43
|
+
npm ci
|
|
44
|
+
else
|
|
45
|
+
npm install
|
|
46
|
+
fi
|
|
47
|
+
displayName: 'Install dependencies'
|
|
48
|
+
|
|
49
|
+
- task: replacetokens@6
|
|
50
|
+
displayName: 'Substitute tokens in configuration.\${{ parameters.ENVIRONMENT }}.yaml'
|
|
51
|
+
inputs:
|
|
52
|
+
sources: 'configuration.\${{ parameters.ENVIRONMENT }}.yaml'
|
|
53
|
+
tokenPattern: 'custom'
|
|
54
|
+
tokenPrefix: '{#['
|
|
55
|
+
tokenSuffix: ']#}'
|
|
56
|
+
missingVarAction: 'keep'
|
|
57
|
+
missingVarLog: 'error'
|
|
58
|
+
|
|
59
|
+
- script: |
|
|
60
|
+
if grep -q '{#\\[' configuration.\${{ parameters.ENVIRONMENT }}.yaml; then
|
|
61
|
+
echo "Unresolved tokens remain in configuration.\${{ parameters.ENVIRONMENT }}.yaml"
|
|
62
|
+
grep -o '{#\\[[^]]*\\]#}' configuration.\${{ parameters.ENVIRONMENT }}.yaml | sort -u
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
displayName: 'Validate token substitution'
|
|
66
|
+
|
|
67
|
+
- task: AzureCLI@2
|
|
68
|
+
displayName: 'Dry-run validation (incremental)'
|
|
69
|
+
condition: and(succeeded(), ne('\${{ parameters.COMMIT_ID_CHOICE }}', 'publish-all-artifacts-in-repo'))
|
|
70
|
+
inputs:
|
|
71
|
+
azureSubscription: 'AZURE_SERVICE_CONNECTION_\${{ upper(parameters.ENVIRONMENT) }}'
|
|
72
|
+
scriptType: 'bash'
|
|
73
|
+
scriptLocation: 'inlineScript'
|
|
74
|
+
inlineScript: |
|
|
75
|
+
npx apiops publish \\
|
|
76
|
+
--resource-group $(APIM_RESOURCE_GROUP_\${{ upper(parameters.ENVIRONMENT) }}) \\
|
|
77
|
+
--service-name $(APIM_SERVICE_NAME_\${{ upper(parameters.ENVIRONMENT) }}) \\
|
|
78
|
+
--source ${config.artifactDir} \\
|
|
79
|
+
--overrides configuration.\${{ parameters.ENVIRONMENT }}.yaml \\
|
|
80
|
+
--commit-id $(Build.SourceVersion) \\
|
|
81
|
+
--subscription-id $(AZURE_SUBSCRIPTION_ID) \\
|
|
82
|
+
--dry-run
|
|
83
|
+
|
|
84
|
+
- task: AzureCLI@2
|
|
85
|
+
displayName: 'Dry-run validation (all artifacts)'
|
|
86
|
+
condition: and(succeeded(), eq('\${{ parameters.COMMIT_ID_CHOICE }}', 'publish-all-artifacts-in-repo'))
|
|
87
|
+
inputs:
|
|
88
|
+
azureSubscription: 'AZURE_SERVICE_CONNECTION_\${{ upper(parameters.ENVIRONMENT) }}'
|
|
89
|
+
scriptType: 'bash'
|
|
90
|
+
scriptLocation: 'inlineScript'
|
|
91
|
+
inlineScript: |
|
|
92
|
+
npx apiops publish \\
|
|
93
|
+
--resource-group $(APIM_RESOURCE_GROUP_\${{ upper(parameters.ENVIRONMENT) }}) \\
|
|
94
|
+
--service-name $(APIM_SERVICE_NAME_\${{ upper(parameters.ENVIRONMENT) }}) \\
|
|
95
|
+
--source ${config.artifactDir} \\
|
|
96
|
+
--overrides configuration.\${{ parameters.ENVIRONMENT }}.yaml \\
|
|
97
|
+
--subscription-id $(AZURE_SUBSCRIPTION_ID) \\
|
|
98
|
+
--dry-run
|
|
99
|
+
|
|
100
|
+
- task: AzureCLI@2
|
|
101
|
+
displayName: 'Publish (incremental - last commit only)'
|
|
102
|
+
condition: and(succeeded(), ne('\${{ parameters.COMMIT_ID_CHOICE }}', 'publish-all-artifacts-in-repo'))
|
|
103
|
+
inputs:
|
|
104
|
+
azureSubscription: 'AZURE_SERVICE_CONNECTION_\${{ upper(parameters.ENVIRONMENT) }}'
|
|
105
|
+
scriptType: 'bash'
|
|
106
|
+
scriptLocation: 'inlineScript'
|
|
107
|
+
inlineScript: |
|
|
108
|
+
npx apiops publish \\
|
|
109
|
+
--resource-group $(APIM_RESOURCE_GROUP_\${{ upper(parameters.ENVIRONMENT) }}) \\
|
|
110
|
+
--service-name $(APIM_SERVICE_NAME_\${{ upper(parameters.ENVIRONMENT) }}) \\
|
|
111
|
+
--source ${config.artifactDir} \\
|
|
112
|
+
--overrides configuration.\${{ parameters.ENVIRONMENT }}.yaml \\
|
|
113
|
+
--commit-id $(Build.SourceVersion) \\
|
|
114
|
+
--subscription-id $(AZURE_SUBSCRIPTION_ID)
|
|
115
|
+
|
|
116
|
+
- task: AzureCLI@2
|
|
117
|
+
displayName: 'Publish (all artifacts)'
|
|
118
|
+
condition: and(succeeded(), eq('\${{ parameters.COMMIT_ID_CHOICE }}', 'publish-all-artifacts-in-repo'))
|
|
119
|
+
inputs:
|
|
120
|
+
azureSubscription: 'AZURE_SERVICE_CONNECTION_\${{ upper(parameters.ENVIRONMENT) }}'
|
|
121
|
+
scriptType: 'bash'
|
|
122
|
+
scriptLocation: 'inlineScript'
|
|
123
|
+
inlineScript: |
|
|
124
|
+
npx apiops publish \\
|
|
125
|
+
--resource-group $(APIM_RESOURCE_GROUP_\${{ upper(parameters.ENVIRONMENT) }}) \\
|
|
126
|
+
--service-name $(APIM_SERVICE_NAME_\${{ upper(parameters.ENVIRONMENT) }}) \\
|
|
127
|
+
--source ${config.artifactDir} \\
|
|
128
|
+
--overrides configuration.\${{ parameters.ENVIRONMENT }}.yaml \\
|
|
129
|
+
--subscription-id $(AZURE_SUBSCRIPTION_ID)
|
|
95
130
|
`;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
- '
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- 'publish-artifacts-in-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
${stages}
|
|
131
|
+
return `# Azure DevOps Pipeline: Run APIM Publisher
|
|
132
|
+
|
|
133
|
+
trigger:
|
|
134
|
+
branches:
|
|
135
|
+
include:
|
|
136
|
+
- main
|
|
137
|
+
paths:
|
|
138
|
+
include:
|
|
139
|
+
- '${config.artifactDir}/**'
|
|
140
|
+
- 'configuration.*.yaml'
|
|
141
|
+
|
|
142
|
+
pr: none
|
|
143
|
+
|
|
144
|
+
parameters:
|
|
145
|
+
- name: COMMIT_ID_CHOICE
|
|
146
|
+
type: string
|
|
147
|
+
displayName: 'Choose "publish-all-artifacts-in-repo" only when you want to force republishing all artifacts (e.g. after build failure). Otherwise stick with the default behavior of "publish-artifacts-in-last-commit"'
|
|
148
|
+
default: 'publish-artifacts-in-last-commit'
|
|
149
|
+
values:
|
|
150
|
+
- 'publish-artifacts-in-last-commit'
|
|
151
|
+
- 'publish-all-artifacts-in-repo'
|
|
152
|
+
- name: ENVIRONMENT
|
|
153
|
+
type: string
|
|
154
|
+
displayName: 'Choose which environment to publish to'
|
|
155
|
+
default: '${defaultEnvironment}'
|
|
156
|
+
values:
|
|
157
|
+
${envValues}
|
|
158
|
+
|
|
159
|
+
stages:
|
|
160
|
+
${stage}
|
|
127
161
|
`;
|
|
128
162
|
}
|
|
129
163
|
//# sourceMappingURL=publish-pipeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-pipeline.js","sourceRoot":"","sources":["../../../src/templates/azure-devops/publish-pipeline.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAOH,MAAM,UAAU,uBAAuB,CAAC,MAA6B;IACnE,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;IAC3D,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAElF,
|
|
1
|
+
{"version":3,"file":"publish-pipeline.js","sourceRoot":"","sources":["../../../src/templates/azure-devops/publish-pipeline.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAOH,MAAM,UAAU,uBAAuB,CAAC,MAA6B;IACnE,MAAM,kBAAkB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;IAC3D,MAAM,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAElF,wEAAwE;IACxE,yEAAyE;IACzE,wEAAwE;IACxE,8EAA8E;IAC9E,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAgEiB,MAAM,CAAC,WAAW;;;;;;;;;;;;;;;;;iCAiBlB,MAAM,CAAC,WAAW;;;;;;;;;;;;;;;;iCAgBlB,MAAM,CAAC,WAAW;;;;;;;;;;;;;;;;iCAgBlB,MAAM,CAAC,WAAW;;;CAGlD,CAAC;IAEA,OAAO;;;;;;;;WAQE,MAAM,CAAC,WAAW;;;;;;;;;;;;;;;;gBAgBb,kBAAkB;;EAEhC,SAAS;;;EAGT,KAAK;CACN,CAAC;AACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-config.d.ts","sourceRoot":"","sources":["../../../src/templates/configs/filter-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"filter-config.d.ts","sourceRoot":"","sources":["../../../src/templates/configs/filter-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAMH,wBAAgB,oBAAoB,IAAI,MAAM,CAI7C"}
|
|
@@ -1,118 +1,15 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Sample filter configuration template
|
|
5
5
|
* Generates a sample configuration.extractor.yaml file
|
|
6
6
|
*/
|
|
7
|
+
import { filterConfigTemplate } from '../generated/embedded-markdown.js';
|
|
8
|
+
import { renderTemplate } from '../../lib/render-template.js';
|
|
9
|
+
import { schemaUrl } from './schema-ref.js';
|
|
7
10
|
export function generateFilterConfig() {
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
# Extract only specific APIs by name
|
|
12
|
-
# apis:
|
|
13
|
-
# - echo-api
|
|
14
|
-
# - petstore-api
|
|
15
|
-
|
|
16
|
-
# Advanced: Filter API sub-resources (operations, diagnostics, schemas, releases)
|
|
17
|
-
# apis:
|
|
18
|
-
# - echo-api # Include all sub-resources
|
|
19
|
-
# - petstore-api: # Control sub-resources
|
|
20
|
-
# operations:
|
|
21
|
-
# - get-pets
|
|
22
|
-
# - create-pet
|
|
23
|
-
# diagnostics:
|
|
24
|
-
# - applicationinsights
|
|
25
|
-
# schemas: [] # Exclude all schemas
|
|
26
|
-
# releases:
|
|
27
|
-
# - v1
|
|
28
|
-
|
|
29
|
-
# Extract only specific products
|
|
30
|
-
# products:
|
|
31
|
-
# - starter
|
|
32
|
-
# - unlimited
|
|
33
|
-
|
|
34
|
-
# Extract only specific backends
|
|
35
|
-
# backends:
|
|
36
|
-
# - backend-api
|
|
37
|
-
# - legacy-backend
|
|
38
|
-
|
|
39
|
-
# Extract only specific named values
|
|
40
|
-
# namedValues:
|
|
41
|
-
# - api-key
|
|
42
|
-
# - connection-string
|
|
43
|
-
|
|
44
|
-
# Extract only specific loggers
|
|
45
|
-
# loggers:
|
|
46
|
-
# - appinsights-logger
|
|
47
|
-
|
|
48
|
-
# Extract only specific diagnostics
|
|
49
|
-
# diagnostics:
|
|
50
|
-
# - applicationinsights
|
|
51
|
-
|
|
52
|
-
# Extract only specific tags
|
|
53
|
-
# tags:
|
|
54
|
-
# - production
|
|
55
|
-
# - external
|
|
56
|
-
|
|
57
|
-
# Extract only specific policy fragments
|
|
58
|
-
# policyFragments:
|
|
59
|
-
# - rate-limit-fragment
|
|
60
|
-
# - cors-fragment
|
|
61
|
-
|
|
62
|
-
# Extract only specific gateways
|
|
63
|
-
# gateways:
|
|
64
|
-
# - default
|
|
65
|
-
# - internal-gateway
|
|
66
|
-
|
|
67
|
-
# Extract only specific version sets
|
|
68
|
-
# versionSets:
|
|
69
|
-
# - payments-v1
|
|
70
|
-
|
|
71
|
-
# Extract only specific groups
|
|
72
|
-
# groups:
|
|
73
|
-
# - administrators
|
|
74
|
-
|
|
75
|
-
# Extract only specific subscriptions
|
|
76
|
-
# subscriptions:
|
|
77
|
-
# - starter-subscription
|
|
78
|
-
|
|
79
|
-
# Extract only specific schemas
|
|
80
|
-
# schemas:
|
|
81
|
-
# - pet-schema
|
|
82
|
-
|
|
83
|
-
# Filter service-level policies
|
|
84
|
-
# policies:
|
|
85
|
-
# - policy
|
|
86
|
-
|
|
87
|
-
# Extract only specific policy restrictions
|
|
88
|
-
# policyRestrictions:
|
|
89
|
-
# - global-policy-restriction
|
|
90
|
-
|
|
91
|
-
# Extract only specific documentations
|
|
92
|
-
# documentations:
|
|
93
|
-
# - getting-started
|
|
94
|
-
|
|
95
|
-
# Extract only specific workspaces
|
|
96
|
-
# workspaces:
|
|
97
|
-
# - dev-workspace
|
|
98
|
-
|
|
99
|
-
# Advanced: Filter workspace sub-resources
|
|
100
|
-
# workspaces:
|
|
101
|
-
# - team-workspace:
|
|
102
|
-
# apis:
|
|
103
|
-
# - team-api-1
|
|
104
|
-
# - team-api-2
|
|
105
|
-
# backends:
|
|
106
|
-
# - team-backend
|
|
107
|
-
# namedValues:
|
|
108
|
-
# - team-api-key
|
|
109
|
-
|
|
110
|
-
# Filter behavior:
|
|
111
|
-
# - Leave a section commented out to include ALL resources of that type
|
|
112
|
-
# - Set a section to an empty array ([]) to exclude ALL resources of that type
|
|
113
|
-
# Example:
|
|
114
|
-
# gateways: []
|
|
115
|
-
# subscriptions: []
|
|
116
|
-
`;
|
|
11
|
+
return renderTemplate(filterConfigTemplate, {
|
|
12
|
+
SCHEMA_URL: schemaUrl('extractor-config.schema.json'),
|
|
13
|
+
});
|
|
117
14
|
}
|
|
118
15
|
//# sourceMappingURL=filter-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-config.js","sourceRoot":"","sources":["../../../src/templates/configs/filter-config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAEH,MAAM,UAAU,oBAAoB;IAClC,OAAO
|
|
1
|
+
{"version":3,"file":"filter-config.js","sourceRoot":"","sources":["../../../src/templates/configs/filter-config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,UAAU,oBAAoB;IAClC,OAAO,cAAc,CAAC,oBAAoB,EAAE;QAC1C,UAAU,EAAE,SAAS,CAAC,8BAA8B,CAAC;KACtD,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Sample override configuration template per environment
|
|
3
3
|
* Generates environment-specific configuration.{env}.yaml files
|
|
4
4
|
*/
|
|
5
5
|
export declare function generateOverrideConfig(environment: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"override-config.d.ts","sourceRoot":"","sources":["../../../src/templates/configs/override-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"override-config.d.ts","sourceRoot":"","sources":["../../../src/templates/configs/override-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAMH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAKlE"}
|
|
@@ -1,100 +1,16 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Sample override configuration template per environment
|
|
5
5
|
* Generates environment-specific configuration.{env}.yaml files
|
|
6
6
|
*/
|
|
7
|
+
import { overrideConfigTemplate } from '../generated/embedded-markdown.js';
|
|
8
|
+
import { renderTemplate } from '../../lib/render-template.js';
|
|
9
|
+
import { schemaUrl } from './schema-ref.js';
|
|
7
10
|
export function generateOverrideConfig(environment) {
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# Override named values (e.g., API keys, connection strings)
|
|
13
|
-
# namedValues:
|
|
14
|
-
# - name: api-key
|
|
15
|
-
# properties:
|
|
16
|
-
# value: "${environment}-api-key-value"
|
|
17
|
-
# - name: connection-string
|
|
18
|
-
# properties:
|
|
19
|
-
# value: "Server=${environment}-db.example.com;Database=mydb"
|
|
20
|
-
# - name: secret-from-keyvault
|
|
21
|
-
# properties:
|
|
22
|
-
# keyVault:
|
|
23
|
-
# secretIdentifier: "https://${environment}-kv.vault.azure.net/secrets/my-secret"
|
|
24
|
-
# identityClientId: "00000000-0000-0000-0000-000000000000"
|
|
25
|
-
|
|
26
|
-
# Override backend URLs per environment
|
|
27
|
-
# backends:
|
|
28
|
-
# - name: backend-api
|
|
29
|
-
# properties:
|
|
30
|
-
# url: "https://${environment}-api.example.com"
|
|
31
|
-
# - name: legacy-backend
|
|
32
|
-
# properties:
|
|
33
|
-
# url: "https://${environment}-legacy.example.com"
|
|
34
|
-
# resourceId: "/subscriptions/.../sites/${environment}-backend"
|
|
35
|
-
|
|
36
|
-
# Override API service URLs (with optional nested sub-resource overrides)
|
|
37
|
-
# apis:
|
|
38
|
-
# - name: echo-api
|
|
39
|
-
# properties:
|
|
40
|
-
# serviceUrl: "https://${environment}-echo.example.com"
|
|
41
|
-
# - name: petstore-api
|
|
42
|
-
# properties:
|
|
43
|
-
# serviceUrl: "https://${environment}-petstore.example.com"
|
|
44
|
-
# displayName: "Petstore API (${environment})"
|
|
45
|
-
# diagnostics:
|
|
46
|
-
# - name: applicationinsights
|
|
47
|
-
# properties:
|
|
48
|
-
# loggerId: "appinsights-logger-${environment}"
|
|
49
|
-
# verbosity: Error
|
|
50
|
-
# policies:
|
|
51
|
-
# - name: policy
|
|
52
|
-
# properties:
|
|
53
|
-
# format: rawxml
|
|
54
|
-
|
|
55
|
-
# Override diagnostic logger references
|
|
56
|
-
# diagnostics:
|
|
57
|
-
# - name: applicationinsights
|
|
58
|
-
# properties:
|
|
59
|
-
# loggerId: "appinsights-logger-${environment}"
|
|
60
|
-
# verbosity: Error
|
|
61
|
-
|
|
62
|
-
# Override logger credentials or resource IDs
|
|
63
|
-
# loggers:
|
|
64
|
-
# - name: appinsights-logger
|
|
65
|
-
# properties:
|
|
66
|
-
# loggerType: applicationInsights
|
|
67
|
-
# resourceId: "/subscriptions/xxxxx/resourceGroups/${environment}-rg/providers/microsoft.insights/components/${environment}-appinsights"
|
|
68
|
-
# isBuffered: true
|
|
69
|
-
# credentials:
|
|
70
|
-
# instrumentationKey: "<APP-INSIGHTS-INSTRUMENTATION-KEY>"
|
|
71
|
-
|
|
72
|
-
# Override service-level policies
|
|
73
|
-
# policies:
|
|
74
|
-
# - name: policy
|
|
75
|
-
# properties:
|
|
76
|
-
# format: rawxml
|
|
77
|
-
|
|
78
|
-
# Override gateway properties
|
|
79
|
-
# gateways:
|
|
80
|
-
# - name: on-prem-gateway
|
|
81
|
-
# properties:
|
|
82
|
-
# locationData:
|
|
83
|
-
# name: "${environment} datacenter"
|
|
84
|
-
|
|
85
|
-
# Override version sets, groups, subscriptions, products, tags, policy fragments
|
|
86
|
-
# versionSets:
|
|
87
|
-
# - name: my-version-set
|
|
88
|
-
# properties:
|
|
89
|
-
# displayName: "My Version Set (${environment})"
|
|
90
|
-
# products:
|
|
91
|
-
# - name: starter
|
|
92
|
-
# properties:
|
|
93
|
-
# displayName: "Starter Plan (${environment})"
|
|
94
|
-
# tags:
|
|
95
|
-
# - name: env-tag
|
|
96
|
-
# properties:
|
|
97
|
-
# displayName: "${environment}"
|
|
98
|
-
`;
|
|
11
|
+
return renderTemplate(overrideConfigTemplate, {
|
|
12
|
+
SCHEMA_URL: schemaUrl('override-config.schema.json'),
|
|
13
|
+
ENVIRONMENT: environment,
|
|
14
|
+
});
|
|
99
15
|
}
|
|
100
16
|
//# sourceMappingURL=override-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"override-config.js","sourceRoot":"","sources":["../../../src/templates/configs/override-config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAEH,
|
|
1
|
+
{"version":3,"file":"override-config.js","sourceRoot":"","sources":["../../../src/templates/configs/override-config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,UAAU,sBAAsB,CAAC,WAAmB;IACxD,OAAO,cAAc,CAAC,sBAAsB,EAAE;QAC5C,UAAU,EAAE,SAAS,CAAC,6BAA6B,CAAC;QACpD,WAAW,EAAE,WAAW;KACzB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds URLs to the published JSON schemas.
|
|
3
|
+
*
|
|
4
|
+
* The schema is only an editor/IDE validation aid (yaml-language-server); the
|
|
5
|
+
* CLI does its own validation at runtime. Schemas are versioned independently
|
|
6
|
+
* of the CLI package version: each schema version lives at a frozen path
|
|
7
|
+
* (`schemas/v<N>/...`) on the `main` branch. Backward-compatible edits update
|
|
8
|
+
* the current version in place; a breaking change introduces a new version
|
|
9
|
+
* folder. The `main` ref always resolves, and the versioned path keeps existing
|
|
10
|
+
* config files pointing at the schema shape they were written against.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Returns the raw URL for a published schema file at the current schema version.
|
|
14
|
+
*
|
|
15
|
+
* @param fileName Schema file name, e.g. `extractor-config.schema.json`.
|
|
16
|
+
*/
|
|
17
|
+
export declare function schemaUrl(fileName: string): string;
|
|
18
|
+
//# sourceMappingURL=schema-ref.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-ref.d.ts","sourceRoot":"","sources":["../../../src/templates/configs/schema-ref.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAMH;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIlD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
/**
|
|
4
|
+
* Builds URLs to the published JSON schemas.
|
|
5
|
+
*
|
|
6
|
+
* The schema is only an editor/IDE validation aid (yaml-language-server); the
|
|
7
|
+
* CLI does its own validation at runtime. Schemas are versioned independently
|
|
8
|
+
* of the CLI package version: each schema version lives at a frozen path
|
|
9
|
+
* (`schemas/v<N>/...`) on the `main` branch. Backward-compatible edits update
|
|
10
|
+
* the current version in place; a breaking change introduces a new version
|
|
11
|
+
* folder. The `main` ref always resolves, and the versioned path keeps existing
|
|
12
|
+
* config files pointing at the schema shape they were written against.
|
|
13
|
+
*/
|
|
14
|
+
import packageJson from '../../../package.json' with { type: 'json' };
|
|
15
|
+
const SCHEMA_BASE = 'https://raw.githubusercontent.com/Azure/apiops-cli/main/schemas';
|
|
16
|
+
/**
|
|
17
|
+
* Returns the raw URL for a published schema file at the current schema version.
|
|
18
|
+
*
|
|
19
|
+
* @param fileName Schema file name, e.g. `extractor-config.schema.json`.
|
|
20
|
+
*/
|
|
21
|
+
export function schemaUrl(fileName) {
|
|
22
|
+
const { schemaVersion } = packageJson;
|
|
23
|
+
const version = schemaVersion ?? '1';
|
|
24
|
+
return `${SCHEMA_BASE}/v${version}/${fileName}`;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=schema-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-ref.js","sourceRoot":"","sources":["../../../src/templates/configs/schema-ref.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;;;;;;;;GAUG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEtE,MAAM,WAAW,GAAG,iEAAiE,CAAC;AAEtF;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,MAAM,EAAE,aAAa,EAAE,GAAG,WAAyC,CAAC;IACpE,MAAM,OAAO,GAAG,aAAa,IAAI,GAAG,CAAC;IACrC,OAAO,GAAG,WAAW,KAAK,OAAO,IAAI,QAAQ,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Copilot prompt template for configuring resource filters.
|
|
3
|
+
* Generates a .prompt.md file that guides Copilot through creating
|
|
4
|
+
* a configuration.extractor.yaml filter file.
|
|
5
|
+
*/
|
|
6
|
+
export interface ConfigureFilterPromptConfig {
|
|
7
|
+
environments: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function generateConfigureFilterPrompt(_config: ConfigureFilterPromptConfig): string;
|
|
10
|
+
//# sourceMappingURL=configure-filter-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-filter-prompt.d.ts","sourceRoot":"","sources":["../../../src/templates/copilot/configure-filter-prompt.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAIH,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CAI1F"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
/**
|
|
4
|
+
* GitHub Copilot prompt template for configuring resource filters.
|
|
5
|
+
* Generates a .prompt.md file that guides Copilot through creating
|
|
6
|
+
* a configuration.extractor.yaml filter file.
|
|
7
|
+
*/
|
|
8
|
+
import { copilotConfigureFilterPromptTemplate } from '../generated/embedded-markdown.js';
|
|
9
|
+
export function generateConfigureFilterPrompt(_config) {
|
|
10
|
+
// The filter prompt is static — no token substitution needed currently.
|
|
11
|
+
// The config parameter is accepted for future extensibility and consistency.
|
|
12
|
+
return copilotConfigureFilterPromptTemplate;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=configure-filter-prompt.js.map
|