I would like to create an Azure Devops task based on a console app I have created. The task should run on a Linux build agent, but I have no idea about how to get started.
Has anyone else done some things similar already?
I would like to create an Azure Devops task based on a console app I have created. The task should run on a Linux build agent, but I have no idea about how to get started.
Has anyone else done some things similar already?
azure devops task is based on Node.js
from the following articles
you can know much about create a task.
The SDK of azure devops task is Node. Maybe,You can combo the DotNetCoreInstaller and Github and other tasks. But, the enviroment is Node.js
The easyest way is use Node.js.
There is no direct task handler for .NET core. In order to make a cross platform task, you'll therefore need to create a small typescript project that uses the azure-pipelines-task-lib to call your executable.
I've got a very simple extension which packages an executable here, which can serve as an example of the extension structure:
https://github.com/jessehouwing/azure-pipelines-agent-screenshot
You'll need to change the following things:
A very simple task that runs ping.exe
based on Typescript can be found here:
https://github.com/jessehouwing/azure-pipelines-demo-ping-task/blob/master/PingTask/ping.ts
The simplest form would look like this:
import tl = require('azure-pipelines-task-lib/task');
import trm = require('azure-pipelines-task-lib/toolrunner');
import { chmodSync } from "fs";
async function run() {
try {
let echoPath = tl.which('ping');
if (!isWindows) {
chmodSync(echoPath, "777");
}
let ping = tl.tool(echoPath);
let result: number = await ping.exec();
}
catch (err) {
tl.setResult(tl.TaskResult.Failed, err.message);
}
}
void run();
All the basic steps to get your task bootstrapped are here:
Publishing a task to the marketplace is explained here: