Hello, I am a newbie to pulumi. I am struggling to...
# azure
w
Hello, I am a newbie to pulumi. I am struggling to get pulumi to work with Azure Devops. I have been following https://github.com/pulumi/pulumi-az-pipelines-task and https://github.com/pulumi/pulumi-az-pipelines-task/tree/master/examples/azure . As stated in the example, I am not getting the Pipeline to be added automatically. Please can you help, the documentation seems to be very high level for newbies like me.
r
I'm not sure if this would be answering your question, but this is how I ended up integrating in Azure DevOps: - I'm not using the built-in task, and I'm using it from the command line - I'm using Azure storage as the backend (and not pulumi) What I do is to first populate some variables from the pipeline variables I have defined:
Copy code
- script: |
    echo "##vso[task.setvariable variable=ARM_CLIENT_ID]$(client_id)"
    echo "##vso[task.setvariable variable=ARM_SUBSCRIPTION_ID]$(subscription_id)"
    echo "##vso[task.setvariable variable=ARM_TENANT_ID]$(tenant_id)"
    echo "##vso[task.setvariable variable=AZURE_CLIENT_ID]$(client_id)"
    echo "##vso[task.setvariable variable=AZURE_STORAGE_ACCOUNT]$(storage_account)"
    echo "##vso[task.setvariable variable=AZURE_TENANT_ID]$(tenant_id)"
  displayName: Set variables
Then, when I want to do something with
pulumi
, I need to re-declare the "secret" variables as they're not exported by default; in the following steps: - I'm downloading the
pulumi
cli - I'm installing my packages (
pulumi
bin needs to be available in this step; that's why I
export
the
PATH
in this step - The final step is to actually use those variables to do something with
pulumi
cli
Copy code
- script: |
    curl -fsSL <https://get.pulumi.com> | sh
  displayName: Get pulumi

- script: |
    export PATH=$HOME/.pulumi/bin:$PATH
    npm install
  workingDirectory: deployment/pulumi-deploy
  displayName: Install Pulumi packages

- script: |
    export PATH=$HOME/.pulumi/bin:$PATH

    export ARM_CLIENT_SECRET='$(client_secret)'
    export AZURE_CLIENT_SECRET='$(client_secret)'
    export AZURE_STORAGE_KEY='$(access_key)'

    pulumi login <azblob://pulumitest>
    pulumi stack select dev
    pulumi preview
  workingDirectory: deployment/pulumi-deploy
  displayName: Pulumi preview
For
pulumi up
, we can basically copy/paste the last step above and change the command
c
@witty-spring-28765 can you create the pipeline manually and reference the build yaml file? It might be that AzDo is not (for whatever reason) picking up your yaml file automatically.
m
What is exactly your problem and what are you trying to do ? Can you explain a bit more what do you mean by "I am not getting the Pipeline to be added automatically" ? Do you mean that in the tutorial you are following, the pipeline build does not start ? Is you Azure DevOps repo public and can you share the URL ?
w
Hello @millions-journalist-34868 I am trying to deploy a Pulumi Stack using Azure Devops. I am following https://github.com/pulumi/pulumi-az-pipelines-task/tree/master/examples/azure. I created a profile on app.pulumi, -Created the Git repo, Git add the remote repo to my Local, -Created and Azure-python project in Pulumi, using Pulumi Init command: this throws: error: no Pulumi.yaml project file found (searching upwards from C:\Users\m1\Test1). If you have not created a project yet, use
pulumi new
to do so: So should I create a project, the link doesnot ask to create a project explicitly. -pushed to remote as suggested in the link. This is supposed to create Pipeline in Azure Devops and I dont get one. Is this how people are using the Azure Devops with Pulumi?
@colossal-room-15708 I have mot tried the option of adding a manaul file. I am pretty new to Pulumi and Azure Devops, so I was trying to follow the breadcrumb method of deploying to build up skills. Is there a link that shows how this is achieved and what setting will need to be added for this style of use?
m
You have to use the content of the git hub repository as your git content. I think it is the meaning of the ' connect this folder with your git repo on DevOps.' step. It's not explicit but I guess you have to copy the content of the GitHub sample to your azure devops git repository. That or fork the GitHub repository and 'connect' it to azure devops.
From what I understand the code sample is already made for you. You just have to configure pulumi and azure devops to use this code
w
@millions-journalist-34868 OK I will try that, even I was a bit confused about "Folder to Repo"😀
did a manual create of th pipeline and things seems to be working. Hit this error: pulumiprovidersazure default_3_12_1 error: no resource plugin 'azure-v3.12.1' found in the workspace or on your $PATH, install the plugin using
pulumi plugin install resource azure v3.12.1
The script to install requirements did install pulumi-azure: Successfully installed arpeggio-1.9.2 attrs-19.3.0 dill-0.3.2 grpcio-1.29.0 parver-0.3.0 protobuf-3.12.2 pulumi-2.6.1 pulumi-azure-3.12.1 semver-2.10.2 six-1.15.0