-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
run.ts
38 lines (31 loc) · 1.06 KB
/
run.ts
1
2
3
4
5
6
7
8
9
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
"use strict";
import * as path from 'path';
import * as tl from 'azure-pipelines-task-lib/task';
import * as utils from './utils/utilities';
import { deploy } from './deploy';
import { DockerConnection } from './dockerConnection';
import { CommandHelper } from './utils/commandHelper';
tl.setResourcePath(path.join(__dirname, "..", 'task.json'));
let telemetry = {
jobId: tl.getVariable('SYSTEM_JOBID')
};
console.log("##vso[telemetry.publish area=%s;feature=%s]%s",
"TaskEndpointId",
"AzureFunctionOnKubernetesV0",
JSON.stringify(telemetry));
async function run() {
const commandHelper = new CommandHelper();
const dockerConnection = new DockerConnection();
const kubernetesConnection = utils.getKubernetesConnection();
dockerConnection.open();
kubernetesConnection.open();
try {
await deploy(commandHelper, dockerConnection);
}
finally {
kubernetesConnection.close();
dockerConnection.close();
}
}
run()
.catch((error) => tl.setResult(tl.TaskResult.Failed, !!error.message ? error.message : error));