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

Retain pre-existing remote build cache config #680

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

gabrielfeo
Copy link

Retain pre-existing remote cache configuration when setting the cache path, by never replacing an existing cache. Also support using the Develocity connector and warn in case the build has a custom cache type, for which the script cannot set the cache path.

Closes #507

@gabrielfeo gabrielfeo force-pushed the gaf/support-authenticated-build-cache branch from af19e10 to 88de0b7 Compare November 12, 2024 20:16
@gabrielfeo
Copy link
Author

Hi! This is a suggested fix for that issue. If you decide to accept this, I've only tested it briefly, because I saw in other PRs that you have many workflows that can test it better.

@erichaagdev
Copy link
Member

Hi, @gabrielfeo. 👋

Thank you very much for your continued interest in improving the Develocity Build Validation Scripts.

What makes this more challenging is we must also continue to support the Gradle Enterprise plugin.

Prior to invoking the build, we call the Develocity API to query for several custom values in order to "recreate" the build as it was run in CI. This includes values like the repository, commit ID, branch, etc. You can see the full list here.

read_build_params_from_build_scan_data() {
if [ -z "${git_repo}" ]; then
git_repo="${git_repos[0]}"
project_name="$(basename -s .git "${git_repo}")"
fi
if [ -z "${git_branch}" ]; then
git_branch="${git_branches[0]}"
fi
if [ -z "${git_commit_id}" ]; then
git_commit_id="${git_commit_ids[0]}"
fi
if [ -z "${remote_build_cache_url}" ]; then
remote_build_cache_url="${remote_build_cache_urls[0]}"
fi
if [ -z "${tasks}" ]; then
tasks="${requested_tasks[0]}"
remove_clean_from_tasks
fi
}

How I've always wanted to handle this is by updating the API call to return the configured remote build cache type. This is visible in a build scan and available in the Develocity API. The remote build cache can be configured accordingly from there. Unfortunately, the API client used by the scripts is closed source so this couldn't be implemented by an external contributor.

That being said, I will go ahead and leave this PR open to be discussed with the team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build Validation Scripts do not retain GE-specific remote cache config
2 participants