-
Notifications
You must be signed in to change notification settings - Fork 0
Add PR validation for staging Pulumi component references #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
83367d4
c8b8593
521b810
65f8de4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,92 @@ | ||||||||||||||
| name: Check Staging Pulumi References | ||||||||||||||
|
|
||||||||||||||
| # This workflow validates that staging Pulumi configurations don't use local component references | ||||||||||||||
| # Local references (relative paths with @0.0.0) should only be used during development, not in staging | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| pull_request: | ||||||||||||||
| paths: | ||||||||||||||
| - 'pulumi/environments/aws/**/*.yaml' | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| check-references: | ||||||||||||||
| name: Validate Pulumi Component References | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| permissions: | ||||||||||||||
| contents: read | ||||||||||||||
| pull-requests: write | ||||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| - name: Checkout code | ||||||||||||||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||||||||||||||
|
|
||||||||||||||
| - name: Check for local path references in Pulumi.yaml files | ||||||||||||||
| id: check-local-paths | ||||||||||||||
| run: | | ||||||||||||||
| echo "Checking for local path references in Pulumi.yaml files..." | ||||||||||||||
| EXIT_CODE=0 | ||||||||||||||
|
|
||||||||||||||
| # Find all Pulumi.yaml files under pulumi/environments/aws/ | ||||||||||||||
| while IFS= read -r file; do | ||||||||||||||
| echo "Checking file: $file" | ||||||||||||||
|
|
||||||||||||||
| # Check if the file contains packages with relative paths (starting with ../ or ./) | ||||||||||||||
| if grep -E '^\s+\w+:\s+\.\.' "$file"; then | ||||||||||||||
| echo "❌ ERROR: Found local path reference in $file" | ||||||||||||||
| echo "Local path references (e.g., ../../../../components/aws/vpc@0.0.0) are not allowed in staging." | ||||||||||||||
|
||||||||||||||
| if grep -E '^\s+\w+:\s+\.\.' "$file"; then | |
| echo "❌ ERROR: Found local path reference in $file" | |
| echo "Local path references (e.g., ../../../../components/aws/vpc@0.0.0) are not allowed in staging." | |
| if grep -E '^\s+\w+:\s+\.(\.|/)+' "$file"; then | |
| echo "❌ ERROR: Found local path reference in $file" | |
| echo "Local path references (e.g., ../../../../components/aws/vpc@0.0.0 or ./components/aws/vpc@0.0.0) are not allowed in staging." |
Copilot
AI
Dec 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The find command searches all Pulumi.yaml files under "pulumi/environments/aws/" but the workflow is specifically for staging validation. If other environments (like dev or prod) are added in the future, this check will incorrectly validate them too. Consider restricting the search to staging only by changing the path to "pulumi/environments/aws/staging".
| done < <(find pulumi/environments/aws -type f -name "Pulumi.yaml") | |
| done < <(find pulumi/environments/aws/staging -type f -name "Pulumi.yaml") |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||
| name: vpc | ||||||
| description: VPC infrastructure for staging environment | ||||||
| runtime: yaml | ||||||
| # Testing PR validation workflow for local path references | ||||||
| packages: | ||||||
| vpc: ../../../../components/aws/vpc@0.0.0 | ||||||
|
||||||
| vpc: ../../../../components/aws/vpc@0.0.0 | |
| vpc: https://github.com/ManagedKube/devops-with-ai.git/pulumi/components/aws/vpc@0.0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The job is missing a timeout-minutes configuration. According to GitHub Actions best practices, adding a timeout prevents hung workflows from consuming resources indefinitely. Consider adding "timeout-minutes: 10" to the job definition, similar to the test-sg-component workflow.