Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GHA] Cache cleanup workload #19851

Closed

Conversation

mryzhov
Copy link
Contributor

@mryzhov mryzhov commented Sep 14, 2023

Details:

  • Introduced the cleanup workload to remove all generated caches for specific PR when it closed
  • And remove old master caches expect the latest one

Tickets:

  • n/a

@mryzhov mryzhov requested a review from a team as a code owner September 14, 2023 14:27
@mryzhov mryzhov self-assigned this Sep 14, 2023
@github-actions github-actions bot added the category: CI OpenVINO public CI label Sep 14, 2023
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
Copy link
Contributor

Choose a reason for hiding this comment

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

I suppose that ${{ github.ref }} would be the right one?
image

do
if [[ ! -z "$CACHE_KEY" ]]
then
gh actions-cache delete $CACHE_KEY -R $REPO -B $BRANCH --confirm
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest adding some logging, e.g.: echo "DELETING CACHE KEY: $CACHE_KEY" just for the easier possible debug.

for KEY in ${KEYS[@]}
do
echo "Fetching list of cache with key ${KEY} for ${BRANCH}"
CACHE_KEYS=( $(gh actions-cache list -R $REPO -B $BRANCH -L 100 --key $KEY --sort created-at --order desc | cut -f 1) )
Copy link
Contributor

Choose a reason for hiding this comment

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

Enclosed in () for readability?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no to initialize variable as array

if: github.event.pull_request.merged == true
env:
BRANCH: master
KEYS: "ccache-linux-ubuntu ccache-Build-linux-debian ccache-Build-linux-android ccache-Build-linux-arm64"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do they find the cache entries with timestamps in them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it finds all entries including entries with timestamps

@mryzhov mryzhov closed this Sep 29, 2023
@mryzhov mryzhov deleted the github_actions/cleanup_cache branch October 10, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants