1

How can you do an sbt release from jenkins using a jenkinsfile with non-interactive sbt-release syntax?

For some reason this does not work. Locally works

sbt "release with-defaults" 

In Jenkins does not work

sh "sbt \\'release with-defaults\\'"

Output in jenkins shows

[0m[[31merror[0m] [0mNo valid parser available.[0m
[0m[[31merror[0m] [0m"release  "[0m
[0m[[31merror[0m] [0m ^[0m

I believe the quotes around "release with-defaults" are required. It seems like sbt is executing first, going into the sbt console, then trying to execute release... next which then it shows the sbt error "no valid parser available"

James
  • 1,841
  • 1
  • 18
  • 23
  • I tried adding an alias `addCommandAlias("releaseSilent", "release with-defaults")` while it works locally, it still seems like in jenkins it hangs waiting for user input. – James Sep 14 '18 at 23:57

1 Answers1

1

Try flipping your quotes: sh 'sbt "release with-defaults"', this is working for me without requiring any user input. You can also specify other options with spaces between the key and value: sh 'sbt "release with-defaults default-tag-exists-answer o"' in this case it will override a tag existing already.

Tresdon
  • 1,211
  • 8
  • 18