sbt-github-actions icon indicating copy to clipboard operation
sbt-github-actions copied to clipboard

“Compress target directories” step fails for Lagom projects.

Open michaelahlers opened this issue 4 years ago • 3 comments

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:

  1. 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).
  2. Make the tar command tolerant of missing directories.

michaelahlers avatar Apr 08 '21 16:04 michaelahlers

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.

djspiewak avatar Apr 10 '21 20:04 djspiewak

Or just modify the script to skip empty directories

joroKr21 avatar Apr 13 '21 14:04 joroKr21

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.

mdedetrich avatar Feb 25 '23 15:02 mdedetrich