pulumi / pulumi-az-pipelines-task

Azure Pipelines task extension for running Pulumi apps.
https://marketplace.visualstudio.com/publishers/pulumi
Apache License 2.0
27 stars 19 forks source link

Pulumi extension task fails when ran as part of a deployment #91

Closed tap1992 closed 1 year ago

tap1992 commented 2 years ago

Describe the bug

Using the Pulumi Azure DevOps extension's task within a deployment job it fails with the below error. If i copy and paste the same task into a normal job it works perfectly fine.

[error]Error: There was an error when attempting to execute the process '/__w/_temp/c0162cb7-b00c-44f7-a09c-82bb8eefcc6a/pulumi/pulumi'. This may indicate the process failed to start. Error: spawn /__w/_temp/c0162cb7-b00c-44f7-a09c-82bb8eefcc6a/pulumi/pulumi ENOENT

To Reproduce

Using YAML pipelines, use a normal job with steps and utilise the pulumi task as shown below: jobs:

It should work as normal. If we use the deployment version of a job as per below it will fail:

Expected behavior

Pulumi preview should run and generate the output in logs.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

praneetloke commented 2 years ago

It seems that you will need to include a step to checkout the source code in your deployment job since they do not automatically clone the source repo. See https://docs.microsoft.com/en-us/azure/devops/pipelines/process/deployment-jobs?view=azure-devops.

A deployment job doesn't automatically clone the source repo. You can checkout the source repo within your job with checkout: self. Deployment jobs only support one checkout step.

deploy:
  steps:
    # Add this step before running Pulumi.
    - checkout: self

    - task: Pulumi@1
      inputs:
        azureSubscription: ***
        command: 'preview'
        cwd: ''
        stack: ''
        args: '--diff'
        loginArgs: azblob://***
praneetloke commented 2 years ago

@tap1992 are you still encountering a problem using the task extension?

MartynFewtrell commented 1 year ago

Thanks All - Adding the "- checkout: self" fixed it!