Skip to content

Commit

Permalink
ci: cherry-pick workflow permissions updates (#5364)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Innis <[email protected]>
  • Loading branch information
jmdeal and jonathan-innis authored Dec 19, 2023
1 parent 270c075 commit 34860d3
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 35 deletions.
1 change: 0 additions & 1 deletion .github/workflows/approval-comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: ApprovalComment
on:
pull_request_review:
types: [submitted]

jobs:
approval-comment:
if: startsWith(github.event.review.body, '/karpenter snapshot') || startsWith(github.event.review.body, '/karpenter alpha-scale') || startsWith(github.event.review.body, '/karpenter scale') || startsWith(github.event.review.body, '/karpenter versionCompatibility')
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codegen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: "APICodeGen"
on:
schedule:
- cron: '0 13 * * MON'
permissions:
id-token: write # aws-actions/[email protected]
pull-requests: write # name: Create Pull Request
contents: write # name: Create Pull Request
jobs:
codegen:
permissions:
id-token: write # aws-actions/[email protected]
pull-requests: write # name: Create Pull Request
contents: write # name: Create Pull Request
if: github.repository == 'aws/karpenter'
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
name: "CodeQL"

on:
push:
branches:
- 'main'
- 'release-v*'
schedule:
- cron: '0 12 * * *'

jobs:
analyze:
if: github.repository == 'aws/karpenter'
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/docgen.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
name: DocGenCI

on:
push:
branches:
- 'main'
- 'release-v*'

permissions:
id-token: write # aws-actions/[email protected]

jobs:
docgen-ci:
permissions:
id-token: write # aws-actions/[email protected]
if: github.repository == 'aws/karpenter'
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ on:
- "us-east-2"
- "us-west-2"
- "eu-west-1"
permissions:
id-token: write # aws-actions/[email protected]
jobs:
cleanup:
permissions:
id-token: write # aws-actions/[email protected]
name: cleanup-${{ inputs.cluster_name }}
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e-matrix-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:
with:
allowed_comment: "snapshot"
e2e-matrix:
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
needs: [resolve]
if: needs.resolve.outputs.SHOULD_RUN == 'true'
uses: ./.github/workflows/e2e-matrix.yaml
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/e2e-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ on:
# 3. Downstream fork triggered the job through dispatch and has set 'ENABLE_E2E' in repo environment variables
jobs:
e2e:
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
strategy:
fail-fast: false
max-parallel: ${{ inputs.parallelism || 100 }}
Expand Down Expand Up @@ -83,6 +86,9 @@ jobs:
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
e2e-upgrade:
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
uses: ./.github/workflows/e2e-upgrade.yaml
with:
# This version matches the steps of the newest version that contains the additional step
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e-scale-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
with:
allowed_comment: "scale"
scale:
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
needs: [resolve]
if: needs.resolve.outputs.SHOULD_RUN == 'true'
uses: ./.github/workflows/e2e.yaml
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ on:
secrets:
SLACK_WEBHOOK_URL:
required: true
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
jobs:
run-suite:
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
name: suite-upgrade
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e-version-compatibility-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:
with:
allowed_comment: "versionCompatibility"
versionCompatibility:
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
needs: [resolve]
if: needs.resolve.outputs.SHOULD_RUN == 'true'
strategy:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ on:
secrets:
SLACK_WEBHOOK_URL:
required: true
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
jobs:
run-suite:
permissions:
id-token: write # aws-actions/[email protected]
statuses: write # ./.github/actions/commit-status/start
name: suite-${{ inputs.suite }}
runs-on: ubuntu-latest
steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ on:
workflow_run:
workflows: [ApprovalComment]
types: [completed]
permissions:
id-token: write
pull-requests: write
statuses: write
jobs:
release:
permissions:
id-token: write
pull-requests: write
statuses: write
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-test-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ on:
- test/push-docker.sh
schedule:
- cron: '0 13 * * MON'
permissions:
id-token: write # aws-actions/[email protected]
jobs:
publish-tools:
permissions:
id-token: write # aws-actions/[email protected]
if: github.repository == 'aws/karpenter'
runs-on: ubuntu-latest
steps:
Expand Down
15 changes: 10 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
name: Release
on:
push:
tags: [ 'v*.*.*' ]
permissions:
id-token: write # aws-actions/[email protected]
contents: write # marvinpinto/action-automatic-releases@latest
pull-requests: write # name: Create PR
# Only release on supported semantic version tagging e.g. v0.0.1-rc.0
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
jobs:
release:
permissions:
id-token: write # aws-actions/[email protected]
contents: write # marvinpinto/[email protected]
pull-requests: write # name: Create PR
if: github.repository == 'aws/karpenter'
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
branches:
- 'main'
- 'release-v*'
permissions:
id-token: write # aws-actions/[email protected]
jobs:
release:
permissions:
id-token: write # aws-actions/[email protected]
if: github.repository == 'aws/karpenter-provider-aws'
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sweeper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
permissions:
id-token: write # aws-actions/[email protected]
jobs:
sweeper:
permissions:
id-token: write # aws-actions/[email protected]
if: vars.ACCOUNT_ID != '' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
Expand Down

0 comments on commit 34860d3

Please sign in to comment.