Skip to content

Commit

Permalink
Unconditional id-token permissions (#1333)
Browse files Browse the repository at this point in the history
If we limit permissions via template conditionals, it means that our
test proivder xyz cannot validate that code path, leading us to guess in
the dark at valid workflow configurations.
This pull request implements the suggestion from here:
#1332 (comment).
- **Set contents: write and id-token: write unconditionally, so we can
validate the workflows**
- **test providers**
  • Loading branch information
guineveresaenger authored Jan 30, 2025
1 parent 626a403 commit b53ded1
Show file tree
Hide file tree
Showing 23 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ jobs:
name: publish
permissions:
contents: write
#{{- if .Config.GCP }}#
id-token: write
#{{- end }}#
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ jobs:
name: publish
permissions:
contents: write
#{{- if .Config.GCP }}#
id-token: write
#{{- end }}#
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,9 @@ jobs:
verify_release:
name: verify_release
needs: publish_sdk
#{{- if .Config.GCP }}#
permissions:
contents: write
id-token: write
#{{- end }}#
uses: ./.github/workflows/verify-release.yml
secrets: inherit
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ jobs:
permissions:
contents: write
pull-requests: write
#{{- if .Config.GCP }}#
id-token: write
#{{- end }}#
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
runner: ["ubuntu-latest"]
#{{- end }}#
runs-on: ${{ matrix.runner }}
#{{- if and .Config.ReleaseVerification .Config.GCP }}#
#{{- if .Config.ReleaseVerification }}#
permissions:
contents: 'read'
id-token: 'write'
Expand Down
1 change: 1 addition & 0 deletions provider-ci/test-providers/acme/.github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
name: publish
permissions:
contents: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
name: publish
permissions:
contents: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
3 changes: 3 additions & 0 deletions provider-ci/test-providers/acme/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ jobs:
verify_release:
name: verify_release
needs: publish_sdk
permissions:
contents: write
id-token: write
uses: ./.github/workflows/verify-release.yml
secrets: inherit
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
permissions:
contents: write
pull-requests: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
name: publish
permissions:
contents: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
name: publish
permissions:
contents: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
3 changes: 3 additions & 0 deletions provider-ci/test-providers/aws/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ jobs:
verify_release:
name: verify_release
needs: publish_sdk
permissions:
contents: write
id-token: write
uses: ./.github/workflows/verify-release.yml
secrets: inherit
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
permissions:
contents: write
pull-requests: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ jobs:
# See the docs for a similar example to this: https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson
runner: ${{ fromJSON(format('["ubuntu-latest","windows-latest"{0}]', inputs.enableMacRunner && ',"macos-latest"' || '')) }}
runs-on: ${{ matrix.runner }}
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Configure Git to checkout files with long names
run: git config --global core.longpaths true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ jobs:
name: publish
permissions:
contents: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
name: publish
permissions:
contents: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ jobs:
verify_release:
name: verify_release
needs: publish_sdk
permissions:
contents: write
id-token: write
uses: ./.github/workflows/verify-release.yml
secrets: inherit
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
permissions:
contents: write
pull-requests: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ jobs:
name: verify_release
needs: publish_sdk
permissions:
contents: write
id-token: write
uses: ./.github/workflows/verify-release.yml
secrets: inherit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
name: publish
permissions:
contents: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
name: publish
permissions:
contents: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down
3 changes: 3 additions & 0 deletions provider-ci/test-providers/eks/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ jobs:
verify_release:
name: verify_release
needs: publish_sdk
permissions:
contents: write
id-token: write
uses: ./.github/workflows/verify-release.yml
secrets: inherit
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
permissions:
contents: write
pull-requests: write
id-token: write
needs:
- prerequisites
- build_provider
Expand Down

0 comments on commit b53ded1

Please sign in to comment.