Skip to content

ci: set gha cache repository and token - #5004

Merged
crazy-max merged 1 commit into
moby:masterfrom
crazy-max:ci-gha-rest
Jun 27, 2024
Merged

crazy-max merged 1 commit into
moby:masterfrom
crazy-max:ci-gha-rest

Conversation

@crazy-max

Copy link
Copy Markdown
Member

follow-up #4788

Set repository and ghtoken attributes for gha cache to avoid getting rate limited in this repo.

@crazy-max
crazy-max force-pushed the ci-gha-rest branch 2 times, most recently from b14cd8e to 11f5bb7 Compare June 7, 2024 13:17
set: |
*.cache-from=type=gha,scope=${{ inputs.cache_scope }}
*.cache-to=type=gha,scope=${{ inputs.cache_scope }}
*.cache-to=type=gha,scope=${{ inputs.cache_scope }},repository=${{ github.repository }},ghtoken=${{ secrets.GITHUB_TOKEN }}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will not be needed with docker/actions-toolkit#350

@crazy-max
crazy-max requested a review from tonistiigi June 7, 2024 13:21
@crazy-max
crazy-max marked this pull request as ready for review June 7, 2024 13:22
Comment thread hack/release
Comment on lines +25 to +38
if [[ -n "$GITHUB_REPOSITORY" ]] && [[ $cto != *"repository="* ]]; then
cto="${cto},repository=${GITHUB_REPOSITORY}"
fi
if [[ -n "$GITHUB_TOKEN" ]] && [[ $cto != *"ghtoken="* ]]; then
cto="${cto},ghtoken=${GITHUB_TOKEN}"
fi

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tonistiigi These attributes should only be set for cache-to when making the batch request to list cache keys but not cache-from right?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to be consistent here and set both. Atm it would be only used for export path but I think this should be internal behavior that may change in the future.

@crazy-max
crazy-max force-pushed the ci-gha-rest branch 2 times, most recently from edff54c to 48b92b2 Compare June 10, 2024 10:23
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
@crazy-max
crazy-max merged commit 8397d0b into moby:master Jun 27, 2024
@crazy-max
crazy-max deleted the ci-gha-rest branch June 27, 2024 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants