Setup Gitlab for automatic builds

Webhook triggers allow you to trigger a new build by sending a request to the OpenShift API endpoint. This can be done automatically with gitlab after you have pushed code changes.

Step-by-step guide

  1. Each Build Configuration has two Trigger Urls. One for Github and the other for generic git triggers. With gitlab you have to use the generic trigger url.
    You can find the Url in your project -> browse -> builds

    triggerurls

  2. Another way to obtain the trigger url is via the commandline. Just replace test with the name of your build config. 
    user@workstation:~$ oc describe bc test
    ...
    Webhook GitHub: https://master4.tsi-af.de:8443/oapi/v1/namespaces/test/buildconfigs/test/webhooks/3bd0cf0835e4b8ed/github
    Webhook Generic: https://master4.tsi-af.de:8443/oapi/v1/namespaces/test/buildconfigs/test/webhooks/980b8feafc60d8d7/generic
    ...
  3. Now you have to set the webhook in your gitlab repository.
    You can adjust this url in your repostiroy, tab settings -> web hooks.    webhookgitlab
  4. To test your web hook either change your code and push it to the repository or use the test button in the gitlab webintefacewebhookgitlabtest
    If there aren’t any issues you the information “Hook succesfully executed” wil be shown. If you now take a look over to the
    openshift webinterface you can see the build running in a newly created pod.

    testbuild_running

Related links:

https://docs.openshift.com/enterprise/3.0/dev_guide/builds.html#webhook-triggers

 

Setup Eclipse for Openshift

This guide helps to install Eclipse for Windows in order to access Openshift 3 and to develop Applications for the PaaS.

Prerequisites

check network connecti0ns and make sure the configuration of eclipse includes a proxy.

see Window->Preferences->General->Network Connection

image2015-6-22-11-40-17

Step-by-step guide

  1. Download and install Eclipse Mars from https://eclipse.org/downloads/packages/eclipse-ide-java-and-dsl-developers/marsm4
  2. Add the update site
      1. Click from the toolbar ‘Help > Install New Sofware’
      2. Click the ‘Add’ button and a dialog appears
      3. Enter a value for the name
      4. Enter ‘http://download.jboss.org/jbosstools/updates/nightly/mars/‘ for the location. Note: Alternative updates are available from the JBoss Tools Downloads. The various releases and code freeze dates are listed on the JBoss JIRA site
      5. Click ‘OK’ to add the update site
  3. Type ‘OpenShift’ in the text input box to filter the choices
  4. Check ‘JBoss OpenShift v3 Tools’ and click ‘Next’
  5. Click ‘Next’ again, accept the license agreement, and click ‘Finish’

 

Connecting to the Server

Your Eclipse Network settings should be configured as follows to work fine behind the coporate proxy. With this settings it was possible to establish a connection to the openshift master.

image2015-6-23-7-50-44

  1. Click ‘New Connection Wizard’ and a dialog appears (see below)
  2. Select a v3 connection type
  3. Uncheck default server
  4. Enter the URL to the OpenShift server instance (e.g. https://master1.tsi-af.de:8443)
  5. Enter the username and password for the connection (e.g. joe / redhat)

image2015-6-23-7-53-3

 

A successful connection will allow you to expand the OpenShift explorer tree and browse the projects associated with the account and the resources associated with each project.

bildschirmfoto-2015-06-23-um-14-13-26

Right now (OSE 3, Drop 4) it is not possible to create a new Application with this plugin.

bildschirmfoto-2015-06-23-um-14-13-11