@sentry/junior-gocd 0.189.0 → 0.190.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/README.md +13 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +527 -41
- package/dist/tools/job-history.d.ts +50 -0
- package/dist/tools/job-history.d.ts.map +1 -0
- package/dist/tools/pipeline-history.d.ts +32 -2
- package/dist/tools/pipeline-history.d.ts.map +1 -1
- package/dist/tools/pipeline-run.d.ts +58 -0
- package/dist/tools/pipeline-run.d.ts.map +1 -0
- package/dist/tools/pipeline-status.d.ts +33 -0
- package/dist/tools/pipeline-status.d.ts.map +1 -0
- package/dist/tools/pipelines.d.ts +80 -0
- package/dist/tools/pipelines.d.ts.map +1 -0
- package/package.json +2 -2
- package/skills/gocd/SKILL.md +3 -5
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
`@sentry/junior-gocd` adds read-only GoCD tools to Junior. The package does not contain settings for a specific GoCD deployment.
|
|
4
4
|
|
|
5
|
+
Full setup guide: https://junior.sentry.dev/extend/gocd-plugin/
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```ts
|
|
@@ -61,13 +63,23 @@ gocdPlugin({
|
|
|
61
63
|
|
|
62
64
|
## Tools
|
|
63
65
|
|
|
66
|
+
- `pipelines`: returns visible pipeline names, groups, environments, and recent run state
|
|
64
67
|
- `pipelineHistory`: returns recent runs for one pipeline
|
|
68
|
+
- `pipelineRun`: returns one pipeline run with stage and job results
|
|
69
|
+
- `pipelineStatus`: returns whether one pipeline is paused, locked, and schedulable
|
|
65
70
|
- `stage`: returns one stage run, its jobs, and failed job names
|
|
71
|
+
- `jobHistory`: returns recent runs for one job
|
|
72
|
+
|
|
73
|
+
Tool results include operational state only. They do not include pipeline configuration, environment variables, source material, commit messages, user identities, agent identifiers, pause reasons, or console output.
|
|
66
74
|
|
|
67
75
|
The tools use the GoCD 25.2.0 API:
|
|
68
76
|
|
|
77
|
+
- dashboard: `GET /go/api/dashboard` with `Accept: application/vnd.go.cd.v4+json`
|
|
69
78
|
- pipeline history: `GET /go/api/pipelines/:name/history` with `Accept: application/vnd.go.cd.v1+json`
|
|
79
|
+
- pipeline run: `GET /go/api/pipelines/:name/:counter` with `Accept: application/vnd.go.cd.v1+json`
|
|
80
|
+
- pipeline status: `GET /go/api/pipelines/:name/status` with `Accept: application/vnd.go.cd.v1+json`
|
|
70
81
|
- stage run: `GET /go/api/stages/:pipeline_name/:stage_name/instance/:pipeline_counter/:stage_counter` with `Accept: application/vnd.go.cd.v3+json`
|
|
71
|
-
-
|
|
82
|
+
- job history: `GET /go/api/jobs/:pipeline_name/:stage_name/:job_name/history` with `Accept: application/vnd.go.cd.v1+json`
|
|
83
|
+
- pipeline and job history limit `page_size` to 10 through 100
|
|
72
84
|
|
|
73
85
|
Keep pipeline names and other deployment-specific settings in the app that registers this plugin.
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAEA,wEAAwE;AACxE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IAAE,sBAAsB,EAAE,OAAO,CAAA;CAAE,GAC3C,KAAK,CAKP"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,WAAW,EAEhB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQ1E,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,WAAW,EACX,gBAAgB,GAAG,iBAAiB,GAAG,kBAAkB,CAC1D,CAAC;AAEF,MAAM,WAAW,6BAA8B,SAAQ,iBAAiB;IACtE;;;OAGG;IACH,KAAK,CAAC,EAAE,mBAAmB,CAAC;CAC7B;AAUD,qCAAqC;AACrC,wBAAgB,UAAU,CACxB,OAAO,GAAE,6BAAkC,GAC1C,kBAAkB,CAuDpB;AAED,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -40,23 +40,86 @@ function resolveGocdBaseUrl(options = {}) {
|
|
|
40
40
|
return parseBaseUrl(configuredBaseUrl).origin;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
// src/tools/
|
|
43
|
+
// src/tools/pipelines.ts
|
|
44
44
|
import {
|
|
45
45
|
definePluginTool,
|
|
46
46
|
pluginToolOutputSchema
|
|
47
47
|
} from "@sentry/junior-plugin-api";
|
|
48
48
|
import { z } from "zod";
|
|
49
|
+
|
|
50
|
+
// src/errors.ts
|
|
51
|
+
import { PluginToolInputError } from "@sentry/junior-plugin-api";
|
|
52
|
+
function throwGocdReadError(message, status, options) {
|
|
53
|
+
if (status === 404 && options.missingResourceIsInput) {
|
|
54
|
+
throw new PluginToolInputError(message);
|
|
55
|
+
}
|
|
56
|
+
throw new Error(message);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// src/tools/pipelines.ts
|
|
60
|
+
var stageSchema = z.object({
|
|
61
|
+
name: z.string(),
|
|
62
|
+
counter: z.union([z.string(), z.number()]),
|
|
63
|
+
status: z.string(),
|
|
64
|
+
scheduled_at: z.string().nullable().optional()
|
|
65
|
+
}).passthrough();
|
|
66
|
+
var instanceSchema = z.object({
|
|
67
|
+
label: z.string(),
|
|
68
|
+
counter: z.number(),
|
|
69
|
+
scheduled_at: z.string().nullable().optional(),
|
|
70
|
+
_embedded: z.object({ stages: z.array(stageSchema).default([]) })
|
|
71
|
+
}).passthrough();
|
|
72
|
+
var pipelineSchema = z.object({
|
|
73
|
+
name: z.string(),
|
|
74
|
+
last_updated_timestamp: z.number().nullable().optional(),
|
|
75
|
+
locked: z.boolean(),
|
|
76
|
+
pause_info: z.object({ paused: z.boolean() }),
|
|
77
|
+
_embedded: z.object({ instances: z.array(instanceSchema).default([]) })
|
|
78
|
+
}).passthrough();
|
|
79
|
+
var namedPipelineListSchema = z.object({ name: z.string(), pipelines: z.array(z.string()).default([]) }).passthrough();
|
|
80
|
+
var dashboardSchema = z.object({
|
|
81
|
+
_embedded: z.object({
|
|
82
|
+
pipelines: z.array(pipelineSchema).default([]),
|
|
83
|
+
environments: z.array(namedPipelineListSchema).default([]),
|
|
84
|
+
pipeline_groups: z.array(namedPipelineListSchema).default([])
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
var stageOutputSchema = z.object({
|
|
88
|
+
name: z.string(),
|
|
89
|
+
counter: z.string(),
|
|
90
|
+
status: z.string(),
|
|
91
|
+
scheduledAt: z.string().nullable()
|
|
92
|
+
});
|
|
93
|
+
var instanceOutputSchema = z.object({
|
|
94
|
+
label: z.string(),
|
|
95
|
+
counter: z.number(),
|
|
96
|
+
scheduledAt: z.string().nullable(),
|
|
97
|
+
stages: z.array(stageOutputSchema)
|
|
98
|
+
});
|
|
49
99
|
var inputSchema = z.object({
|
|
50
|
-
|
|
51
|
-
count: z.number().int().min(1).max(100).default(
|
|
100
|
+
query: z.string().trim().min(1).optional().describe("Optional case-insensitive pipeline name filter."),
|
|
101
|
+
count: z.number().int().min(1).max(100).default(50)
|
|
52
102
|
}).strict();
|
|
53
103
|
var outputSchema = pluginToolOutputSchema.extend({
|
|
54
|
-
target: z.literal("
|
|
104
|
+
target: z.literal("pipelines"),
|
|
55
105
|
baseUrl: z.string(),
|
|
56
|
-
|
|
57
|
-
|
|
106
|
+
pipelines: z.array(
|
|
107
|
+
z.object({
|
|
108
|
+
name: z.string(),
|
|
109
|
+
lastUpdatedAt: z.number().nullable(),
|
|
110
|
+
locked: z.boolean(),
|
|
111
|
+
paused: z.boolean(),
|
|
112
|
+
runs: z.array(instanceOutputSchema)
|
|
113
|
+
})
|
|
114
|
+
),
|
|
115
|
+
environments: z.array(
|
|
116
|
+
namedPipelineListSchema.pick({ name: true, pipelines: true })
|
|
117
|
+
),
|
|
118
|
+
pipelineGroups: z.array(
|
|
119
|
+
namedPipelineListSchema.pick({ name: true, pipelines: true })
|
|
120
|
+
)
|
|
58
121
|
});
|
|
59
|
-
function
|
|
122
|
+
function createGocdPipelinesTool(ctx, options = {}) {
|
|
60
123
|
return definePluginTool({
|
|
61
124
|
annotations: {
|
|
62
125
|
destructiveHint: false,
|
|
@@ -64,9 +127,230 @@ function createGocdPipelineHistoryTool(ctx, options = {}) {
|
|
|
64
127
|
openWorldHint: true,
|
|
65
128
|
readOnlyHint: true
|
|
66
129
|
},
|
|
67
|
-
description: "
|
|
130
|
+
description: "Search visible GoCD pipelines. Returns groups, environments, and recent runs. Use this to find an exact pipeline name.",
|
|
68
131
|
inputSchema,
|
|
69
132
|
outputSchema,
|
|
133
|
+
async execute(input) {
|
|
134
|
+
const baseUrl = resolveGocdBaseUrl(options);
|
|
135
|
+
const response = await ctx.egress.fetch({
|
|
136
|
+
operation: "gocd.dashboard",
|
|
137
|
+
provider: "gocd",
|
|
138
|
+
request: new Request(resolveGocdApiUrl(baseUrl, "/go/api/dashboard"), {
|
|
139
|
+
headers: { Accept: "application/vnd.go.cd.v4+json" },
|
|
140
|
+
method: "GET"
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
if (!response.ok) {
|
|
144
|
+
throwGocdReadError(
|
|
145
|
+
`GoCD pipelines failed with HTTP ${response.status}`,
|
|
146
|
+
response.status,
|
|
147
|
+
{ missingResourceIsInput: false }
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
const body = dashboardSchema.parse(await response.json())._embedded;
|
|
151
|
+
const query = input.query?.toLocaleLowerCase();
|
|
152
|
+
const pipelines = body.pipelines.filter(
|
|
153
|
+
(pipeline) => !query || pipeline.name.toLocaleLowerCase().includes(query)
|
|
154
|
+
).slice(0, input.count);
|
|
155
|
+
const pipelineNames = new Set(pipelines.map((pipeline) => pipeline.name));
|
|
156
|
+
return {
|
|
157
|
+
target: "pipelines",
|
|
158
|
+
baseUrl,
|
|
159
|
+
pipelines: pipelines.map((pipeline) => ({
|
|
160
|
+
name: pipeline.name,
|
|
161
|
+
lastUpdatedAt: pipeline.last_updated_timestamp ?? null,
|
|
162
|
+
locked: pipeline.locked,
|
|
163
|
+
paused: pipeline.pause_info.paused,
|
|
164
|
+
runs: pipeline._embedded.instances.map((instance) => ({
|
|
165
|
+
label: instance.label,
|
|
166
|
+
counter: instance.counter,
|
|
167
|
+
scheduledAt: instance.scheduled_at ?? null,
|
|
168
|
+
stages: instance._embedded.stages.map((stage) => ({
|
|
169
|
+
name: stage.name,
|
|
170
|
+
counter: String(stage.counter),
|
|
171
|
+
status: stage.status,
|
|
172
|
+
scheduledAt: stage.scheduled_at ?? null
|
|
173
|
+
}))
|
|
174
|
+
}))
|
|
175
|
+
})),
|
|
176
|
+
environments: body.environments.map(({ name, pipelines: pipelines2 }) => ({
|
|
177
|
+
name,
|
|
178
|
+
pipelines: pipelines2.filter(
|
|
179
|
+
(pipeline) => pipelineNames.has(pipeline)
|
|
180
|
+
)
|
|
181
|
+
})).filter(({ pipelines: pipelines2 }) => pipelines2.length > 0),
|
|
182
|
+
pipelineGroups: body.pipeline_groups.map(({ name, pipelines: pipelines2 }) => ({
|
|
183
|
+
name,
|
|
184
|
+
pipelines: pipelines2.filter(
|
|
185
|
+
(pipeline) => pipelineNames.has(pipeline)
|
|
186
|
+
)
|
|
187
|
+
})).filter(({ pipelines: pipelines2 }) => pipelines2.length > 0)
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/tools/job-history.ts
|
|
194
|
+
import {
|
|
195
|
+
definePluginTool as definePluginTool2,
|
|
196
|
+
pluginToolOutputSchema as pluginToolOutputSchema2
|
|
197
|
+
} from "@sentry/junior-plugin-api";
|
|
198
|
+
import { z as z2 } from "zod";
|
|
199
|
+
var inputSchema2 = z2.object({
|
|
200
|
+
pipeline: z2.string().trim().min(1).describe("Exact GoCD pipeline name."),
|
|
201
|
+
stage: z2.string().trim().min(1).describe("Exact stage name."),
|
|
202
|
+
job: z2.string().trim().min(1).describe("Exact job name."),
|
|
203
|
+
count: z2.number().int().min(1).max(100).default(20)
|
|
204
|
+
}).strict();
|
|
205
|
+
var jobSchema = z2.object({
|
|
206
|
+
name: z2.string(),
|
|
207
|
+
scheduled_date: z2.number().nullable().optional(),
|
|
208
|
+
pipeline_counter: z2.number(),
|
|
209
|
+
rerun: z2.boolean(),
|
|
210
|
+
result: z2.string(),
|
|
211
|
+
state: z2.string(),
|
|
212
|
+
stage_counter: z2.union([z2.string(), z2.number()])
|
|
213
|
+
}).passthrough();
|
|
214
|
+
var bodySchema = z2.object({ jobs: z2.array(jobSchema).default([]) }).passthrough();
|
|
215
|
+
var outputSchema2 = pluginToolOutputSchema2.extend({
|
|
216
|
+
target: z2.literal("job_history"),
|
|
217
|
+
baseUrl: z2.string(),
|
|
218
|
+
pipeline: z2.string(),
|
|
219
|
+
stage: z2.string(),
|
|
220
|
+
job: z2.string(),
|
|
221
|
+
runs: z2.array(
|
|
222
|
+
z2.object({
|
|
223
|
+
pipelineCounter: z2.number(),
|
|
224
|
+
stageCounter: z2.string(),
|
|
225
|
+
scheduledAt: z2.number().nullable(),
|
|
226
|
+
rerun: z2.boolean(),
|
|
227
|
+
result: z2.string(),
|
|
228
|
+
state: z2.string()
|
|
229
|
+
})
|
|
230
|
+
)
|
|
231
|
+
});
|
|
232
|
+
function createGocdJobHistoryTool(ctx, options = {}) {
|
|
233
|
+
return definePluginTool2({
|
|
234
|
+
annotations: {
|
|
235
|
+
destructiveHint: false,
|
|
236
|
+
idempotentHint: true,
|
|
237
|
+
openWorldHint: true,
|
|
238
|
+
readOnlyHint: true
|
|
239
|
+
},
|
|
240
|
+
description: "Fetch recent runs for an exact GoCD job. The result includes counters, timestamps, and results. It excludes agent identifiers and user identities.",
|
|
241
|
+
inputSchema: inputSchema2,
|
|
242
|
+
outputSchema: outputSchema2,
|
|
243
|
+
async execute(input) {
|
|
244
|
+
const baseUrl = resolveGocdBaseUrl(options);
|
|
245
|
+
const pageSize = Math.min(100, Math.max(10, input.count));
|
|
246
|
+
const response = await ctx.egress.fetch({
|
|
247
|
+
operation: "gocd.job.history",
|
|
248
|
+
provider: "gocd",
|
|
249
|
+
request: new Request(
|
|
250
|
+
resolveGocdApiUrl(
|
|
251
|
+
baseUrl,
|
|
252
|
+
`/go/api/jobs/${encodeURIComponent(input.pipeline)}/${encodeURIComponent(input.stage)}/${encodeURIComponent(input.job)}/history?page_size=${pageSize}`
|
|
253
|
+
),
|
|
254
|
+
{
|
|
255
|
+
headers: { Accept: "application/vnd.go.cd.v1+json" },
|
|
256
|
+
method: "GET"
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
});
|
|
260
|
+
if (!response.ok) {
|
|
261
|
+
throwGocdReadError(
|
|
262
|
+
`GoCD job history failed with HTTP ${response.status}`,
|
|
263
|
+
response.status,
|
|
264
|
+
{ missingResourceIsInput: true }
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
const body = bodySchema.parse(await response.json());
|
|
268
|
+
return {
|
|
269
|
+
target: "job_history",
|
|
270
|
+
baseUrl,
|
|
271
|
+
pipeline: input.pipeline,
|
|
272
|
+
stage: input.stage,
|
|
273
|
+
job: input.job,
|
|
274
|
+
runs: body.jobs.slice(0, input.count).map((run) => ({
|
|
275
|
+
pipelineCounter: run.pipeline_counter,
|
|
276
|
+
stageCounter: String(run.stage_counter),
|
|
277
|
+
scheduledAt: run.scheduled_date ?? null,
|
|
278
|
+
rerun: run.rerun,
|
|
279
|
+
result: run.result,
|
|
280
|
+
state: run.state
|
|
281
|
+
}))
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// src/tools/pipeline-history.ts
|
|
288
|
+
import {
|
|
289
|
+
definePluginTool as definePluginTool3,
|
|
290
|
+
pluginToolOutputSchema as pluginToolOutputSchema3
|
|
291
|
+
} from "@sentry/junior-plugin-api";
|
|
292
|
+
import { z as z3 } from "zod";
|
|
293
|
+
var inputSchema3 = z3.object({
|
|
294
|
+
pipeline: z3.string().trim().min(1).describe("Exact GoCD pipeline name."),
|
|
295
|
+
count: z3.number().int().min(1).max(100).default(20)
|
|
296
|
+
}).strict();
|
|
297
|
+
var jobSchema2 = z3.object({
|
|
298
|
+
name: z3.string(),
|
|
299
|
+
result: z3.string().optional(),
|
|
300
|
+
state: z3.string().optional()
|
|
301
|
+
}).passthrough();
|
|
302
|
+
var stageSchema2 = z3.object({
|
|
303
|
+
name: z3.string(),
|
|
304
|
+
counter: z3.union([z3.string(), z3.number()]),
|
|
305
|
+
result: z3.string().optional(),
|
|
306
|
+
status: z3.string().optional(),
|
|
307
|
+
jobs: z3.array(jobSchema2).default([])
|
|
308
|
+
}).passthrough();
|
|
309
|
+
var runSchema = z3.object({
|
|
310
|
+
name: z3.string(),
|
|
311
|
+
counter: z3.number(),
|
|
312
|
+
label: z3.string().optional(),
|
|
313
|
+
scheduled_date: z3.number().nullable().optional(),
|
|
314
|
+
stages: z3.array(stageSchema2).default([])
|
|
315
|
+
}).passthrough();
|
|
316
|
+
var outputSchema3 = pluginToolOutputSchema3.extend({
|
|
317
|
+
target: z3.literal("pipeline_history"),
|
|
318
|
+
baseUrl: z3.string(),
|
|
319
|
+
pipeline: z3.string(),
|
|
320
|
+
runs: z3.array(
|
|
321
|
+
z3.object({
|
|
322
|
+
counter: z3.number(),
|
|
323
|
+
label: z3.string(),
|
|
324
|
+
scheduledAt: z3.number().nullable(),
|
|
325
|
+
stages: z3.array(
|
|
326
|
+
z3.object({
|
|
327
|
+
name: z3.string(),
|
|
328
|
+
counter: z3.string(),
|
|
329
|
+
result: z3.string(),
|
|
330
|
+
status: z3.string(),
|
|
331
|
+
jobs: z3.array(
|
|
332
|
+
z3.object({
|
|
333
|
+
name: z3.string(),
|
|
334
|
+
result: z3.string(),
|
|
335
|
+
state: z3.string()
|
|
336
|
+
})
|
|
337
|
+
)
|
|
338
|
+
})
|
|
339
|
+
)
|
|
340
|
+
})
|
|
341
|
+
)
|
|
342
|
+
});
|
|
343
|
+
function createGocdPipelineHistoryTool(ctx, options = {}) {
|
|
344
|
+
return definePluginTool3({
|
|
345
|
+
annotations: {
|
|
346
|
+
destructiveHint: false,
|
|
347
|
+
idempotentHint: true,
|
|
348
|
+
openWorldHint: true,
|
|
349
|
+
readOnlyHint: true
|
|
350
|
+
},
|
|
351
|
+
description: "Fetch recent runs for an exact GoCD pipeline with stage and job results. The result excludes source material, commit messages, user identities, and environment variables.",
|
|
352
|
+
inputSchema: inputSchema3,
|
|
353
|
+
outputSchema: outputSchema3,
|
|
70
354
|
async execute(input) {
|
|
71
355
|
const baseUrl = resolveGocdBaseUrl(options);
|
|
72
356
|
const pageSize = Math.min(100, Math.max(10, input.count));
|
|
@@ -91,54 +375,247 @@ function createGocdPipelineHistoryTool(ctx, options = {}) {
|
|
|
91
375
|
`GoCD pipeline history failed with HTTP ${response.status}`
|
|
92
376
|
);
|
|
93
377
|
}
|
|
94
|
-
const body =
|
|
378
|
+
const body = z3.object({ pipelines: z3.array(runSchema) }).passthrough().parse(await response.json());
|
|
95
379
|
return {
|
|
96
380
|
baseUrl,
|
|
97
381
|
pipeline: input.pipeline,
|
|
98
|
-
runs: body.pipelines.slice(0, input.count)
|
|
382
|
+
runs: body.pipelines.slice(0, input.count).map((run) => ({
|
|
383
|
+
counter: run.counter,
|
|
384
|
+
label: run.label ?? String(run.counter),
|
|
385
|
+
scheduledAt: run.scheduled_date ?? null,
|
|
386
|
+
stages: run.stages.map((stage) => ({
|
|
387
|
+
name: stage.name,
|
|
388
|
+
counter: String(stage.counter),
|
|
389
|
+
result: stage.result ?? "Unknown",
|
|
390
|
+
status: stage.status ?? "Unknown",
|
|
391
|
+
jobs: stage.jobs.map((job) => ({
|
|
392
|
+
name: job.name,
|
|
393
|
+
result: job.result ?? "Unknown",
|
|
394
|
+
state: job.state ?? "Unknown"
|
|
395
|
+
}))
|
|
396
|
+
}))
|
|
397
|
+
})),
|
|
99
398
|
target: "pipeline_history"
|
|
100
399
|
};
|
|
101
400
|
}
|
|
102
401
|
});
|
|
103
402
|
}
|
|
104
403
|
|
|
404
|
+
// src/tools/pipeline-run.ts
|
|
405
|
+
import {
|
|
406
|
+
definePluginTool as definePluginTool4,
|
|
407
|
+
pluginToolOutputSchema as pluginToolOutputSchema4
|
|
408
|
+
} from "@sentry/junior-plugin-api";
|
|
409
|
+
import { z as z4 } from "zod";
|
|
410
|
+
var inputSchema4 = z4.object({
|
|
411
|
+
pipeline: z4.string().trim().min(1).describe("Exact GoCD pipeline name."),
|
|
412
|
+
pipelineCounter: z4.number().int().min(1).describe("GoCD counter for the pipeline run.")
|
|
413
|
+
}).strict();
|
|
414
|
+
var jobSchema3 = z4.object({
|
|
415
|
+
name: z4.string(),
|
|
416
|
+
result: z4.string().optional(),
|
|
417
|
+
state: z4.string().optional()
|
|
418
|
+
}).passthrough();
|
|
419
|
+
var stageSchema3 = z4.object({
|
|
420
|
+
name: z4.string(),
|
|
421
|
+
counter: z4.union([z4.string(), z4.number()]),
|
|
422
|
+
result: z4.string().optional(),
|
|
423
|
+
status: z4.string().optional(),
|
|
424
|
+
scheduled: z4.boolean().optional(),
|
|
425
|
+
jobs: z4.array(jobSchema3).default([])
|
|
426
|
+
}).passthrough();
|
|
427
|
+
var bodySchema2 = z4.object({
|
|
428
|
+
name: z4.string(),
|
|
429
|
+
counter: z4.number(),
|
|
430
|
+
label: z4.string(),
|
|
431
|
+
scheduled_date: z4.number().nullable().optional(),
|
|
432
|
+
stages: z4.array(stageSchema3).default([])
|
|
433
|
+
}).passthrough();
|
|
434
|
+
var outputSchema4 = pluginToolOutputSchema4.extend({
|
|
435
|
+
target: z4.literal("pipeline_run"),
|
|
436
|
+
baseUrl: z4.string(),
|
|
437
|
+
pipeline: z4.string(),
|
|
438
|
+
pipelineCounter: z4.number(),
|
|
439
|
+
label: z4.string(),
|
|
440
|
+
scheduledAt: z4.number().nullable(),
|
|
441
|
+
stages: z4.array(
|
|
442
|
+
z4.object({
|
|
443
|
+
name: z4.string(),
|
|
444
|
+
counter: z4.string(),
|
|
445
|
+
result: z4.string(),
|
|
446
|
+
status: z4.string(),
|
|
447
|
+
scheduled: z4.boolean(),
|
|
448
|
+
jobs: z4.array(
|
|
449
|
+
z4.object({ name: z4.string(), result: z4.string(), state: z4.string() })
|
|
450
|
+
)
|
|
451
|
+
})
|
|
452
|
+
)
|
|
453
|
+
});
|
|
454
|
+
function createGocdPipelineRunTool(ctx, options = {}) {
|
|
455
|
+
return definePluginTool4({
|
|
456
|
+
annotations: {
|
|
457
|
+
destructiveHint: false,
|
|
458
|
+
idempotentHint: true,
|
|
459
|
+
openWorldHint: true,
|
|
460
|
+
readOnlyHint: true
|
|
461
|
+
},
|
|
462
|
+
description: "Fetch one exact GoCD pipeline run with stage and job results. The result excludes source material, commit messages, user identities, and environment variables.",
|
|
463
|
+
inputSchema: inputSchema4,
|
|
464
|
+
outputSchema: outputSchema4,
|
|
465
|
+
async execute(input) {
|
|
466
|
+
const baseUrl = resolveGocdBaseUrl(options);
|
|
467
|
+
const response = await ctx.egress.fetch({
|
|
468
|
+
operation: "gocd.pipeline.run",
|
|
469
|
+
provider: "gocd",
|
|
470
|
+
request: new Request(
|
|
471
|
+
resolveGocdApiUrl(
|
|
472
|
+
baseUrl,
|
|
473
|
+
`/go/api/pipelines/${encodeURIComponent(input.pipeline)}/${input.pipelineCounter}`
|
|
474
|
+
),
|
|
475
|
+
{
|
|
476
|
+
headers: { Accept: "application/vnd.go.cd.v1+json" },
|
|
477
|
+
method: "GET"
|
|
478
|
+
}
|
|
479
|
+
)
|
|
480
|
+
});
|
|
481
|
+
if (!response.ok) {
|
|
482
|
+
throwGocdReadError(
|
|
483
|
+
`GoCD pipeline run failed with HTTP ${response.status}`,
|
|
484
|
+
response.status,
|
|
485
|
+
{ missingResourceIsInput: true }
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
const body = bodySchema2.parse(await response.json());
|
|
489
|
+
return {
|
|
490
|
+
target: "pipeline_run",
|
|
491
|
+
baseUrl,
|
|
492
|
+
pipeline: body.name,
|
|
493
|
+
pipelineCounter: body.counter,
|
|
494
|
+
label: body.label,
|
|
495
|
+
scheduledAt: body.scheduled_date ?? null,
|
|
496
|
+
stages: body.stages.map((stage) => ({
|
|
497
|
+
name: stage.name,
|
|
498
|
+
counter: String(stage.counter),
|
|
499
|
+
result: stage.result ?? "Unknown",
|
|
500
|
+
status: stage.status ?? "Unknown",
|
|
501
|
+
scheduled: stage.scheduled ?? false,
|
|
502
|
+
jobs: stage.jobs.map((job) => ({
|
|
503
|
+
name: job.name,
|
|
504
|
+
result: job.result ?? "Unknown",
|
|
505
|
+
state: job.state ?? "Unknown"
|
|
506
|
+
}))
|
|
507
|
+
}))
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// src/tools/pipeline-status.ts
|
|
514
|
+
import {
|
|
515
|
+
definePluginTool as definePluginTool5,
|
|
516
|
+
pluginToolOutputSchema as pluginToolOutputSchema5
|
|
517
|
+
} from "@sentry/junior-plugin-api";
|
|
518
|
+
import { z as z5 } from "zod";
|
|
519
|
+
var inputSchema5 = z5.object({
|
|
520
|
+
pipeline: z5.string().trim().min(1).describe("Exact GoCD pipeline name.")
|
|
521
|
+
}).strict();
|
|
522
|
+
var bodySchema3 = z5.object({
|
|
523
|
+
paused: z5.boolean(),
|
|
524
|
+
locked: z5.boolean(),
|
|
525
|
+
schedulable: z5.boolean()
|
|
526
|
+
}).passthrough();
|
|
527
|
+
var outputSchema5 = pluginToolOutputSchema5.extend({
|
|
528
|
+
target: z5.literal("pipeline_status"),
|
|
529
|
+
baseUrl: z5.string(),
|
|
530
|
+
pipeline: z5.string(),
|
|
531
|
+
paused: z5.boolean(),
|
|
532
|
+
locked: z5.boolean(),
|
|
533
|
+
schedulable: z5.boolean()
|
|
534
|
+
});
|
|
535
|
+
function createGocdPipelineStatusTool(ctx, options = {}) {
|
|
536
|
+
return definePluginTool5({
|
|
537
|
+
annotations: {
|
|
538
|
+
destructiveHint: false,
|
|
539
|
+
idempotentHint: true,
|
|
540
|
+
openWorldHint: true,
|
|
541
|
+
readOnlyHint: true
|
|
542
|
+
},
|
|
543
|
+
description: "Check whether an exact GoCD pipeline is paused, locked, and schedulable. The result excludes the pause reason and user identity.",
|
|
544
|
+
inputSchema: inputSchema5,
|
|
545
|
+
outputSchema: outputSchema5,
|
|
546
|
+
async execute(input) {
|
|
547
|
+
const baseUrl = resolveGocdBaseUrl(options);
|
|
548
|
+
const response = await ctx.egress.fetch({
|
|
549
|
+
operation: "gocd.pipeline.status",
|
|
550
|
+
provider: "gocd",
|
|
551
|
+
request: new Request(
|
|
552
|
+
resolveGocdApiUrl(
|
|
553
|
+
baseUrl,
|
|
554
|
+
`/go/api/pipelines/${encodeURIComponent(input.pipeline)}/status`
|
|
555
|
+
),
|
|
556
|
+
{
|
|
557
|
+
headers: { Accept: "application/vnd.go.cd.v1+json" },
|
|
558
|
+
method: "GET"
|
|
559
|
+
}
|
|
560
|
+
)
|
|
561
|
+
});
|
|
562
|
+
if (!response.ok) {
|
|
563
|
+
throwGocdReadError(
|
|
564
|
+
`GoCD pipeline status failed with HTTP ${response.status}`,
|
|
565
|
+
response.status,
|
|
566
|
+
{ missingResourceIsInput: true }
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
const body = bodySchema3.parse(await response.json());
|
|
570
|
+
return {
|
|
571
|
+
target: "pipeline_status",
|
|
572
|
+
baseUrl,
|
|
573
|
+
pipeline: input.pipeline,
|
|
574
|
+
paused: body.paused,
|
|
575
|
+
locked: body.locked,
|
|
576
|
+
schedulable: body.schedulable
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
|
|
105
582
|
// src/tools/stage.ts
|
|
106
583
|
import {
|
|
107
|
-
definePluginTool as
|
|
108
|
-
pluginToolOutputSchema as
|
|
584
|
+
definePluginTool as definePluginTool6,
|
|
585
|
+
pluginToolOutputSchema as pluginToolOutputSchema6
|
|
109
586
|
} from "@sentry/junior-plugin-api";
|
|
110
|
-
import { z as
|
|
111
|
-
var
|
|
112
|
-
pipeline:
|
|
113
|
-
pipelineCounter:
|
|
114
|
-
stage:
|
|
115
|
-
stageCounter:
|
|
587
|
+
import { z as z6 } from "zod";
|
|
588
|
+
var inputSchema6 = z6.object({
|
|
589
|
+
pipeline: z6.string().trim().min(1).describe("Exact GoCD pipeline name."),
|
|
590
|
+
pipelineCounter: z6.number().int().min(1).describe("Pipeline run counter (integer)."),
|
|
591
|
+
stage: z6.string().trim().min(1).describe("Exact stage name."),
|
|
592
|
+
stageCounter: z6.number().int().min(1).describe("Stage run counter (integer).")
|
|
116
593
|
}).strict();
|
|
117
|
-
var
|
|
118
|
-
name:
|
|
119
|
-
result:
|
|
120
|
-
state:
|
|
594
|
+
var jobSchema4 = z6.object({
|
|
595
|
+
name: z6.string(),
|
|
596
|
+
result: z6.string().optional(),
|
|
597
|
+
state: z6.string().optional()
|
|
121
598
|
}).passthrough();
|
|
122
|
-
var stageBodySchema =
|
|
123
|
-
result:
|
|
124
|
-
_embedded:
|
|
599
|
+
var stageBodySchema = z6.object({
|
|
600
|
+
result: z6.string().optional(),
|
|
601
|
+
_embedded: z6.object({ jobs: z6.array(jobSchema4).default([]) })
|
|
125
602
|
}).passthrough();
|
|
126
|
-
var
|
|
127
|
-
target:
|
|
128
|
-
baseUrl:
|
|
129
|
-
link:
|
|
130
|
-
pipeline:
|
|
131
|
-
pipelineCounter:
|
|
132
|
-
stage:
|
|
133
|
-
stageCounter:
|
|
134
|
-
result:
|
|
135
|
-
jobs:
|
|
136
|
-
|
|
603
|
+
var outputSchema6 = pluginToolOutputSchema6.extend({
|
|
604
|
+
target: z6.literal("stage"),
|
|
605
|
+
baseUrl: z6.string(),
|
|
606
|
+
link: z6.string(),
|
|
607
|
+
pipeline: z6.string(),
|
|
608
|
+
pipelineCounter: z6.number(),
|
|
609
|
+
stage: z6.string(),
|
|
610
|
+
stageCounter: z6.number(),
|
|
611
|
+
result: z6.string(),
|
|
612
|
+
jobs: z6.array(
|
|
613
|
+
z6.object({ name: z6.string(), result: z6.string(), state: z6.string() })
|
|
137
614
|
),
|
|
138
|
-
failedJobs:
|
|
615
|
+
failedJobs: z6.array(z6.string())
|
|
139
616
|
});
|
|
140
617
|
function createGocdStageTool(ctx, options = {}) {
|
|
141
|
-
return
|
|
618
|
+
return definePluginTool6({
|
|
142
619
|
annotations: {
|
|
143
620
|
destructiveHint: false,
|
|
144
621
|
idempotentHint: true,
|
|
@@ -146,8 +623,8 @@ function createGocdStageTool(ctx, options = {}) {
|
|
|
146
623
|
readOnlyHint: true
|
|
147
624
|
},
|
|
148
625
|
description: "Fetch one exact GoCD stage run, its jobs, and failed job names. Identify the run with its pipeline name, pipeline counter, stage name, and stage counter.",
|
|
149
|
-
inputSchema:
|
|
150
|
-
outputSchema:
|
|
626
|
+
inputSchema: inputSchema6,
|
|
627
|
+
outputSchema: outputSchema6,
|
|
151
628
|
async execute(input) {
|
|
152
629
|
const baseUrl = resolveGocdBaseUrl(options);
|
|
153
630
|
const path = `/go/api/stages/${encodeURIComponent(input.pipeline)}/${encodeURIComponent(input.stage)}/instance/${input.pipelineCounter}/${input.stageCounter}`;
|
|
@@ -201,13 +678,18 @@ function gocdPlugin(options = {}) {
|
|
|
201
678
|
credentialHooks?.grantForEgress || credentialHooks?.issueCredential
|
|
202
679
|
);
|
|
203
680
|
const manifest = {
|
|
681
|
+
configKeys: ["pipeline"],
|
|
204
682
|
description: "Read GoCD pipeline and stage results",
|
|
205
683
|
displayName: "GoCD",
|
|
206
684
|
envVars: {
|
|
207
685
|
GOCD_ACCESS_TOKEN: {},
|
|
208
686
|
GOCD_URL: {}
|
|
209
687
|
},
|
|
210
|
-
name: "gocd"
|
|
688
|
+
name: "gocd",
|
|
689
|
+
target: {
|
|
690
|
+
configKey: "pipeline",
|
|
691
|
+
type: "pipeline"
|
|
692
|
+
}
|
|
211
693
|
};
|
|
212
694
|
if (hostname) {
|
|
213
695
|
manifest.domains = [hostname];
|
|
@@ -220,7 +702,11 @@ function gocdPlugin(options = {}) {
|
|
|
220
702
|
const hooks = {
|
|
221
703
|
tools(ctx) {
|
|
222
704
|
return {
|
|
705
|
+
pipelines: createGocdPipelinesTool(ctx, options),
|
|
706
|
+
jobHistory: createGocdJobHistoryTool(ctx, options),
|
|
223
707
|
pipelineHistory: createGocdPipelineHistoryTool(ctx, options),
|
|
708
|
+
pipelineRun: createGocdPipelineRunTool(ctx, options),
|
|
709
|
+
pipelineStatus: createGocdPipelineStatusTool(ctx, options),
|
|
224
710
|
stage: createGocdStageTool(ctx, options)
|
|
225
711
|
};
|
|
226
712
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type ToolRegistrationHookContext } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { type GocdPluginOptions } from "../config.js";
|
|
3
|
+
/** Return recent runs for one exact GoCD job. */
|
|
4
|
+
export declare function createGocdJobHistoryTool(ctx: ToolRegistrationHookContext, options?: GocdPluginOptions): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
5
|
+
pipeline: string;
|
|
6
|
+
stage: string;
|
|
7
|
+
job: string;
|
|
8
|
+
count: number;
|
|
9
|
+
}, {
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
target: "job_history";
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
pipeline: string;
|
|
14
|
+
stage: string;
|
|
15
|
+
job: string;
|
|
16
|
+
runs: {
|
|
17
|
+
pipelineCounter: number;
|
|
18
|
+
stageCounter: string;
|
|
19
|
+
scheduledAt: number | null;
|
|
20
|
+
rerun: boolean;
|
|
21
|
+
result: string;
|
|
22
|
+
state: string;
|
|
23
|
+
}[];
|
|
24
|
+
truncated?: boolean | undefined;
|
|
25
|
+
continuation?: {
|
|
26
|
+
arguments: Record<string, unknown>;
|
|
27
|
+
reason?: string | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
[x: string]: unknown;
|
|
31
|
+
target: "job_history";
|
|
32
|
+
baseUrl: string;
|
|
33
|
+
pipeline: string;
|
|
34
|
+
stage: string;
|
|
35
|
+
job: string;
|
|
36
|
+
runs: {
|
|
37
|
+
pipelineCounter: number;
|
|
38
|
+
stageCounter: string;
|
|
39
|
+
scheduledAt: number | null;
|
|
40
|
+
rerun: boolean;
|
|
41
|
+
result: string;
|
|
42
|
+
state: string;
|
|
43
|
+
}[];
|
|
44
|
+
truncated?: boolean | undefined;
|
|
45
|
+
continuation?: {
|
|
46
|
+
arguments: Record<string, unknown>;
|
|
47
|
+
reason?: string | undefined;
|
|
48
|
+
} | undefined;
|
|
49
|
+
}>;
|
|
50
|
+
//# sourceMappingURL=job-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job-history.d.ts","sourceRoot":"","sources":["../../src/tools/job-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAgDtB,iDAAiD;AACjD,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,2BAA2B,EAChC,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DhC"}
|
|
@@ -14,7 +14,22 @@ export declare function createGocdPipelineHistoryTool(ctx: ToolRegistrationHookC
|
|
|
14
14
|
target: "pipeline_history";
|
|
15
15
|
baseUrl: string;
|
|
16
16
|
pipeline: string;
|
|
17
|
-
runs:
|
|
17
|
+
runs: {
|
|
18
|
+
counter: number;
|
|
19
|
+
label: string;
|
|
20
|
+
scheduledAt: number | null;
|
|
21
|
+
stages: {
|
|
22
|
+
name: string;
|
|
23
|
+
counter: string;
|
|
24
|
+
result: string;
|
|
25
|
+
status: string;
|
|
26
|
+
jobs: {
|
|
27
|
+
name: string;
|
|
28
|
+
result: string;
|
|
29
|
+
state: string;
|
|
30
|
+
}[];
|
|
31
|
+
}[];
|
|
32
|
+
}[];
|
|
18
33
|
truncated?: boolean | undefined;
|
|
19
34
|
continuation?: {
|
|
20
35
|
arguments: Record<string, unknown>;
|
|
@@ -25,7 +40,22 @@ export declare function createGocdPipelineHistoryTool(ctx: ToolRegistrationHookC
|
|
|
25
40
|
target: "pipeline_history";
|
|
26
41
|
baseUrl: string;
|
|
27
42
|
pipeline: string;
|
|
28
|
-
runs:
|
|
43
|
+
runs: {
|
|
44
|
+
counter: number;
|
|
45
|
+
label: string;
|
|
46
|
+
scheduledAt: number | null;
|
|
47
|
+
stages: {
|
|
48
|
+
name: string;
|
|
49
|
+
counter: string;
|
|
50
|
+
result: string;
|
|
51
|
+
status: string;
|
|
52
|
+
jobs: {
|
|
53
|
+
name: string;
|
|
54
|
+
result: string;
|
|
55
|
+
state: string;
|
|
56
|
+
}[];
|
|
57
|
+
}[];
|
|
58
|
+
}[];
|
|
29
59
|
truncated?: boolean | undefined;
|
|
30
60
|
continuation?: {
|
|
31
61
|
arguments: Record<string, unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-history.d.ts","sourceRoot":"","sources":["../../src/tools/pipeline-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline-history.d.ts","sourceRoot":"","sources":["../../src/tools/pipeline-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAmEtB;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,2BAA2B,EAChC,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEhC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type ToolRegistrationHookContext } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { type GocdPluginOptions } from "../config.js";
|
|
3
|
+
/** Return the operational state for one exact GoCD pipeline run. */
|
|
4
|
+
export declare function createGocdPipelineRunTool(ctx: ToolRegistrationHookContext, options?: GocdPluginOptions): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
5
|
+
pipeline: string;
|
|
6
|
+
pipelineCounter: number;
|
|
7
|
+
}, {
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
target: "pipeline_run";
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
pipeline: string;
|
|
12
|
+
pipelineCounter: number;
|
|
13
|
+
label: string;
|
|
14
|
+
scheduledAt: number | null;
|
|
15
|
+
stages: {
|
|
16
|
+
name: string;
|
|
17
|
+
counter: string;
|
|
18
|
+
result: string;
|
|
19
|
+
status: string;
|
|
20
|
+
scheduled: boolean;
|
|
21
|
+
jobs: {
|
|
22
|
+
name: string;
|
|
23
|
+
result: string;
|
|
24
|
+
state: string;
|
|
25
|
+
}[];
|
|
26
|
+
}[];
|
|
27
|
+
truncated?: boolean | undefined;
|
|
28
|
+
continuation?: {
|
|
29
|
+
arguments: Record<string, unknown>;
|
|
30
|
+
reason?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
[x: string]: unknown;
|
|
34
|
+
target: "pipeline_run";
|
|
35
|
+
baseUrl: string;
|
|
36
|
+
pipeline: string;
|
|
37
|
+
pipelineCounter: number;
|
|
38
|
+
label: string;
|
|
39
|
+
scheduledAt: number | null;
|
|
40
|
+
stages: {
|
|
41
|
+
name: string;
|
|
42
|
+
counter: string;
|
|
43
|
+
result: string;
|
|
44
|
+
status: string;
|
|
45
|
+
scheduled: boolean;
|
|
46
|
+
jobs: {
|
|
47
|
+
name: string;
|
|
48
|
+
result: string;
|
|
49
|
+
state: string;
|
|
50
|
+
}[];
|
|
51
|
+
}[];
|
|
52
|
+
truncated?: boolean | undefined;
|
|
53
|
+
continuation?: {
|
|
54
|
+
arguments: Record<string, unknown>;
|
|
55
|
+
reason?: string | undefined;
|
|
56
|
+
} | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
//# sourceMappingURL=pipeline-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-run.d.ts","sourceRoot":"","sources":["../../src/tools/pipeline-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAkEtB,oEAAoE;AACpE,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,2BAA2B,EAChC,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DhC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ToolRegistrationHookContext } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { type GocdPluginOptions } from "../config.js";
|
|
3
|
+
/** Return the current state for one GoCD pipeline. */
|
|
4
|
+
export declare function createGocdPipelineStatusTool(ctx: ToolRegistrationHookContext, options?: GocdPluginOptions): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
5
|
+
pipeline: string;
|
|
6
|
+
}, {
|
|
7
|
+
[x: string]: unknown;
|
|
8
|
+
target: "pipeline_status";
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
pipeline: string;
|
|
11
|
+
paused: boolean;
|
|
12
|
+
locked: boolean;
|
|
13
|
+
schedulable: boolean;
|
|
14
|
+
truncated?: boolean | undefined;
|
|
15
|
+
continuation?: {
|
|
16
|
+
arguments: Record<string, unknown>;
|
|
17
|
+
reason?: string | undefined;
|
|
18
|
+
} | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
[x: string]: unknown;
|
|
21
|
+
target: "pipeline_status";
|
|
22
|
+
baseUrl: string;
|
|
23
|
+
pipeline: string;
|
|
24
|
+
paused: boolean;
|
|
25
|
+
locked: boolean;
|
|
26
|
+
schedulable: boolean;
|
|
27
|
+
truncated?: boolean | undefined;
|
|
28
|
+
continuation?: {
|
|
29
|
+
arguments: Record<string, unknown>;
|
|
30
|
+
reason?: string | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=pipeline-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline-status.d.ts","sourceRoot":"","sources":["../../src/tools/pipeline-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AA4BtB,sDAAsD;AACtD,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,2BAA2B,EAChC,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+ChC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { type ToolRegistrationHookContext } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { type GocdPluginOptions } from "../config.js";
|
|
3
|
+
/** Return the pipelines visible to the current GoCD user with recent run state. */
|
|
4
|
+
export declare function createGocdPipelinesTool(ctx: ToolRegistrationHookContext, options?: GocdPluginOptions): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
5
|
+
count: number;
|
|
6
|
+
query?: string | undefined;
|
|
7
|
+
}, {
|
|
8
|
+
[x: string]: unknown;
|
|
9
|
+
target: "pipelines";
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
pipelines: {
|
|
12
|
+
name: string;
|
|
13
|
+
lastUpdatedAt: number | null;
|
|
14
|
+
locked: boolean;
|
|
15
|
+
paused: boolean;
|
|
16
|
+
runs: {
|
|
17
|
+
label: string;
|
|
18
|
+
counter: number;
|
|
19
|
+
scheduledAt: string | null;
|
|
20
|
+
stages: {
|
|
21
|
+
name: string;
|
|
22
|
+
counter: string;
|
|
23
|
+
status: string;
|
|
24
|
+
scheduledAt: string | null;
|
|
25
|
+
}[];
|
|
26
|
+
}[];
|
|
27
|
+
}[];
|
|
28
|
+
environments: {
|
|
29
|
+
[x: string]: unknown;
|
|
30
|
+
name: string;
|
|
31
|
+
pipelines: string[];
|
|
32
|
+
}[];
|
|
33
|
+
pipelineGroups: {
|
|
34
|
+
[x: string]: unknown;
|
|
35
|
+
name: string;
|
|
36
|
+
pipelines: string[];
|
|
37
|
+
}[];
|
|
38
|
+
truncated?: boolean | undefined;
|
|
39
|
+
continuation?: {
|
|
40
|
+
arguments: Record<string, unknown>;
|
|
41
|
+
reason?: string | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
}, {
|
|
44
|
+
[x: string]: unknown;
|
|
45
|
+
target: "pipelines";
|
|
46
|
+
baseUrl: string;
|
|
47
|
+
pipelines: {
|
|
48
|
+
name: string;
|
|
49
|
+
lastUpdatedAt: number | null;
|
|
50
|
+
locked: boolean;
|
|
51
|
+
paused: boolean;
|
|
52
|
+
runs: {
|
|
53
|
+
label: string;
|
|
54
|
+
counter: number;
|
|
55
|
+
scheduledAt: string | null;
|
|
56
|
+
stages: {
|
|
57
|
+
name: string;
|
|
58
|
+
counter: string;
|
|
59
|
+
status: string;
|
|
60
|
+
scheduledAt: string | null;
|
|
61
|
+
}[];
|
|
62
|
+
}[];
|
|
63
|
+
}[];
|
|
64
|
+
environments: {
|
|
65
|
+
[x: string]: unknown;
|
|
66
|
+
name: string;
|
|
67
|
+
pipelines: string[];
|
|
68
|
+
}[];
|
|
69
|
+
pipelineGroups: {
|
|
70
|
+
[x: string]: unknown;
|
|
71
|
+
name: string;
|
|
72
|
+
pipelines: string[];
|
|
73
|
+
}[];
|
|
74
|
+
truncated?: boolean | undefined;
|
|
75
|
+
continuation?: {
|
|
76
|
+
arguments: Record<string, unknown>;
|
|
77
|
+
reason?: string | undefined;
|
|
78
|
+
} | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
//# sourceMappingURL=pipelines.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipelines.d.ts","sourceRoot":"","sources":["../../src/tools/pipelines.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AA2FtB,mFAAmF;AACnF,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,2BAA2B,EAChC,OAAO,GAAE,iBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EhC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-gocd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.190.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"zod": "^4.4.3",
|
|
26
|
-
"@sentry/junior-plugin-api": "0.
|
|
26
|
+
"@sentry/junior-plugin-api": "0.190.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/node": "^25.9.1",
|
package/skills/gocd/SKILL.md
CHANGED
|
@@ -10,8 +10,6 @@ Use the GoCD tools for current pipeline and stage data.
|
|
|
10
10
|
## Rules
|
|
11
11
|
|
|
12
12
|
- Treat GoCD access as read-only.
|
|
13
|
-
- Use the
|
|
14
|
-
- Use `
|
|
15
|
-
- Use
|
|
16
|
-
- Do not claim that pipeline history includes console logs.
|
|
17
|
-
- If a request fails, state whether GoCD rejected it or the app lacks a base URL or credentials.
|
|
13
|
+
- Use the configured pipeline when the user does not name one.
|
|
14
|
+
- Use `pipelines` to find pipeline names and `pipelineHistory` for recent runs.
|
|
15
|
+
- Use the narrower run, stage, status, or job tool when the request needs it.
|