fabric8io / fabric8

fabric8 is an open source microservices platform based on Docker, Kubernetes and Jenkins
http://fabric8.io/
1.76k stars 504 forks source link

It's possible create a Fabric8 Environment programmatically? #6752

Open leoblanc opened 7 years ago

leoblanc commented 7 years ago

Hello, congratulations for this great platform, Fabric8 is cool!

We have a potential client which use a feature-branch Git workflow. Therefore, besides the "stable" (long-live) branches, they use many short-live feature branches and could be cool automatically create an environment when they create a new branch on a repo (so Fabric8 build and deploy the app using the code of the new Git branch).

We could create a mechanism to detect when a new branch (say "feature/ticket-123") is created on the Git repo (so, we don't need the help of Fabric8 on this side) and then programatically create the new environment on Fabric8.

So: It's possible automate the creation of an environment on Fabric8? I mean, there are any command line tool or REST API endpoint that we can use to create a new environment on Fabric8 programatically?

I have created a new namespace using kubectl (and following the naming convention used by Fabric8) but it doesn't works. Or the only current option for users is manually create the new environment using the Fabric8 web console?

Thank you very much in advance!

rawlingsj commented 7 years ago

Yes so we should be seeing something like this being available soon. The current fabric8 jenkins image doesn't persist config changes but we have addressed that and will be available soon. What this means is you can configure the https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Multibranch+Plugin to automatically create new jenkins jobs when a new git branch is created, then on any commit in that branch will run it's pipeline. We already lazily create the environments that are used in the pipeline if they don't already exist so I think we should have most things covered.

We've got quite a lot on at the moment but perhaps we can get the next release out towards the end of the week.

leoblanc commented 7 years ago

@rawlingsj Hi James, thank you very much for your info! I will review the multibranch plugin, thanks. And glad to know that Fabric8 will support this kind of requirement out-of-box very soon, cool! Thank you very much.

leoblanc commented 7 years ago

@rawlingsj Hi James, thanks again for your info! I have noted that the Pipeline Multibranch plugin is already deployed on the Fabric8's Jenkins, great. And it's triggering a new build when a commit is sent to any branch (not only to the master branch). So far so good.

However, on Fabric8 (and the created container) I see that builds are only using the master branch (even if the trigger commit was sent to a different branch). Also, I don't see any new environment created on Fabric8. So, could you please elaborate a bit more about this phrase: "We already lazily create the environments that are used in the pipeline if they don't already exist so I think we should have most things covered." Do you know about some link where I can see how achieve multibranch on Fabric8?

Thank you very much in advance!

pjmeisch-cc commented 6 years ago

any news on this? I would like to use multibranch pipelines as well. The initial Jenkins job that gets setup is no multibranch, so how to setup this or configure it correctly? An addition to the documentation would be helpful. thanks in advance