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

[Dependency Cache] Fix Dependency Cache #138

Merged
merged 4 commits into from
Jan 15, 2025
Merged

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Jan 15, 2025

Related: #135

Description

As part of #135 and this last 1dda7bd commit I incorrectly removed the DEP_CACHE_FOLDER_NAME variable. Without this variable set, placing Gradle dependency cache is not working as expected due to the fact that this DEP_CACHE_FOLDER_NAME variable is now unbound. And this makes this whole dependency cache solution not working at all.


Testing Instructions

Base on this WCAndroid##13303 PR and this test commit, looking at its corresponding build:

  1. Notice that during the cache restoration process on a specific job (ie. Mobile App) the cache is being placed as expected.
  2. Looking at the network activity of a specific job (ie. Mobile App), make sure that the network activity is minimal and close to zero (ie. Wall clock time spent on network requests | 0s.

  • I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.

As part of #135 and this last 1dda7bd
commit I incorrectly removed the 'DEP_CACHE_FOLDER_NAME' variable.
Without this variable set, placing Gradle dependency cache is not
working as expected due to the fact that this 'DEP_CACHE_FOLDER_NAME'
variable is now unbound. And this makes this whole dependency cache
solution not working at all.
@ParaskP7 ParaskP7 added bug Something isn't working tooling labels Jan 15, 2025
FYI: Lint is now failing otherwise: https://buildkite.com/automattic/
ci-toolkit-buildkite-plugin/builds/
894#01946971-8ca9-4e6b-8024-da9e25f85121

PS: I wasn't aware about this process and thus missed updating both, the
'README' and 'CHANGELOG' with 3.9.0 release info after merging #135 by
creating a separate 'release/3.9.0' branch and PR for release purposes.
Instead, I just went and drafted a new release directly from GitHub and
the project's releases' page.

Example Release Process Related PR: https://github.com/Automattic/
a8c-ci-toolkit-buildkite-plugin/pull/137
ParaskP7 added a commit to woocommerce/woocommerce-android that referenced this pull request Jan 15, 2025
FYI: This change is done for testing purposes and until the below
'A8C CI Toolkit' #138 PR gets merged to 'trunk'. When that's
done, the 'a8c-ci-toolkit' will be updated to '3.9.1' instead.

A8C CI Toolkit PR: [Dependency Cache] Fix Dependency Cache #138
- Automattic/a8c-ci-toolkit-buildkite-plugin#138
@ParaskP7 ParaskP7 marked this pull request as ready for review January 15, 2025 10:40
@ParaskP7 ParaskP7 requested a review from wzieba January 15, 2025 10:40
README.md Outdated
@@ -26,7 +26,7 @@ steps:
restore_cache $(hash_file package-lock.json)

plugins:
- automattic/a8c-ci-toolkit#3.8.0:
- automattic/a8c-ci-toolkit#3.9.0:
Copy link
Contributor

Choose a reason for hiding this comment

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

I see a 3.9.0 release already in the repo, perhaps it was created too early? Indeed it's best to make a new release following https://github.com/Automattic/a8c-ci-toolkit-buildkite-plugin?tab=readme-ov-file#releasing. Perhaps you can delete that one with its tag as well? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I feel like it should be 3.9.1, right?

Copy link
Member

Choose a reason for hiding this comment

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

Or maybe even this should be unchanged in this PR, and only bumped in the release PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👋 @iangmaia and @wzieba yea, I wasn't aware about the release process and thought that we are just creating a tag. Maybe let's keep this 3.9.0 release as is and I'll create a new 3.9.1 release right now, following the release process, after merging this PR. Wdyt? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or maybe even this should be unchanged in this PR, and only bumped in the release PR?

Lint fails otherwise, and actually @AliSoftware did the same on this #139 that just got merged (plus this). 😊

Copy link
Contributor

@iangmaia iangmaia left a comment

Choose a reason for hiding this comment

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

👍

@ParaskP7 ParaskP7 merged commit 8d3bf18 into trunk Jan 15, 2025
13 checks passed
@ParaskP7 ParaskP7 deleted the gradle/fix-dependency-cache branch January 15, 2025 11:11
ParaskP7 added a commit that referenced this pull request Jan 15, 2025
ParaskP7 added a commit that referenced this pull request Jan 15, 2025
ParaskP7 added a commit to wordpress-mobile/WordPress-Android that referenced this pull request Jan 15, 2025
Release Notes: https://github.com/Automattic/
a8c-ci-toolkit-buildkite-plugin/releases/tag/3.9.1

FYI: This change points to that version of the 'A8C CI Toolkit' where
both, the #135 and #138 PRs, are merged into 'trunk', and, the new
dependency cache mechanism, per project, without 'GRADLE_RO_DEP_CACHE',
is fully operational.

A8C CI Toolkit #135 PR: [Dependency Cache] Dependency Cache on CI per
Project [without GRADLE_RO_DEP_CACHE] #135
- Automattic/a8c-ci-toolkit-buildkite-plugin#135

A8C CI Toolkit #138 PR: [Dependency Cache] Fix Dependency Cache #138
- Automattic/a8c-ci-toolkit-buildkite-plugin#138
ParaskP7 added a commit to wordpress-mobile/WordPress-Android that referenced this pull request Jan 17, 2025
* CI: Update a8c-ci-toolkit to 3.9.1

Release Notes: https://github.com/Automattic/
a8c-ci-toolkit-buildkite-plugin/releases/tag/3.9.1

FYI: This change points to that version of the 'A8C CI Toolkit' where
both, the #135 and #138 PRs, are merged into 'trunk', and, the new
dependency cache mechanism, per project, without 'GRADLE_RO_DEP_CACHE',
is fully operational.

A8C CI Toolkit #135 PR: [Dependency Cache] Dependency Cache on CI per
Project [without GRADLE_RO_DEP_CACHE] #135
- Automattic/a8c-ci-toolkit-buildkite-plugin#135

A8C CI Toolkit #138 PR: [Dependency Cache] Fix Dependency Cache #138
- Automattic/a8c-ci-toolkit-buildkite-plugin#138

* CI: Add a scheduled dependency cache job (save cache)

FYI: This job will be then used by 'buildkite-ci' and configured as a
'buildkite_pipeline_schedule' with a weekly frequency.

PS.1: The targeted 'pipeline' related jobs are:
- Mobile App
- Lint
- Unit Tests
- Android tests
PS.2: Since the 'WordPress' app is being build from the very same
codebase as the 'Jetpack' app, targeting only the 'Jetpack' related
'pipeline' jobs are enough to download and cache all the dependencies
required for both apps.

* CI: Fix wrongly defined command related double quotes on pipeline jobs

Otherwise, using 'multi-cmd' will produce 'no such file or directory'
type of errors.

* CI: Add restore cache and run on targeted pipeline related jobs only

FYI: The targeted 'pipeline' related jobs are:
- Mobile App
- Lint
- Unit Tests
- Android Tests (Commented Out)

PS.1: The 'detekt' and 'checkstyle' jobs aren't targeted because they
only take about 30+ seconds of network request to download all the
dependencies needed for those specific jobs, which is about the same
time it takes for the dependency cache to actually be restored (20+
seconds). Thus, this optimization is not really worth it for these
specific jobs. For all those other jobs targeted, it take more than a
minute of network requests to download all the dependencies needed, and
as such worth the diff is worth it.
PS.2: Although the 'Android Tests' are commented-out, I chose to include
cache restoration into those as well, just in case they will be
reactivated at some point in the future.

* CI: Move restore cache call to individual .sh script files

WCAndroid PR Comment: https://github.com/woocommerce/
woocommerce-android/pull/13303#discussion_r1916752265

* CI: Fix wrongly defined command related double quotes on pipeline jobs

When using 'single-cmd' and not using this double quotes structure it is
is producing 'did not find expected key' type of errors.

* Docs: Add gradlew test suite to comment on save cache for unit tests
ParaskP7 added a commit to Automattic/pocket-casts-android that referenced this pull request Jan 20, 2025
Release Notes: https://github.com/Automattic/
a8c-ci-toolkit-buildkite-plugin/releases/tag/3.9.1

FYI: This change points to that version of the 'A8C CI Toolkit' where
both, the #135 and #138 PRs, are merged into 'trunk', and, the new
dependency cache mechanism, per project, without 'GRADLE_RO_DEP_CACHE',
is fully operational.

A8C CI Toolkit #135 PR: [Dependency Cache] Dependency Cache on CI per
Project [without GRADLE_RO_DEP_CACHE] #135
- Automattic/a8c-ci-toolkit-buildkite-plugin#135

A8C CI Toolkit #138 PR: [Dependency Cache] Fix Dependency Cache #138
- Automattic/a8c-ci-toolkit-buildkite-plugin#138
mokagio pushed a commit that referenced this pull request Feb 3, 2025
* Gradle: Fix dependency cache

As part of #135 and this last 1dda7bd
commit I incorrectly removed the 'DEP_CACHE_FOLDER_NAME' variable.
Without this variable set, placing Gradle dependency cache is not
working as expected due to the fact that this 'DEP_CACHE_FOLDER_NAME'
variable is now unbound. And this makes this whole dependency cache
solution not working at all.

* Release: Update `README` and `CHANGELOG` with 3.9.0 release info (#135)

FYI: Lint is now failing otherwise: https://buildkite.com/automattic/
ci-toolkit-buildkite-plugin/builds/
894#01946971-8ca9-4e6b-8024-da9e25f85121

PS: I wasn't aware about this process and thus missed updating both, the
'README' and 'CHANGELOG' with 3.9.0 release info after merging #135 by
creating a separate 'release/3.9.0' branch and PR for release purposes.
Instead, I just went and drafted a new release directly from GitHub and
the project's releases' page.

Example Release Process Related PR: https://github.com/Automattic/
a8c-ci-toolkit-buildkite-plugin/pull/137

* Release: Add 'CHANGELOG' entry
mokagio pushed a commit that referenced this pull request Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants