0
votes

We are currently thinking about an integration of Jenkins into Cloud Foundry. Since Docker is very popular for "containerizing builds" in its containers we thought that the same idea might work for CF containers in the Elastic Runtime.

Here's a rough sketch of what we want to do:

  1. From within Jenkins, push an app to Cloud Foundry that starts a Jenkins agent inside this app via java -jar slave.jar -jnlpUrl http://yourserver:port/computer/slave-name/slave-agent.jnlp given as the command run in the container
  2. Connect to this container via Jenkins and use the Jenkins agent (now running within the container) to build our application within the container
  3. Start the application within the container
  4. Run end-to-end tests against the app running in the container

My questions are:

  1. Generally speaking: do you think, this is a good idea?
  2. If so - how can we get a build pack for Cloud Foundry that provides a JDK?
  3. Is it possible to make the container run our app after it is build inside the container or do we have to push our app to another container after we build it?

Thanks a lot for your help!

1

1 Answers

2
votes

My questions are:

Generally speaking: do you think, this is a good idea?

i recommend that you ask this question to the concourse ci community slack which is at slack.concourse.ci as they have a lot of experience testing cf apps with containers. i'm not suggesting that you switch from jenkins, but rather draw upon their experience using containers, cf and ci together. concourse uses containerized builds and gives you the ability to test an app inside a container without cloud foundry and also later running as an app in cloud foundry. one thing you should watch out for if you were to use the approach you described is recycling each container that is used for a test. so generally i don't think your outline is a great idea as there would be other ways to start with a fresh container every time that are probably better for reproducibility reasons.

If so - how can we get a build pack for Cloud Foundry that provides a JDK?

the java-builpdack already has a JRE and has instructions for extending it. you could start by looking at the openjdk jre docs and sort through how to extend it for the JDK. https://github.com/cloudfoundry/java-buildpack/blob/master/docs/jre-open_jdk_jre.md

Is it possible to make the container run our app after it is build inside the container or do we have to push our app to another container after we build it?

i would strongly encourage you to use a fresh container. reproducibility and immutability are key concets to embrace for testing.