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

Instructions on how to run manually for private project? #48

Closed
Daenyth opened this issue Sep 25, 2018 · 23 comments
Closed

Instructions on how to run manually for private project? #48

Daenyth opened this issue Sep 25, 2018 · 23 comments

Comments

@Daenyth
Copy link
Contributor

Daenyth commented Sep 25, 2018

I'd like to use this on my company's codebase to help save maintenance time. Is that possible?

@fthomas
Copy link
Member

fthomas commented Sep 25, 2018

Yes, this should be easy with a small code change. Here is what you'd need to do:

  1. change githubLegacy.myLogin in githubLegacy.scala to the login of the user you want to use to create PRs
  2. create a file ~/.github/tokens/$myLogin with a GitHub access token for the user myLogin
  3. make sure curl, firejail, git, and sbt are installed
  4. update repos.md
  5. run sbt core/run periodically

If you try this, let me know if it works. And I'm open to make this whole process as easy as possible.

@fthomas
Copy link
Member

fthomas commented Sep 27, 2018

One thing I forgot: change the committer name and email in gitLegacy.setUserSteward to the name and email of your bot account. This is not critical but it would be strange if @scala-steward would be a committer in your private repos.

It would be nice if we could at some point configure these with PureConfig.

@fthomas
Copy link
Member

fthomas commented Oct 9, 2018

There is now a Config class that contains all the things one wants to change when running Scala steward.

@fthomas fthomas added the help wanted Extra attention is needed label Oct 12, 2018
@Philippus
Copy link
Contributor

I tried this out. By default a fork is made of the project under the specified username, for our setup cloning and then raising the PR directly would be preferred.
I also got a 422 Unprocessable Entity after the Create PR-step, not sure what could be the cause of that.

@fthomas
Copy link
Member

fthomas commented Oct 15, 2018

@Philippus Thanks for your feedback! Creating PRs without forking only works if the bot account has write access to the repos it updates, right? So it is unlikely that I'll implement this myself since I'm only operating Scala steward for public repos for which the bot has no write access.
I haven't seen that 422 Unprocessable Entity error before. Is a PR actually created or does this error happen before creating a PR?

@fthomas
Copy link
Member

fthomas commented Nov 12, 2018

Note that #148 changed how the GiHub password / access token is passed to Git. The configuration of a token file has been replaced by an askpass program that Git invokes to retrieve the password.

@fthomas
Copy link
Member

fthomas commented Nov 21, 2018

#161 allows to pass configuration parameters as command-line options. So scala-steward does not need to be recompiled to change the configuration.

@nafg
Copy link
Contributor

nafg commented Feb 1, 2019

What about just running it on a local project on my laptop? Specifically the logic that modifies the .sbt files.

@fthomas
Copy link
Member

fthomas commented Feb 1, 2019

scala-steward is not designed to run on single projects. I think the best option here would be to create some kind of sbt-steward plugin that shares the logic for modifying source files with scala-steward. If you'd like to work on this, I could create appropriate repos at https://github.com/scala-steward-org

@nafg
Copy link
Contributor

nafg commented Feb 1, 2019 via email

@fthomas
Copy link
Member

fthomas commented Feb 1, 2019

I'd say it is already easy to move that part out. All the logic that modifies source code is currently in Update.replaceAllIn.

@blast-hardcheese
Copy link
Contributor

blast-hardcheese commented Feb 2, 2019

It seems as though

create a file ~/.github/tokens/$myLogin with a GitHub access token for the user myLogin

is no longer required as well

@blast-hardcheese
Copy link
Contributor

I'm starting to attempt to run this against our internal GHE repos -- two issues:

  1. Attempting to run scala-steward outside of docker in OSX produces:
2019-02-02 06:17:48,379 INFO  Add global sbt plugins
2019-02-02 06:17:48,531 INFO  Clean workspace /opt/docker/workspace
0
2019-02-02 06:17:48,866 INFO  ──────────── Total time: run: 532ms ────────────
2019-02-02 06:17:48,895 INFO  Shutting down connection pool: curAllocated=0 idleQueues.size=0 waitQueue.size=0 maxWaitQueueLimit=256 closed=false
  1. Attempting to run the docker instructions from README.md yields:
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/opt/docker/bin/scala-steward\": stat /opt/docker/bin/scala-steward: no such file or directory": unknown.

because we're -v $STEWARD_DIR:/opt/dockering
Modifying the command to

docker run \
  -v $STEWARD_DIR/workspace:/opt/docker/workspace \
  -v $STEWARD_DIR/misc:/opt/docker/misc \
  -v $STEWARD_DIR/.github:/opt/docker/.github \
  -it scala-steward:0.1.0-SNAPSHOT \
  --workspace  "/opt/docker/workspace" \
  --repos-file "/opt/docker/misc/repos.md" \
  --git-author-name "Scala steward" \
  --git-author-email ${EMAIL} \
  --github-api-host "${GITHUB_HOST}" \
  --github-login ${LOGIN} \
  --git-ask-pass "/opt/docker/.github/askpass/$LOGIN.sh"

gets us back to

2019-02-02 06:21:07,489 INFO  Add global sbt plugins
2019-02-02 06:21:07,613 INFO  Clean workspace /opt/docker/workspace
0
2019-02-02 06:21:07,939 INFO  ──────────── Total time: run: 478ms ────────────
2019-02-02 06:21:07,957 INFO  Shutting down connection pool: curAllocated=0 idleQueues.size=0 waitQueue.size=0 maxWaitQueueLimit=256 closed=false

@blast-hardcheese
Copy link
Contributor

Oh, of course. I missed the leading - in the repos.md. Now I'm just getting 302, continuing to debug.

@blast-hardcheese
Copy link
Contributor

Ah, and the last issue was my GITHUB_HOST variable was incorrect (left off the /v3/api suffix). Everything is working great now, I'll open a PR with the alterations to the docker run command

@tjheslin1
Copy link
Contributor

I believe I'm having the same issue. @blast-hardcheese looking forward to your README update!

@fthomas fthomas added documentation and removed help wanted Extra attention is needed labels May 26, 2019
@cchantep
Copy link
Contributor

cchantep commented Jul 9, 2019

Hi, first thx for this great tool. I would be interested to understand how this would work with private repos, specially how would it fork? Is there any plan so that the PR would be push directly on the original repo (w/ appropriate permissions) ?

@fthomas
Copy link
Member

fthomas commented Jul 9, 2019

@cchantep You have two options.

  1. Use a user with appropriate permissions to read and fork you repos.
  2. Use a user that has permissions to create pull requests in your repos and run with --do-not-fork (Add configuration to disable forking #208) so that repos are not forked and pull requests are directly created in the target repositories.

@ChristopherDavenport
Copy link
Contributor

We use a repo with a git submodule to avoid repo interactions.

@cchantep
Copy link
Contributor

cchantep commented Jul 9, 2019

Thx @fthomas, second option seems fine for private enterprise repos.

@cchantep
Copy link
Contributor

Have create a PR with some suggestion for the related documentation.

BTW is there any way/plan to support repository where SBT is not setup at the root of the repo?

@fthomas
Copy link
Member

fthomas commented Jul 10, 2019

@cchantep #678 should also take care of repositories where the build is not in the root directory.

@fthomas
Copy link
Member

fthomas commented Jul 10, 2019

Fixed by #683.

@fthomas fthomas closed this as completed Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants