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

[CI] Restore cache failed: Dependencies file is not found #4901

Closed
RainbowMango opened this issue May 6, 2024 · 10 comments · Fixed by #4902
Closed

[CI] Restore cache failed: Dependencies file is not found #4901

RainbowMango opened this issue May 6, 2024 · 10 comments · Fixed by #4902
Assignees
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Comments

@RainbowMango
Copy link
Member

What would you like to be added:
Investigate if there is something wrong with the GitHub Action to address the warning:

Restore cache failed: Dependencies file is not found in /home/runner/work/karmada/karmada. Supported file pattern: go.sum

You can get the warning from here: https://github.com/karmada-io/karmada/actions/runs/8957867986

References:
actions/setup-go#427

Why is this needed:

@RainbowMango RainbowMango added the kind/feature Categorizes issue or PR as related to a new feature. label May 6, 2024
@RainbowMango
Copy link
Member Author

cc @liangyuanpeng @zhzhuang-zju

@RainbowMango RainbowMango added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed kind/feature Categorizes issue or PR as related to a new feature. labels May 6, 2024
@liangyuanpeng
Copy link
Contributor

@liangyuanpeng
Copy link
Contributor

seems like the reason is this workflow have a specially workspace path:

go-version-file: ${{ env.GOPATH }}/src/github.com/karmada-io/karmada/go.mod

@zhzhuang-zju
Copy link
Contributor

Refer to https://github.com/actions/setup-go/blob/cdcb36043654635271a94b9a6d1392de5bb323a7/src/cache-restore.ts#L52-L65, when cache restore occurs, it looks for the go.sum file at the next level of the directory ${{github.workspace}} and reports an error if it is not found. In our CI scenario, variable ${{github.workspace}} is /home/runner/work/karmada/karmada, but the path of file go.sum is /home/runner/work/karmada/karmada/src/github.com/karmada-io/karmada/go.sum, so the action cannot find file go.sum and print the warning log.

The reason for the inconsistency of the directory is what @liangyuanpeng said, this workflow have a specially workspace path. By tracing the history of the code, this specially workspace path was introduced in #1221 to solve the problem of ci failing to intercept the PR which introduced API change but without deepcopy update.

@RainbowMango
Copy link
Member Author

Thanks for the details analysis, do we have a solution to fix it?

@zhzhuang-zju
Copy link
Contributor

Thanks for the details analysis, do we have a solution to fix it?

The easiest way is to remove the specially workspace path. I gave it a try and submitting a PR which introduced API change but without deepcopy update and didn't end up with the problem described in #1221, so I guess I'll have to look into the reasons for adding the specially workspace path on PR #1221.

@liangyuanpeng
Copy link
Contributor

actions/setup-go#427 (comment)
as second choice

@zhzhuang-zju
Copy link
Contributor

The easiest way is to remove the specially workspace path. I gave it a try and submitting a PR which introduced API change but without deepcopy update and didn't end up with the problem described in #1221, so I guess I'll have to look into the reasons for adding the specially workspace path on PR #1221.

Through experimentation, directly deleting the specially workspace path will not affect the functionality of the CI, as can be seen in https://github.com/zhzhuang-zju/karmada/actions/runs/8966655310/job/24622621482.

The specific reason for this is the addition of this code inside the file hack/update-codegen.sh

source "${REPO_ROOT}"/hack/util.sh
util:create_gopath_tree "${REPO_ROOT}" "${go_path}"
export GOPATH="${go_path}"

This code sets the variable ${{GOPATH}} to a path under ${REPO_ROOT}, so CI doesn't need to run under path ${{ env.GOPATH }}/src/github.com/karmada-io/karmada

cc @RainbowMango @liangyuanpeng

@RainbowMango
Copy link
Member Author

Good job! @zhzhuang-zju
#1221 fixed the issue of CI, but with #1731, we don't need it anymore.
Can you send a PR for this?

@zhzhuang-zju
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
Status: No status
Development

Successfully merging a pull request may close this issue.

3 participants