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

Improve usage of Maven cache between GitHub Actions #1656

Open
php-coder opened this issue Dec 29, 2023 · 0 comments
Open

Improve usage of Maven cache between GitHub Actions #1656

php-coder opened this issue Dec 29, 2023 · 0 comments
Assignees
Labels
ADR/needed A decision has been made and it needs to be documented area/ci
Milestone

Comments

@php-coder
Copy link
Owner

php-coder commented Dec 29, 2023

We use the same configuration everywhere:

      - name: Install JDK
        uses: actions/[email protected]
        with:
          distribution: 'adopt'
          java-version: '8'
          cache: 'maven'

So, the jobs use Maven cache by default. But there seems to be a problem that a cache might not have some dependencies and a job had to download them. Here is the example:

Cache Size: ~2 MB (1978758 B)
/usr/bin/tar -xf /home/runner/work/_temp/6da31f4c-fad8-481e-b2e2-bb721e9a8117/cache.tzst -P -C /home/runner/work/mystamps/mystamps --use-compress-program unzstd
Cache restored successfully
Cache restored from key: setup-java-Linux-maven-c34d1feb73d33e5eb28cf0d245a2f3fdfa75d7b91c9cd00f1129572c94aac6af
Received 1978758 of 1978758 (100.0%), 1.9 MBs/sec

in the middle of the log, there a lot of downloads:

[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-enforcer-plugin/3.0.0-M3/maven-enforcer-plugin-3.0.0-M3.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-enforcer-plugin/3.0.0-M3/maven-enforcer-plugin-3.0.0-M3.pom (7.3 kB at 27 kB/s)

and at the end:

Cache hit occurred on the primary key setup-java-Linux-maven-c34d1feb73d33e5eb28cf0d245a2f3fdfa75d7b91c9cd00f1129572c94aac6af, not saving cache.

The root cause is that the jobs might need different set of dependencies but they use a single cache for everyone. Also, it's not clear who is publishing that cache. It seems like, a job that the first finished, puts its dependencies to a cache.

I see the following ways to fix it:

  • all jobs will continue to use a single cache, but we need to populate it properly by a special job (that is triggered on every pom.xml modification)
  • every job will have its own cache

Anyway, we will have to manage cache manually because actions/setup-java doesn't have capabilities to adjust cache properties (actions/setup-java#551).

@php-coder php-coder added this to the 0.4.8 milestone Dec 29, 2023
@php-coder php-coder self-assigned this Dec 29, 2023
@php-coder php-coder added the ADR/needed A decision has been made and it needs to be documented label Dec 29, 2023
php-coder added a commit that referenced this issue Jan 5, 2024
php-coder added a commit that referenced this issue Jan 5, 2024
php-coder added a commit that referenced this issue Jan 6, 2024
php-coder added a commit that referenced this issue Jan 6, 2024
php-coder added a commit that referenced this issue Jan 6, 2024
php-coder added a commit that referenced this issue Jan 6, 2024
Part of #1656

[skip ci]
php-coder added a commit that referenced this issue Jan 6, 2024
php-coder added a commit that referenced this issue Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADR/needed A decision has been made and it needs to be documented area/ci
Projects
None yet
Development

No branches or pull requests

1 participant