Skip to content

Test stack, e2e workflow, and new commands for pulumi.yml#1

Open
ryan-williams wants to merge 3 commits intov1from
v1.x
Open

Test stack, e2e workflow, and new commands for pulumi.yml#1
ryan-williams wants to merge 3 commits intov1from
v1.x

Conversation

@ryan-williams
Copy link
Copy Markdown
Member

@ryan-williams ryan-williams commented Feb 27, 2026

Summary

  • Adds a test Pulumi stack (test/) with lightweight free AWS resources (EC2 key pair, IAM role, CW log group)
  • Adds test.yml caller workflow for manual dispatch against the reusable workflow
  • Adds e2e.yml smoketest: init → preview → up → preview (nop) → destroy → preview (recreate) → stack-rm
  • New commands in pulumi.yml: init, destroy, stack-rm
  • New secrets-provider input for GCP KMS (or other) secrets encryption
  • PULUMI_CONFIG_PASSPHRASE as optional secret input (defaults to empty string for self-managed backends)
  • Run-ID based stack isolation for concurrent e2e runs
  • Fixed grep warning in dynamic fence logic

Test plan

  • E2E workflow passes: run 22510713005
  • PR comment renders with --patch diff output, project prefix, commit link
  • Job summary renders on the GHA run page

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

✅ pulumi-v1-test: pulumi preview (142d39b)

