This message was deleted.
# typescript
s
This message was deleted.
l
What will be using the name in the next step? If it's another Pulumi program, you would use a stack reference. If it's anything else, you would invoke
pulumi stack output
and grab the value from there.
r
it another github action step eg:
Copy code
- name: upload package to bucket
        run: aws s3 cp accessRequest.zip <s3-bucket-name>
i will try adding pulumi stack output thanks
👍 1
I tried like this but it command: output doesnt seem to work
Copy code
- uses: pulumi/actions@v3
        name: get s3 bucket name to push package 
        with:
          command: output
          stack-name: dev
          work-dir: awsResource/s3
        env:
          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
          PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
error:
Copy code
Error: Expected { command: "up" | "update" | "refresh" | "destroy" | "preview"; stackName: string; workDir: string; commentOnPr: boolean; options: { parallel?: number; message?: string; expectNoChanges?: boolean; diff?: boolean; replace?: string[]; target?: string[]; targetDependents?: boolean; editCommentOnPr?: boolean; userAgent?: "pulumi/actions@v3"; }; }, but was incompatible
l
The Pulumi action doesn't support the
stack
command. If you need it in another step, then you need to run the
pulumi
command directly, and parse its output.
What's going to consume the name?
r
out put will be consumed by another github action step
Copy code
- uses: pulumi/actions@v3
        with:
          command: up
          stack-name: dev
          #comment-on-pr: true
          upsert: true
          refresh: true
          work-dir: awsResource/s3
        env:
          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
          PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}

      - name: upload foo package to bucket
        run: aws s3 cp foo.zip <bucket name from output of pulumi up >
l
Ah. If that can't be done in the Pulumi program (maybe by using a file asset) then you will want to use
pulumi stack output | grep bucketName
or similar. Unless the Pulumi action can store outputs in a workflow variable or similar... I don't think I've read anything about that.
r
This worked for me
Copy code
-  name: get s3 bucket name to push package
         id: pulumiStackOutput
         working-directory: awsResource/s3
         env:
          PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
         run: echo ::set-output name=bucketname::$(pulumi login ${{ secrets.AWS_BUCKET }}  > /dev/null 2>&1  && pulumi stack output -j | jq -r .bucketName)
      -  name: print bucket name 
         run: echo ${{ steps.pulumiStackOutput.outputs.bucketname }}
l
Yep, it's a bit hairy, but maybe a request for an option to the "up" Pulumi action that puts outputs (or at least, some named outputs) into a workflow variable would be good...
Your solution is what I'd do, until the action supports something "prettier".