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

Task fails to update using deployment approvals #124

Closed alhardy closed 1 year ago

alhardy commented 1 year ago

Describe the bug Error running pulumi as azure devops pipeline deployment, but works a a task.

Error I'm getting is ##[error]Error: There was an error when attempting to execute the process '/home/vsts/work/_temp/fcb56bad-72b5-4c6a-94ad-47b1c9a55eeb/pulumi/pulumi'. This may indicate the process failed to start. Error: spawn /home/vsts/work/_temp/fcb56bad-72b5-4c6a-94ad-47b1c9a55eeb/pulumi/pulumi ENOENT

To Reproduce Steps to reproduce the behavior:

Create pipeline as follows and run on azure devops, results in the above error on approval after preview.

variables:
  - group: pulumi

trigger:
  branches:
    include:
      - main
  paths:
    include:
      - pipelines/cd.yaml
      - src/project
pr:
  drafts: false
  branches:
    include:
      - main
  paths:
    include:
      - pipelines/cd.yaml
      - src/project

pool:
  vmImage: ubuntu-latest

resources:
  - repo: self

stages:
  - stage: preview
    displayName: Preview Infrastructure Changes
    jobs:
      - job: Preview
        steps:
          - task: Pulumi@1
            displayName: pulumi preview
            inputs:
              azureSubscription: 'sub'
              command: 'preview'
              cwd: 'src/project/'
              stack: 'org/project/prod'
              createStack: true
  - stage: deploy
    displayName: Production - Deploy Infrastructure Changes
    jobs:
      - deployment: Deploy
        environment: Production
        strategy:
          runOnce:
            deploy:
              steps:
                - task: Pulumi@1
                  displayName: pulumi up --yes
                  inputs:
                    azureSubscription: 'sub'
                    command: 'up'
                    cwd: 'src/project/'
                    stack: 'org/project/prod'
                    args: '--yes'

Expected behavior Pulumi up is applied. If running up as a step like preview in the example everything works fine, however I would like an approval gate on update.

Frassle commented 1 year ago

Looks like this is the same issue as https://github.com/pulumi/pulumi-az-pipelines-task/issues/91. Comment there suggests a workaround is to clone the source repo first, although not clear how that would help fix the enoent for pulumi itself. At any rate I'll close this as a duplicate, if you could test the suggesting in #91 and message back there.

alhardy commented 1 year ago

My workaround was to create a separate task for the approval, not using deployment. This works fine for me. Cheers