“Compress target directories” step fails for Lagom projects.
This error occurs:
Run tar cf targets.tar modules/user-service-api/target target target/lagom-dynamic-projects/lagom-internal-meta-project-kafka/target target/lagom-dynamic-projects/lagom-internal-meta-project-service-locator/target target/lagom-dynamic-projects/lagom-internal-meta-project-cassandra/target project/target
8
tar: target/lagom-dynamic-projects/lagom-internal-meta-project-kafka/target: Cannot stat: No such file or directory
9
tar: target/lagom-dynamic-projects/lagom-internal-meta-project-service-locator/target: Cannot stat: No such file or directory
10
tar: target/lagom-dynamic-projects/lagom-internal-meta-project-cassandra/target: Cannot stat: No such file or directory
11
tar: Exiting with failure status due to previous errors
12
Error: Process completed with exit code 2.
The problem is rooted in Lagom adding "dynamic" modules to the project which then get added (I think) to internalTargetAggregation. These targets wouldn't be useful for adjacent jobs. On a pristine project—even after test is run—those paths still won't be present. And, of course, they're already considered by virtue of the tar command including target.
My first thought is there's two ways to address this:
- Whitelist which modules should be uploaded (given where I'm at on the learning curve with GitHub Actions and this project, not sure if that's sensible).
- Make the
tarcommand tolerant of missing directories.
This is a problem that several people have encountered in different contexts! I wonder if we can leverage githubWorkflowArtifactUpload to resolve this? If we set it to false for all of the extra meta projects (the ones which don't have target directories), they'll be skipped during the compression stage.
Or just modify the script to skip empty directories
Just making a note that https://github.com/sbt/sbt-github-actions/pull/66#issuecomment-1003222894 has been confirmed to be a working solution for the issue.