0

I'd like to integrate a PlayFramework application into IBM Bluemix Delivery Pipeline service. When I create a new Job in a build stage I have a list of supported Builder Types:

Builder Types

Play Application uses SBT for build, but it's not in the list. If I use "Shell Script" option and invoke some sbt command the job obviously fails with error message "sbt: command not found".

Is there any way to get sbt installed on the environment where the build is executed?

Levente Holló
  • 714
  • 6
  • 13
  • Are you sure that you are using the Delivery Pipeline service and not the Continuous Delivery service? The Delivery Pipeline service reached the End of Support as of July 5, 2017. See: https://www.ibm.com/blogs/bluemix/2017/04/delivery-pipeline-retirement/ Please use the Continuous Delivery service as its replacement. See: https://console.bluemix.net/catalog/services/continuous-delivery – William 'Bill' Wentworth Aug 17 '17 at 21:59
  • Well, it is called Delivery Pipeline on the Bluemix console. I've created a Toolchain and added a service called Delivery Pipeline sitting in the "Deliver" stage of the Pipeline. On the other hand, it exactly looks the same as on the screenshots here: https://www.ibm.com/blogs/bluemix/2016/11/bluemix-continuous-delivery-is-now-live/. On the screenshots it is also called Delivery Pipeline, but the article is about "Bluemix Continuous Delivery". The second sentence declares that "it includes several components that you’re likely familiar with, including Delivery Pipeline". So DP. is part of CD.? – Levente Holló Aug 20 '17 at 17:11
  • Anyway...whatever it is called, I can find only one service on Bluemix console for this and it seems it doesn't support SBT. – Levente Holló Aug 20 '17 at 17:12

1 Answers1

1

First, a bit of background around what happens when you run a pipeline job using Continuous Delivery. Everything you put in the custom script field of a job configuration will get executed on a fresh container. This container is stood up at job execution time using a base image provided by IBM. Anything not included in said base image won't be available in your pipeline job, at least not out of the box.

Now, since said base image doesn't include SBT, you must download it and add it to your PATH manually. Below is a script you can use to do that.

#!/bin/bash
wget --output-document=/tmp/sbt.tgz https://github.com/sbt/sbt/releases/download/v1.0.0/sbt-1.0.0.tgz
tar -xvf /tmp/sbt.tgz --directory=/tmp
export PATH="/tmp/sbt/bin:$PATH"
chmod +x /tmp/sbt
// Run sbt commands below here

NOTE: I'm not familiar with SBT and how its configured, but you will probably need to play around with the Java runtimes on the container to support the scala version you are having SBT use. Java7 and 8 are included, with 7 being the default. To switch to Java8 you can include the following in your job script:

#!/bin/bash
export JAVA_HOME=$JAVA8_HOME
export PATH="$JAVA_HOME/bin/:$PATH"
java -version # Verify that we are using java8 runtime
Seth Nute
  • 61
  • 2
  • Very good, thanks. Basically it solves the issue very well. On the other hand it seem the container is neither re-used between jobs in a stage nor between stages, it's a waste of time to download and install sbt in every and each job.Is it possible to re-use the containers between jobs or stages? – Levente Holló Aug 22 '17 at 07:35
  • 1
    Unfortunately, that isn't possible with the current state of the product, you will always get a fresh container every job execution. We are in the process of adding support for reusable/custom images, but I cannot comment on what the timeline for that feature is currently. My only suggestion is to try and group your actions based on what dependencies they need in the container. AKA you could group all of your SBT related actions into the smallest number of jobs that logically makes sense such that you don't have to waste as much time downloading the SBT package itself. – Seth Nute Aug 22 '17 at 15:08
  • theoretically it should work, but in practice some kind of unhandled exception occurred during SBT compilation and I have no idea how could I debug it. Related question: https://stackoverflow.com/questions/45883825/how-to-debug-unhandled-exception-segmentation-error-in-ibm-bluemix-delivery-pi – Levente Holló Aug 25 '17 at 14:39