https://pulumi.com logo
Title
r

rhythmic-activity-46295

04/21/2021, 7:50 PM
hi, on azure devops pipelines, I somehow have pulumi installed on the agent, but would like to upgrade to version 3.0.0, when I tried to just install it and update the $PATH, it is not recognising the version have installed but rather going back to the other version already in the $PATH... question, how to remove that other path from the system paths variable, or , completely uninstalling pulumi prior from installing new version? this is the bash script I'm using - bash: |                              curl -fsSL https://get.pulumi.com | sh -s -- --version ${{ parameters.PulumiVersion }}               echo "##vso[task.prependpath]$(HOME)/.pulumi/bin";               echo "$PATH"               which pulumi;               pulumi version
b

billowy-army-68599

04/21/2021, 7:53 PM
it's a little unclear how to fix this, do you know where in the path it's installed?
r

rhythmic-activity-46295

04/21/2021, 8:00 PM
warning: Pulumi has been installed to /home/vsts/.pulumi/bin, but it looks like there's a different copy on your $PATH at /usr/local/bin. You'll need to explicitly invoke the version you just installed or modify your $PATH to prefer this location.
t

tall-needle-56640

04/21/2021, 10:08 PM
I'm hitting this as well.
b

billowy-army-68599

04/21/2021, 10:28 PM
so unbeknownst to me, it seems Azure DevOps Pipeline agents have Pulumi reinstalled on them... https://github.com/actions/virtual-environments/blob/main/images/linux/scripts/installers/pulumi.sh it also looks like they haven't updated the image yet since we released 3.0
so you'll need to do what the message says until they update their image: either:
run /home/vsts/.pulumi/bin/pulumi version
update your
PATH
environment variable to have
/home/vsts/.pulumi/bin
before
/usr/local/bin
t

tall-needle-56640

04/22/2021, 1:17 AM
What would be the best way to handle with the Automation API? Cause I changed the PATH in the previous step to it:
- script: |
    PATH=/home/vsts/.pulumi/bin\:$PATH ; export PATH
    curl -fsSL <https://get.pulumi.com> | sh
But it still accesses the old version.
I ended up setting a variable to hold the new path:
- pwsh: |
    Write-Host "##vso[task.setvariable variable=NEWPATH]/home/vsts/.pulumi/bin\:$env:PATH"
And then in the Pulumi step, passed it in as an env var:
env:
  PATH: $(NEWPATH)
UPDATE: Nevermind, still doesn't work
b

billowy-army-68599

04/22/2021, 2:26 AM
Here's my current path:
echo $PATH
/Users/lbriggs/.rvm/gems/ruby-2.5.2/bin:/Users/lbriggs/.rvm/gems/ruby-2.5.2@global/bin:/Users/lbriggs/.rvm/rubies/ruby-2.5.2/bin:/Users/lbriggs/.asdf/shims:/usr/local/opt/asdf/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/puppetlabs/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/lbriggs/src/go/bin:/Users/lbriggs/.rvm/bin
I want the new version of pulumi to be used first. So I do this:
PATH="${HOME}/.pulumi/bin${PATH:+:${PATH}}"
Which prepends the dir to my
$PATH
. Now when I do this:
which pulumi
/Users/lbriggs/.pulumi/bin/pulumi
I get the right version
I dunno how this works in Windows/Powershell I'm afraid
but my guess is your
Write-Host
needs to be
- pwsh: |
    Write-Host "##vso[task.setvariable variable=PATH]/home/vsts/.pulumi/bin\:$env:PATH"
t

tall-needle-56640

04/22/2021, 4:46 PM
Azure DevOps in more nuanced than that. Env var changes in one step are not reflected in the next:
- bash: |
    PATH="${HOME}/.pulumi/bin${PATH:+:${PATH}}"

- bash: |
    which pulumi # outputs: /usr/local/bin/pulumi
    echo $PATH # /home/linuxbrew/.linuxbrew/bin:...
b

billowy-army-68599

04/22/2021, 4:51 PM
is there no way to set that env var globally?
you can in GHA, which seems to be the same product with a different skin
t

tall-needle-56640

04/22/2021, 9:02 PM
GHA is more like a reboot. It is still missing some key feature of Azure Pipelines (and probably now the other way around as well). Anyway this is what worked:
- bash: |
    curl -fsSL <https://get.pulumi.com> | sh
    newPath="${HOME}/.pulumi/bin${PATH:+:${PATH}}"
    echo "##vso[task.setvariable variable=NEWPATH]$newPath"
  displayName: Install Pulumi

- task:
  env:
    PATH: $(NEWPATH)
Since I was building on an Ubuntu image, my path changes in Powershell didn't get reflected when the dotnet CLI task ran (which runs in Bash).
@billowy-army-68599 Thanks for your help. But can you help me understand why you used
"${HOME}/.pulumi/bin${PATH:+:${PATH}}"
instead of
"${HOME}/.pulumi/bin:${PATH}"
? They seem to do the same thing for me.
b

billowy-army-68599

04/22/2021, 9:11 PM
it's just a more bash correct way
they both work
r

rhythmic-activity-46295

04/25/2021, 9:21 PM
thanks guys, I've got this to work along the lines of the above. works using service principal a certificate and decrypt password. but under an Azure Cli task. If I try the same with a pulumi devops task, it keeps failing with ##[debug]AZURE_KEYVAULT_AUTH_VIA_CLI=true ##[debug]INSTALLED_PULUMI_VERSION=3.0.0 ##[debug]azureSubscription={{retracted}} ##[debug]Using service endpoint '{{retracted}}'. ##[debug]{{retracted}} exists true ##[debug]{{retracted}} auth param serviceprincipalid = * ##[debug]task result: Failed ##[error]Error: Endpoint auth data not present: {{retracted}}