Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions task/precodesigning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ async function run(): Promise<void> {
let secureFileHelper: sec.SecureFileDownloader = new sec.SecureFileDownloader();
try {
tl.setResourcePath(path.join(__dirname, "task.json"));

let secureFilePath: string;
let secureFileLocation: string = tl.getInput("secureFileLocation", true);
if (secureFileLocation == "azure") {
secureFileId = tl.getInput("secureFileId", true);
secureFilePath = await secureFileHelper.downloadSecureFile(secureFileId);
}
else if (secureFileLocation == "filepath")
secureFilePath = tl.getInput("secureFileLocalPath", true);
else
throw "The configured secure file location is invalid."

secureFileId = tl.getInput("secureFileId", true);
let secureFilePath: string = await secureFileHelper.downloadSecureFile(secureFileId);
tl.setTaskVariable("SECURE_FILE_PATH", secureFilePath);
} catch (err) {
tl.setResult(tl.TaskResult.Failed, err);
Expand Down
24 changes: 23 additions & 1 deletion task/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,36 @@
"minimumAgentVersion": "2.116.0",
"instanceNameFormat": "Code Signing $(filePath)",
"inputs": [
{
"name": "secureFileLocation",
"type": "radio",
"label": "Secure File Location",
"helpMarkDown": "Indicates where the secure file is located. Certificate can either be retrieved from the project's secure files library or a specific filesystem path on the build machine.",
"required": true,
"defaultValue": "azure",
"options": {
"azure": "Azure secure files library",
"filepath": "Local filepath"
}
},
{
"name": "secureFileId",
"type": "secureFile",
"label": "Secure File",
"defaultValue": "",
"required": true,
"required": false,
"visibleRule": "secureFileLocation = azure",
"helpMarkDown": "Select the certificate that was uploaded to `Secure Files` to be used to sign the given files."
},
{
"name": "secureFileLocalPath",
"type": "string",
"label": "Secure File Path",
"defaultValue": "",
"required": false,
"visibleRule": "secureFileLocation = filepath",
"helpMarkDown": "Enter the filepath of the certificate to be used to sign the given files."
},
{
"name": "signCertPassword",
"type": "string",
Expand Down