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 documentation for workspace ownership mismatches #3284

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,16 @@ More information about using the `--scalafix-migrations` and `--artifact-migrati
The workspace directory (specified with `--workspace`) provides a location for cache and temporary files.

It is important to persist this workspace between runs. Without this, Scala Steward will be unable to observe
repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly.
repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly.

Furthermore, `git` requires the workspace directory to be owned by the same user that will run Scala Steward.
If there is an ownership mismatch, `git` may print error messages like

> fatal: detected dubious ownership in repository …

or

> fatal: not in a git directory

### Private repositories

Expand Down Expand Up @@ -203,7 +212,6 @@ pipelines:
There is multiple articles on how to run Scala Steward on-premise:

* [Running Scala Steward On-premise](https://engineering.avast.io/running-scala-steward-on-premise)
* [Running scala-steward periodically on AWS Fargate](https://medium.com/@tanishiking/running-scala-steward-periodically-on-aws-fargate-3d3d202f0f7)
* [Scala StewardとGitHub Actionsで依存ライブラリの更新を自動化する](https://scalapedia.com/articles/145/Scala+Steward%E3%81%A8GitHub+Actions%E3%81%A7%E4%BE%9D%E5%AD%98%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%81%AE%E6%9B%B4%E6%96%B0%E3%82%92%E8%87%AA%E5%8B%95%E5%8C%96%E3%81%99%E3%82%8B)
* [Centralized Scala Steward with GitHub Actions](https://hector.dev/2020/11/18/centralized-scala-steward-with-github-actions)
* [Big Timesavers for Busy Scala Developers](https://speakerdeck.com/exoego/big-timesavers-for-busy-scala-developers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,18 @@
slurpOptions: SlurpOptions = Set.empty
): F[List[String]] = {
val extraEnv = List("GIT_ASKPASS" -> config.gitAskPass.pathAsString)
processAlg.exec(gitCmd ++ args.toList, repo, extraEnv, slurpOptions)
processAlg
.exec(gitCmd ++ args.toList, repo, extraEnv, slurpOptions)
.recoverWith {
case ex: ProcessFailedException
if ex.getMessage.contains("fatal: not in a git directory") =>
// `git status` prints a more informative error message than some other git commands, like `git config`
// this will hopefully print that error message to the logs in addition to the actual failure
processAlg
.exec(Nel.of("git", "status"), repo, List.empty, slurpOptions)
.attempt
.void >> ex.raiseError

Check warning on line 164 in modules/core/src/main/scala/org/scalasteward/core/git/FileGitAlg.scala

View check run for this annotation

Codecov / codecov/patch

modules/core/src/main/scala/org/scalasteward/core/git/FileGitAlg.scala#L162-L164

Added lines #L162 - L164 were not covered by tests
}
}

private def git_(args: String*)(repo: File): F[List[String]] =
Expand Down
12 changes: 10 additions & 2 deletions modules/docs/mdoc/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,16 @@ More information about using the `--scalafix-migrations` and `--artifact-migrati
The workspace directory (specified with `--workspace`) provides a location for cache and temporary files.

It is important to persist this workspace between runs. Without this, Scala Steward will be unable to observe
repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly.
repo-specific preferences (such as [pullRequests.frequency](repo-specific-configuration.md)) correctly.

Furthermore, `git` requires the workspace directory to be owned by the same user that will run Scala Steward.
If there is an ownership mismatch, `git` may print error messages like

> fatal: detected dubious ownership in repository …

or

> fatal: not in a git directory

### Private repositories

Expand Down Expand Up @@ -203,7 +212,6 @@ pipelines:
There is multiple articles on how to run Scala Steward on-premise:

* [Running Scala Steward On-premise](https://engineering.avast.io/running-scala-steward-on-premise)
* [Running scala-steward periodically on AWS Fargate](https://medium.com/@tanishiking/running-scala-steward-periodically-on-aws-fargate-3d3d202f0f7)
* [Scala StewardとGitHub Actionsで依存ライブラリの更新を自動化する](https://scalapedia.com/articles/145/Scala+Steward%E3%81%A8GitHub+Actions%E3%81%A7%E4%BE%9D%E5%AD%98%E3%83%A9%E3%82%A4%E3%83%96%E3%83%A9%E3%83%AA%E3%81%AE%E6%9B%B4%E6%96%B0%E3%82%92%E8%87%AA%E5%8B%95%E5%8C%96%E3%81%99%E3%82%8B)
* [Centralized Scala Steward with GitHub Actions](https://hector.dev/2020/11/18/centralized-scala-steward-with-github-actions)
* [Big Timesavers for Busy Scala Developers](https://speakerdeck.com/exoego/big-timesavers-for-busy-scala-developers)
Expand Down