Output
warning: using pulumi-language-python from $PATH at /usr/local/bin/pulumi-language-python
Previewing update (test):
warning: using pulumi-language-python from $PATH at /usr/local/bin/pulumi-language-python
+ pulumi:pulumi:Stack
+   [urn=urn:pulumi:test::pulumi-v1-test::pulumi:pulumi:Stack::pulumi-v1-test-test]
+    tls:index/privateKey:PrivateKey
+       [urn=urn:pulumi:test::pulumi-v1-test::tls:index/privateKey:PrivateKey::test-key]
+       [provider=urn:pulumi:test::pulumi-v1-test::pulumi:providers:tls::default_5_3_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
+       algorithm: "ED25519"
+    aws:cloudwatch/logGroup:LogGroup
+       [urn=urn:pulumi:test::pulumi-v1-test::aws:cloudwatch/logGroup:LogGroup::test-log-group]
+       [provider=urn:pulumi:test::pulumi-v1-test::pulumi:providers:aws::default_7_20_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
+       name           : "/pulumi-v1/test/test"
+       region         : "us-east-1"
+       retentionInDays: 1
+       skipDestroy    : false
+       tagsAll        : {}
+    aws:iam/role:Role
+       [urn=urn:pulumi:test::pulumi-v1-test::aws:iam/role:Role::test-role]
+       [provider=urn:pulumi:test::pulumi-v1-test::pulumi:providers:aws::default_7_20_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
+       assumeRolePolicy   : {
+           Statement: [
+               [0]: {
+                   Action   : "sts:AssumeRole"
+                   Effect   : "Deny"
+                   Principal: {
+                       Service: "none.amazonaws.com"
+                   }
+               }
+           ]
+           Version  : "2012-10-17"
+       }
+       forceDetachPolicies: false
+       maxSessionDuration : 3600
+       name               : "pulumi-v1-test-test"
+       path               : "/"
+       tagsAll            : {}
+    aws:ec2/keyPair:KeyPair
+       [urn=urn:pulumi:test::pulumi-v1-test::aws:ec2/keyPair:KeyPair::test-key-pair]
+       [provider=urn:pulumi:test::pulumi-v1-test::pulumi:providers:aws::default_7_20_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
+       keyName   : "pulumi-v1-test-test"
+       publicKey : [unknown]
+       region    : "us-east-1"
+       tagsAll   : {}
    --outputs:--
+   key_pair_name : "pulumi-v1-test-test"
+   log_group_name: "/pulumi-v1/test/test"
+   role_arn      : [unknown]
Resources:
    + 5 to create

Workflow logs

@ryan-williams ryan-williams changed the title Test stack and workflow for exercising pulumi.yml Test stack, e2e workflow, and new commands for pulumi.yml Feb 27, 2026
New commands for full lifecycle management:
- `init`: create a new stack, with optional `--secrets-provider`
- `destroy`: tear down all resources
- `stack-rm`: remove a stack entirely

Also fix grep warning: use bracket expression `[`]+` instead of `\`+`
for matching backtick runs in the dynamic fence logic.
Test stack (`test/`) with lightweight free AWS resources (EC2 key pair,
IAM role, CloudWatch log group) to exercise `pulumi preview --patch`
diff output, job summaries, and PR comments.

Workflows:
- `test.yml`: manual dispatch for individual commands against `test` stack
- `e2e.yml`: full lifecycle smoketest with run-ID stack isolation:
  init → preview → up → preview (nop) → destroy → preview (recreate) → stack-rm
Callers can pass a passphrase for stack encryption; when unset, defaults
to empty string, which satisfies Pulumi's passphrase check on
self-managed backends (GCS, S3, local) without requiring callers to
explicitly set it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a lightweight Pulumi “test” project plus GitHub Actions workflows to exercise and validate the reusable pulumi.yml workflow end-to-end, including new stack-management commands and secrets encryption options.

Changes:

  • Introduces a test/ Pulumi Python project that provisions minimal AWS resources for workflow smoke testing.
  • Adds test.yml (manual caller) and e2e.yml (multi-step smoketest) workflows that run the reusable pulumi.yml.
  • Extends .github/workflows/pulumi.yml with init, destroy, and stack-rm commands plus an optional secrets-provider and PULUMI_CONFIG_PASSPHRASE support.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/requirements.txt Adds Pulumi + AWS/TLS provider deps for the new test stack.
test/Pulumi.yaml Defines the new test Pulumi project and its backend configuration.
test/Pulumi.test.yaml Adds basic stack config (AWS region) for the test stack.
test/main.py Implements the test stack resources (EC2 key pair, IAM role, log group) and exports outputs.
.github/workflows/test.yml Adds a manual-dispatch “caller” workflow to invoke the reusable workflow against test/.
.github/workflows/pulumi.yml Expands the reusable workflow with new commands and secrets-provider/passphrase handling.
.github/workflows/e2e.yml Adds an end-to-end smoketest workflow with run-id-based stack isolation and lifecycle coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import pulumi_aws as aws
import pulumi_tls as tls

config = pulumi.Config()
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config = pulumi.Config() is declared but never used in this stack; if it’s not needed, remove it to avoid unused-variable lint noise, or use it to read required test configuration.

Suggested change
config = pulumi.Config()

Copilot uses AI. Check for mistakes.
public_key=key.public_key_openssh,
)

# IAM Role (no trust policy; just exists for diff testing)
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says the IAM role has “no trust policy”, but assume_role_policy is explicitly set. Please either adjust the comment to match the code, or change the role definition to align with the intent (e.g., a minimal/valid trust policy for a dummy role).

Suggested change
# IAM Role (no trust policy; just exists for diff testing)
# IAM Role (deny-all trust policy; just exists for diff testing)

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +5
backend:
url: gs://oa-pulumi
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This project hardcodes a GCS backend (gs://oa-pulumi). That makes the new test/ stack and the reusable workflows non-portable unless that bucket + GCP auth vars exist. Consider making the backend configurable (e.g., omit it here and rely on pulumi login/env in CI, or document the required backend setup for contributors).

Suggested change
backend:
url: gs://oa-pulumi

Copilot uses AI. Check for mistakes.
Comment on lines +180 to +185
${{ inputs.secrets-provider && format('--secrets-provider="{0}"', inputs.secrets-provider) || '' }}
exit 0
;;
stack-rm)
pulumi stack rm ${{ inputs.stack }} --yes --force
exit 0
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init and stack-rm exit before writing pulumi-output.txt, so the “Summary and PR comment” step will always be skipped for these commands. If these commands are intended to be first-class workflow commands, consider capturing their output to pulumi-output.txt (and letting the summary step run) to aid debugging/visibility.

Suggested change
${{ inputs.secrets-provider && format('--secrets-provider="{0}"', inputs.secrets-provider) || '' }}
exit 0
;;
stack-rm)
pulumi stack rm ${{ inputs.stack }} --yes --force
exit 0
${{ inputs.secrets-provider && format('--secrets-provider="{0}"', inputs.secrets-provider) || '' }} \
2>&1 | tee pulumi-output.txt
exit ${PIPESTATUS[0]}
;;
stack-rm)
pulumi stack rm ${{ inputs.stack }} --yes --force \
2>&1 | tee pulumi-output.txt
exit ${PIPESTATUS[0]}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants