Skip to content

Commit 01c3f43

Browse files
committed
updated the api version the action uses
. .
1 parent 8d90c1a commit 01c3f43

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,30 @@ spec:
143143
ui:options:
144144
allowedHosts:
145145
- dev.azure.com
146+
- title: Choose Pipeline Parameters
147+
description: Please select some pipeline parameters
148+
properties:
149+
pipelineParameters:
150+
title: Pipeline Parameters
151+
type: object
152+
properties:
153+
name:
154+
type: string
155+
id:
156+
type: number
157+
- title: Choose Pipeline Variables
158+
description: Please select some pipeline variables
159+
properties:
160+
pipelineParameters:
161+
title: Pipeline Variables
162+
type: object
163+
properties:
164+
name:
165+
type: string
166+
id:
167+
type: number
168+
169+
***note these properties for parameters and variables are just examples, you can use whatever key values that your pipeline will accept@!"
146170

147171
steps:
148172
- id: fetch

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@parfuemerie-douglas/scaffolder-backend-module-azure-pipelines",
3-
"version": "1.0.0-next.1",
3+
"version": "1.0.0-next.3",
44
"description": "A collection of Backstage scaffolder backend modules for Azure pipelines.",
55
"main": "dist/index.cjs.js",
66
"types": "dist/index.d.ts",

src/actions/run/runAzurePipeline.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ interface RunPipelineRequest {
3434
templateParameters?: {
3535
[key: string]: string;
3636
};
37-
variables?: {
38-
[key: string]: string;
39-
};
37+
variables?: string;
4038
yamlOverrides?: string;
4139
}
4240

@@ -161,6 +159,8 @@ export const runAzurePipelineAction = (options: {
161159
const token = ctx.input.token ?? integrationConfig.config.token!;
162160

163161
ctx.logger.info(`Running Azure pipeline with the ID ${pipelineId}.`);
162+
163+
const variablesString = JSON.stringify(pipelineVariables)
164164

165165
const request: RunPipelineRequest = {
166166
resources: {
@@ -171,16 +171,19 @@ export const runAzurePipelineAction = (options: {
171171
},
172172
},
173173
templateParameters: pipelineParameters as Record<string, string>,
174-
variables: pipelineVariables as Record<string, string>,
175174
yamlOverrides: "",
176175
};
177176

177+
if (variablesString !== null) {
178+
request.variables = variablesString;
179+
}
180+
178181
const body = JSON.stringify(request);
179182

180183
// See the Azure DevOps documentation for more information about the REST API:
181-
// https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run-pipeline?view=azure-devops-rest-6.1
184+
// https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/runs/run-pipeline?view=azure-devops-rest-7.0
182185
await fetch(
183-
`https://${host}/${organization}/${project}/_apis/pipelines/${pipelineId}/runs?api-version=6.1-preview.1`,
186+
`https://${host}/${organization}/${project}/_apis/pipelines/${pipelineId}/runs?api-version=7.0`,
184187
{
185188
method: "POST",
186189
headers: {

0 commit comments

Comments
 (0)