Search code examples
buildopenshiftkubernetes-helm

Rebuild project with helm


Unable to start build pods for helm project with helm

I am wondering what is the best way to rebuild pods in a helm project on openshift. I am working with java S2i images on openshift 3.10 / 3.11. After updating my Java Code in my repository I would like to start builds.

Eventually I didn't find a solution to solve this problem. For a new deployment I set a timestamp inside the metadata of the deployment config.

So my question is how to trigger new build with helm? Is there a better way as oc start build?


Solution

  • Based on the information in the comments, I assume you need to set the correct trigger for your OpenShift image builds. The straight-forward approach seems to be to rebuild the image on every change in the repo. Therefore you should not explicitly state the commit in the BuildConfig and set a Webhook-Trigger from your code repo. For github, add this trigger to your BuildConfig:

    {
      "type": "GitHub",
      "github": {
        "secret": "secret101"
      }
    }
    

    Set your github webhook to call http://<openshift_api_host:port>/osapi/v1/namespaces/<namespace>/buildconfigs/<name>/webhooks/<secret>/github More details can be found in the documentation: https://docs.openshift.com/enterprise/3.0/dev_guide/builds.html#webhook-triggers

    If you need to set the commit-ref explicitly in the BuildConfig, there is an alternative: You can add the ConfigChange-Trigger to your BuildConfig:

    {
      "type": "ConfigChange"
    }
    

    But for now, according to the documentation, you need to add a new BuildConfig each time to trigger the build:

    Configuration change triggers currently only work when creating a new BuildConfig. In a future release, configuration change triggers will also be able to launch a build whenever a BuildConfig is updated.

    See https://docs.openshift.com/enterprise/3.0/dev_guide/builds.html#config-change-triggers