1

I want to use the IBM Bluemix DevOps Services, and more especially the automated pipeline to pass the last pushed commit through the build, the tests, then deploy in a test environment.

All the guides I found recommend having one repo with the server and application together, and link this repo to the pipeline. While such a configuration works, I feel like it is against the Django standards. The application (what I develop) should be separated (ie: on another git repo) from the server (which is just a part to make the application work).

I do not know how to manage this situation. Should I:

  • Write a build script which uses git clone to retrieve a build-pack like https://github.com/fe01134/djangobluemix then modify the adequate files ;
  • Find a way to attach two git repositories to one pipeline ;
  • Forget the idea and go for the IBM recommended way to have the server and the application on the same repo?
Dunatotatos
  • 1,706
  • 15
  • 25
  • Check out CI platforms, you can easily build your frontend and then serve the static files for Django. (I'm not sure you talking about frontend/backend pipeline) – Or Duan May 10 '17 at 09:56
  • 1
    Is there a reason that you can't create two pipelines? One for each repo? As far as I'm aware you can't add two repos to one pipeline at this stage – Ed Shee May 10 '17 at 11:12
  • @OrDuan No, I'm talking about a server and application pipeline. The application is a single part which cannot work alone, and needs the server to be deployed. – Dunatotatos May 10 '17 at 11:26
  • @EdShee Thank you for your suggestion. However, the application pipeline needs the server part to be build and deployed. Is it possible to share the same environment between two different pipelines? If yes, I guess the dependency part is easy to manage. – Dunatotatos May 10 '17 at 11:27
  • You aren't able to add multiple repositories to a pipeline but you can use multiple branches. I guess it's not best practice but you could have a server branch and an app branch. That would allow you to configure two different inputs to your pipeline - making sure that you place the app build/deploy stages to run after the server deploy – Ed Shee May 10 '17 at 11:36
  • BTW I also think your `git clone` example should work but feels a bit hacky. Guess all of these workarounds are though. – Ed Shee May 10 '17 at 11:38
  • 1
    sorry - more thoughts on this: if you are modifying the django buildpack why don't you just clone it, make the changes and then specify that new git url as the buildpack url (using `cf push -b BUILDPACK_URL` or adding it to the manifest) – Ed Shee May 10 '17 at 11:39
  • @EdShee This is basically the solution I was looking for. I did not know it was possible to add URL for buildpacks. I test it, and if it works, you can write an answer and I accept it. – Dunatotatos May 10 '17 at 11:52

2 Answers2

1

It seems as though what you are trying to do is create your own buildpack (by cloning the Django one and editing it).

Bluemix supports 3rd party buildpacks from any public git repo so your best bet is to do the following:

  1. Fork the django buildpack and make the required edits for your app
  2. Put your application in it's own repo
  3. Point the pipeline at this repo and configure your build/test/deploy stages
  4. Configure your "deploy" stage to use your newly modified buildpack by either including a buildpack line in your manifest.yml or modifying the deploy script to cf push -b http://yourbuildpackurl.git "${CF_APP}"
Ed Shee
  • 931
  • 1
  • 7
  • 22
0

This example just uses a file to specify the dependency on Django instead of putting it in your repo (in Step 4):

https://www.ibm.com/developerworks/cloud/library/cl-worldbank-charting-app/

Ryan
  • 658
  • 6
  • 6
  • Adding a dependency to Django is not enough. You also have to create the server part (`django-admin startproject`), and configure the server by adding the application, editing files, and applying migrations. – Dunatotatos May 10 '17 at 12:21