I am trying to move o ur pulumi infra deployments ...
# aws
p
I am trying to move o ur pulumi infra deployments into a Codefresh pipeline. I am getting plugin version errors from one day to the next as plugin versions seem to be changing quite frequently. Is it possible to avoid these errors when running in a pipeline? For example in the output logs from the pipeline I see the plugins are downloading and installing as defined in the pipeline template. When it comes time to do the pulumi up I get the following:
pulumi:providers:aws default_4_12_0  error: no resource plugin 'aws-v4.12.0' found in the workspace or on your $PATH, install the plugin using pulumi plugin install resource aws v4.12.0
. Above that I see that we have installed v4.11.0 as defined in our config which worked late last week when I testing against this method.
Copy code
Executing command: pulumi plugin install resource aws v4.11.0                                          
[resource plugin aws-4.11.0] installing                                                                
Downloading plugin: 75.91 MiB / 75.91 MiB  100.00% 1s
How do we avoid this and/or is it possible to have the
pulumi plugin install
command always pull the latest version rather than manually specifying a version on run time? The pipeline is pulling the pulumi/pulumi:3.6.1 docker image to run in.
Copy code
Pulling image pulumi/pulumi:v3.6.1                                                                     
Digest: sha256:28c72d280cf89401cbc5600be57d15372c43483702a170edcdb772907288f6f1                        
Status: Image is up to date for pulumi/pulumi:v3.6.1
b
are you running an
npm install
before your pulumi up?
p
no I'm not. If it change the version of the plugin to match the version defined in the error it will work
b
the npm install should install the right versions
p
I take back I am doing a
yarn install
during the docker build process
for testing I added another yarn install before the pulumi up step and got the same message back.
Copy code
------------------------------                                                                                                                                   
Executing command: pulumi login                                                                                                                                  
Logging in using access token from PULUMI_ACCESS_TOKEN                                                                                                           
Logged in to <http://pulumi.com|pulumi.com> as jakeatomic (<https://app.pulumi.com/jakeatomic>)                                                                                        
------------------------------                                                                                                                                   
Executing command: pulumi plugin install resource aws v4.11.0                                                                                                    
[resource plugin aws-4.11.0] installing                                                                                                                          
Downloading plugin: 75.91 MiB / 75.91 MiB  100.00% 1s                                                                                                            
------------------------------                                                                                                                                   
Executing command: pulumi plugin install resource kubernetes v3.5.0                                                                                              
[resource plugin kubernetes-3.5.0] installing                                                                                                                    
Downloading plugin: 26.22 MiB / 26.22 MiB  100.00% 0s                                                                                                            
------------------------------                                                                                                                                   
Executing command: pulumi plugin install resource eks v0.22.0                                                                                                    
[resource plugin eks-0.22.0] installing                                                                                                                          
Downloading plugin: 670.75 KiB / 670.75 KiB  100.00% 0s                                                                                                          
------------------------------                                                                                                                                   
Executing command: pulumi plugin ls                                                                                                                              
NAME        KIND      VERSION  SIZE    INSTALLED  LAST USED                                                                                                      
aws         resource  4.11.0   271 MB  n/a        12 seconds ago                                                                                                 
aws         resource  3.38.1   254 MB  n/a        2 seconds ago                                                                                                  
eks         resource  0.22.0   158 MB  n/a        9 seconds ago                                                                                                  
kubernetes  resource  3.5.0    67 MB   n/a        10 seconds ago                                                                                                 
kubernetes  resource  2.9.1    77 MB   n/a        1 second ago  
                                                                                                                                                                 
 +  pulumi:pulumi:Stack platform-staging create                                                                                                                  
    pulumi:providers:aws default_4_12_0  error: no resource plugin 'aws-v4.12.0' found in the workspace or on your $PATH, install the plugin using `pulumi plugin
 install resource aws v4.12.0`                                                                                                                                   
 +  pulumi:pulumi:Stack platform-staging create                                                                                                                  
    pulumi:providers:aws default_4_12_0  1 error
b
i'm checking it automatic plugin acquisition works for yarn, you shouldn't need to install the plugins manually like this
to answer your original question, you can pull the latest release from the github release if you'd like
p
thank you. For some context this is what the commands in our deployment step looks like
Copy code
commands:
      - pulumi login
      - pulumi plugin install resource aws v4.11.0
      - pulumi plugin install resource kubernetes v3.5.0
      - pulumi plugin install resource eks v0.22.0
      - pulumi plugin ls
      - pulumi stack select atomicfi/${{STAGE}}
      - pulumi stack
      - pulumi up --non-interactive --yes -r
b
Copy code
pulumi plugin install resource aws $(curl -s <https://api.github.com/repos/pulumi/pulumi-aws/releases/latest> | jq '.tag_name' -r)
where is your
yarn install
?
p
This is the current entire pipeline config. The yarn install is done during the container build step.
Copy code
# More examples of Codefresh YAML can be found at
# <https://codefresh.io/docs/docs/yaml-examples/examples/>

version: "1.0"
# Stages can help you organize your steps in stages
stages:
  - "clone"
  - "build"
  - "deploy"

steps:
  clone:
    title: "Cloning repository"
    type: "git-clone"
    repo: "atomicfi/platform"
    revision: "${{CF_BRANCH}}"
    git: "github"
    stage: "clone"

  build:
    title: "Building Docker image"
    image: pulumi/pulumi
    working_directory: "${{clone}}"
    tag: "${{CF_BRANCH_TAG_NORMALIZED}}"
    commands:
      - yarn install
    stage: "build"

  RunPulumi:
    title: Deploying
    stage: deploy
    working_directory: "${{clone}}/deployments/aws-${{AWS_REGION}}"
    image: pulumi/pulumi:v3.6.1
    kube_context: ${{STAGE}}
    buildkit: true
    ssh: default
    commands:
      - pulumi login
      - pulumi plugin install resource aws v4.11.0
      - pulumi plugin install resource kubernetes v3.5.0
      - pulumi plugin install resource eks v0.22.0
      - pulumi plugin ls
      - pulumi stack select atomicfi/${{STAGE}}
      - pulumi stack
      - pulumi up --non-interactive --yes -r
      # - pulumi destroy --non-interactive --yes -r
and to note and make clear, if I change the line for the aws resource plugin to match the version in the error it will work
which is where I'm stumbling as it will work one day, then not again the next until the version is manually updated in this config file
b
so your provider version is stored in 2 places: - your
package.json
- inside your state
so if you have a liberal constraint in your
package.json
and someone new comes along and does
yarn install
they'll get the latest version of the plugin, which will then be stored in state. If you do
pulumi stack export
you should see the version on the provider field for each resource
you might want to have a more strict constraint in your
package.json
can you share your
package.json
?
p
Copy code
{
  "dependencies": {
    "@pulumi/aws": "^4.8.0",
    "@pulumi/awsx": "^0.30.0",
    "@pulumi/eks": "^0.31.0",
    "@pulumi/kubernetes": "^3.3.1",
    "@pulumi/pulumi": "^3.4.0",
    "codefresh": "^0.75.26",
    "js-yaml": "^3.14.1",
    "lodash": "^4.17.21"
  },
  "devDependencies": {
    "@types/node": "^15.12.2"
  }
}
b
yeah, so you're getting any version higher than 4.8.0, I'd probably pin that to a specific version honestly, unless you're ready to update
p
Ok, let me try that
ok, that seemed to work
I'm getting a new error now, but that is completely unrelated to this as it seems to be some bad code in the actual ts files
thanks for the help!