Skip to content

Commit dbd6372

Browse files
authored
[phase 2-4: CICD] adding the post process job for cancellation. [yet to check the issues with core.] (#111)
* phase2 changes for app components and server metricss config. * [phase3: CICD] adding over-ride params and outputVar support in the PipleineYaml. * [phase4: CICD] adding the post process job for cancellation.
1 parent 45ebea8 commit dbd6372

37 files changed

+4001
-256
lines changed

.github/workflows/pr_check_load_test.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ jobs:
5353
run: |
5454
npm install --include=dev -f
5555
npm ci
56-
npm install typescript -g
57-
tsc
58-
# (note:mohit) - generally typescript is ignored somehow in the installation and now we want to ignore the js files for main branch hence we need tsc and npm install seperately.
56+
5957
- name: Azure authentication
6058
uses: azure/login@v1
6159
continue-on-error: false
@@ -73,23 +71,21 @@ jobs:
7371
echo "::set-output name=GUID::$(uuidgen)"
7472
fi
7573
shell : bash
76-
77-
- name: Set up testName
78-
shell: bash
79-
run: |
80-
# copying the files to a new file and editing the testId for each file in the copied file.
81-
# replacing 'testId'(the thing present in the file.) with the new testId ('${{ steps.guid.outputs.GUID }}') in the copied file.
82-
cp ${{ matrix.configFile }} test-config-${{ steps.guid.outputs.GUID }}.yaml
83-
sed -i 's/testId/${{ steps.guid.outputs.GUID }}/g' test-config-${{ steps.guid.outputs.GUID }}.yaml
84-
74+
8575
- name: 'Azure Load Testing'
8676
uses: ./
77+
id: alt
8778
with:
88-
loadTestConfigFile: test-config-${{ steps.guid.outputs.GUID }}.yaml
79+
loadTestConfigFile: ${{ matrix.configFile }}
8980
loadTestResource: ${{ env.LOAD_TEST_RESOURCE }}
9081
resourceGroup: ${{ env.LOAD_TEST_RESOURCE_GROUP }}
82+
overRideParameters: "{\"testId\":\"${{ steps.guid.outputs.GUID }}\"}"
83+
outputVariableName: 'loadTestRunId'
9184
continue-on-error: true
9285

86+
- name: Print the Output
87+
run: echo "The Test ID is ${{ steps.alt.outputs['loadTestRunId.testRunId'] }}"
88+
9389
- name: Check for results and report files
9490
run: |
9591
if [[ -d "./loadTest" ]]; then

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,4 +334,3 @@ node_modules/
334334
.vscode
335335
TmpFiles
336336
loadTest
337-
lib

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,17 @@ inputs:
2222
env:
2323
description: 'Enter env in JSON'
2424
required: false
25+
overrideParameters:
26+
description: 'Override parameters in the YAML config file using the JSON format with testId, displayName, description, engineInstances, autoStop supported.'
27+
required: false
28+
outputVariableName:
29+
description: 'Name of the output variable that stores the test run ID for use in subsequent tasks.'
30+
required: false
31+
2532
branding:
2633
icon: 'extension-icon.svg'
2734
color: 'blue'
2835
runs:
2936
using: 'node20'
3037
main: 'lib/main.js'
38+
post: 'lib/postProcessJob.js'

lib/main.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14+
Object.defineProperty(o, "default", { enumerable: true, value: v });
15+
}) : function(o, v) {
16+
o["default"] = v;
17+
});
18+
var __importStar = (this && this.__importStar) || function (mod) {
19+
if (mod && mod.__esModule) return mod;
20+
var result = {};
21+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22+
__setModuleDefault(result, mod);
23+
return result;
24+
};
25+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27+
return new (P || (P = Promise))(function (resolve, reject) {
28+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31+
step((generator = generator.apply(thisArg, _arguments || [])).next());
32+
});
33+
};
34+
Object.defineProperty(exports, "__esModule", { value: true });
35+
const util = __importStar(require("./models/FileUtils"));
36+
const UtilModels_1 = require("./models/UtilModels");
37+
const fs = __importStar(require("fs"));
38+
const core = __importStar(require("@actions/core"));
39+
const AuthenticationUtils_1 = require("./models/AuthenticationUtils");
40+
const TaskModels_1 = require("./models/TaskModels");
41+
const APISupport_1 = require("./models/APISupport");
42+
function run() {
43+
return __awaiter(this, void 0, void 0, function* () {
44+
try {
45+
let authContext = new AuthenticationUtils_1.AuthenticationUtils();
46+
let yamlConfig = new TaskModels_1.YamlConfig();
47+
let apiSupport = new APISupport_1.APISupport(authContext, yamlConfig);
48+
yield authContext.authorize();
49+
yield apiSupport.getResource();
50+
core.exportVariable(UtilModels_1.PostTaskParameters.baseUri, apiSupport.baseURL);
51+
yield apiSupport.getTestAPI(false);
52+
if (fs.existsSync(UtilModels_1.resultFolder)) {
53+
util.deleteFile(UtilModels_1.resultFolder);
54+
}
55+
fs.mkdirSync(UtilModels_1.resultFolder);
56+
yield apiSupport.createTestAPI();
57+
let outputVar = {
58+
testRunId: yamlConfig.runTimeParams.testRunId
59+
};
60+
core.setOutput(`${yamlConfig.outputVariableName}.${UtilModels_1.OutPutVariablesConstants.testRunId}`, outputVar.testRunId);
61+
}
62+
catch (err) {
63+
core.setFailed(err.message);
64+
}
65+
});
66+
}
67+
run();

lib/models/APIResponseModel.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });

0 commit comments

Comments
 (0)