{
  "$type": "site.standard.document",
  "canonicalUrl": "https://johnnyreilly.com/posts/azure-pipelines-task-lib-and-isoutput-setvariable",
  "description": "This is a workaround for custom Azure Pipelines task extension to output variable since the library does not support \"isOutput=true.\"",
  "path": "/posts/azure-pipelines-task-lib-and-isoutput-setvariable",
  "publishedAt": "2020-12-09T00:00:00.000Z",
  "site": "at://did:plc:yy3apqjlms24kso7ahn7lbmb/site.standard.publication/3mova7c4nho2b",
  "tags": [
    "azure pipelines"
  ],
  "textContent": "Some blog posts are insightful treatises on the future of web development, some are \"here's how I solved my problem\". This is most assuredly the latter.\n\nI'm writing an custom pipelines task extension for Azure Pipelines. It's written with TypeScript and the azure-pipelines-task-lib.\n\n\n\nThe pipeline needs to output a variable. Azure Pipelines does that using the setvariable command combined with isOutput=true. This looks something like this: ##vso[task.setvariable variable=myOutputVar;isOutput=true]this is the value\".\n\nThe bad news is that the lib doesn't presently support isOutput=true. Gosh it makes me sad. Hopefully in future it will be resolved. But what now?\n\nFor now we can hack ourselves a workaround:\n\nThe above is effectively a wrapper for the existing setVariable. However, once it's called into the initial implementation, setOutputVariable then writes out the same variable once more, but this time bolting on isOutput=true.\n\nFinally, I've raised a PR to see if isOutput can be added directly to the library. You can track progress on that here.",
  "title": "azure-pipelines-task-lib and isOutput setVariable"
}