n3wt0n / AzurePipelinesDecoratorSamples

A series of sample Decorators for Azure Pipelines (Build and Release), plus some more Advanced ones

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HELP WANTED: Additional files in package.

dsfrederic opened this issue · comments

Hello,

I'm having issues adding additional files in my extension.

Folder content

    application-insights-decorator.yaml
    application-insights-trace.ps1
    cgk-ds.applicationinsightsdecorator-0.0.10.vsix
    Microsoft.ApplicationInsights.dll
    package-lock.json
    package.json
    vss-extension.json

vss-extension.json

{
    "manifestVersion": 1,
    "id": "applicationinsightsdecorator",
    "name": "Application Insights pipeline decorator",
    "version": "0.0.13",
    "publisher": "cgk-ds",
    "targets": [
        {
            "id": "Microsoft.VisualStudio.Services"
        }
    ],    
    "description": "This is pipeline decorator will send some telemetry to our application insights. ",
    "categories": [
        "Azure Pipelines"
    ],
    "contributions": [
        {
            "id": "my-required-task",
            "type": "ms.azure-pipelines.pipeline-decorator",
            "targets": [
                "ms.azure-pipelines-agent-job.pre-job-tasks", 
                "ms.azure-pipelines-agent-job.post-job-tasks"
            ],
            "properties": {
                "template": "application-insights-decorator.yaml"
            }
        }
    ],
    "files": [
        {
            "path": "application-insights-decorator.yaml",
            "addressable": true,
            "contentType": "text/plain"
        }, 
        {
            "path": "application-insights-trace.ps1",
            "addressable": true
        }, 
        {
            "path": "Microsoft.ApplicationInsights.dll",
            "addressable": true
        }
    ]
}

The yaml file is referencing the PS script as followed

steps:
- task: PowerShell@2
  inputs: 
    targetType: inline
    script: tree /F $(Pipeline.Workspace)

- task: PowerShell@2
  inputs: 
    targetType: filePath
    filePath: ./application-insights-trace.ps1

PS: I tried to look for this file on my agent. But it doesn't seem to be present. But that has probably something to do with how packages are being handled.

Can you help me along please?

Hey, sorry for the very long delay, somehow this slipped through, and I've missed it...

AFAIK it is not possible to include additional files with a decorator, that is why you can't find those files.

To be able to achieve what you are trying to, you could:

  • create a Custom Task with your powershell etc, add it to your instance, and then use that one in the decorator, or
  • host that PS file in a "central" repo, and checkout that repo as part of the actions you perform in the decorator