Skip to content

Commit

Permalink
Don't populate the Go cache from the license check job (#1222)
Browse files Browse the repository at this point in the history
GitHub cache artifacts are immutable, so the first job to write to the
cache "wins" in the sense that all subsequent jobs will start with
whatever that job happened to cache.

We currently use `setup-go` in the license check action, but this job is
very quick (typically a couple minutes) and doesn't really build any
artifacts or download modules. Subsequent jobs then need to re-download
and re-compile all the provider's modules.

This PR disables caching for the license check job. This gives the
`prerequisites` job an opportunity to more fully populate the cache.

Ideally we would only disable _writing_ to the cache, but there isn't an
official way to do that yet
(actions/setup-go#316) and manually restoring
the cache is fragile.
  • Loading branch information
blampe authored Dec 12, 2024
1 parent 84bf03d commit aa1f6b5
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ inputs:
dotnet
java
default: all
cache-go:
description: |
Whether to enable the GitHub cache for Go. Appropriate for disabling in
smaller jobs that typically completely before the "real" job has an
opportunity to populate the cache.
default: "true"

runs:
using: "composite"
Expand All @@ -27,6 +33,8 @@ runs:
provider/*.sum
upstream/*.sum
sdk/*.sum
# TODO(https://github.com/actions/setup-go/issues/316): Restore but don't save the cache.
cache: ${{ inputs.cache-go }}

- name: Install pulumictl
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
uses: ./.github/actions/setup-tools
with:
tools: go
cache-go: false
- run: make upstream
- uses: pulumi/license-check-action@main
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ inputs:
dotnet
java
default: all
cache-go:
description: |
Whether to enable the GitHub cache for Go. Appropriate for disabling in
smaller jobs that typically completely before the "real" job has an
opportunity to populate the cache.
default: "true"

runs:
using: "composite"
Expand All @@ -27,6 +33,8 @@ runs:
provider/*.sum
upstream/*.sum
sdk/*.sum
# TODO(https://github.com/actions/setup-go/issues/316): Restore but don't save the cache.
cache: ${{ inputs.cache-go }}

- name: Install pulumictl
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
uses: ./.github/actions/setup-tools
with:
tools: go
cache-go: false
- run: make upstream
- uses: pulumi/license-check-action@main
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ inputs:
dotnet
java
default: all
cache-go:
description: |
Whether to enable the GitHub cache for Go. Appropriate for disabling in
smaller jobs that typically completely before the "real" job has an
opportunity to populate the cache.
default: "true"

runs:
using: "composite"
Expand All @@ -27,6 +33,8 @@ runs:
provider/*.sum
upstream/*.sum
sdk/*.sum
# TODO(https://github.com/actions/setup-go/issues/316): Restore but don't save the cache.
cache: ${{ inputs.cache-go }}

- name: Install pulumictl
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
uses: ./.github/actions/setup-tools
with:
tools: go
cache-go: false
- run: make upstream
- uses: pulumi/license-check-action@main
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ inputs:
dotnet
java
default: all
cache-go:
description: |
Whether to enable the GitHub cache for Go. Appropriate for disabling in
smaller jobs that typically completely before the "real" job has an
opportunity to populate the cache.
default: "true"

runs:
using: "composite"
Expand All @@ -27,6 +33,8 @@ runs:
provider/*.sum
upstream/*.sum
sdk/*.sum
# TODO(https://github.com/actions/setup-go/issues/316): Restore but don't save the cache.
cache: ${{ inputs.cache-go }}

- name: Install pulumictl
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
uses: ./.github/actions/setup-tools
with:
tools: go
cache-go: false
- run: make upstream
- uses: pulumi/license-check-action@main
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ inputs:
dotnet
java
default: all
cache-go:
description: |
Whether to enable the GitHub cache for Go. Appropriate for disabling in
smaller jobs that typically completely before the "real" job has an
opportunity to populate the cache.
default: "true"

runs:
using: "composite"
Expand All @@ -27,6 +33,8 @@ runs:
provider/*.sum
upstream/*.sum
sdk/*.sum
# TODO(https://github.com/actions/setup-go/issues/316): Restore but don't save the cache.
cache: ${{ inputs.cache-go }}

- name: Install pulumictl
if: inputs.tools == 'all' || contains(inputs.tools, 'pulumictl')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
uses: ./.github/actions/setup-tools
with:
tools: go
cache-go: false
- run: make upstream
- uses: pulumi/license-check-action@main
with:
Expand Down

0 comments on commit aa1f6b5

Please sign in to comment.