Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,29 @@ permissions:
id-token: write

jobs:
# A repo with no audit role yet (like the template repo) runs this job instead
# of the benchmark, and it says what to set up. Once AWS_AUDIT_ROLE_ARN is set, it skips.
benchmark-not-set-up:
name: "Benchmark skipped: set up AWS first"
if: vars.AWS_AUDIT_ROLE_ARN == ''
runs-on: ubuntu-latest
steps:
- name: Say what to set up
run: |
echo "::notice title=Benchmark skipped: set up AWS first::Set the AWS_AUDIT_ROLE_ARN variable to run the CIS benchmark. The run summary lists the steps."
cat >> "$GITHUB_STEP_SUMMARY" <<'EOF'
## Benchmark skipped: this repo has no audit role yet

The weekly Prowler CIS benchmark signs in to AWS as a read-only `security-audit` role:

1. Create the `security-audit` role with `reference/security-audit-trust.json` (Security section, Unit 1).
2. **Settings → Secrets and variables → Actions → Variables:** add `AWS_AUDIT_ROLE_ARN`, set to that role's ARN.

Then run it from **Actions → Benchmark → Run workflow**, or wait for Monday's run.
EOF

prowler:
if: vars.AWS_AUDIT_ROLE_ARN != ''
runs-on: ubuntu-latest
steps:
# Pinned to a full commit SHA, not a version tag. Unit 3 explains why.
Expand Down
26 changes: 24 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,33 @@ jobs:
name: security-reports
path: reports/

# A repo with no AWS role yet (like the template repo) runs this job instead
# of deploy, and it says what to set up. Once AWS_DEPLOY_ROLE_ARN is set, it skips.
deploy-not-set-up:
name: "Deploy skipped: set up AWS first"
needs: build
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && vars.AWS_DEPLOY_ROLE_ARN == ''
runs-on: ubuntu-latest
steps:
- name: Say what to set up
run: |
echo "::notice title=Deploy skipped: set up AWS first::Every gate passed. Set the AWS_DEPLOY_ROLE_ARN variable to deploy. The run summary lists the steps."
cat >> "$GITHUB_STEP_SUMMARY" <<'EOF'
## Deploy skipped: this repo has no AWS role yet

Every gate in the build job passed. To let the deploy job sign in to AWS:

1. Make the `github-deploy` role, if you have not already (CI/CD section, Phase 4).
2. **Settings → Secrets and variables → Actions → Variables:** add `AWS_DEPLOY_ROLE_ARN`, set to that role's ARN.

Then re-run this workflow.
EOF

# Deploying is the last stage of the lifecycle, so it only happens for main.
# A pull request never gets to sign in to AWS.
# A pull request never gets to sign in to AWS. And it needs a role to sign in as.
deploy:
needs: build
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' && vars.AWS_DEPLOY_ROLE_ARN != ''
runs-on: ubuntu-latest
permissions:
id-token: write
Expand Down
Loading