redhat-developer / odo-init-image

ODO v3 no loner users this image!!! (Container for ODO v2 to setup SupervisorD inside S2I builder image.)
Apache License 2.0
7 stars 27 forks source link

Use custom innerloop scripts for java and nodejs #27

Closed kadel closed 5 years ago

kadel commented 5 years ago

Changes in this PR are automatically built on quay.io quay.io/tkral/odo-supervisord-image:dev-scripts for easier testing.

To use this image just set env variable ODO_BOOTSTRAPPER_IMAGE

export ODO_BOOTSTRAPPER_IMAGE=quay.io/tkral/odo-supervisord-image:dev-scripts

odo create nodejs 
odo push

To revert back to normal image

unset ODO_BOOTSTRAPPER_IMAGE

This update allows odo to define it's own assemble and run scripts that are more "inner-loop friendly" than those in s2i builder images. Inner-loop scripts are dev-assemble and dev-run similar to s2i scripts, and they are distributed using InitContainer similar to how odo injects supervisord into builder images.

language-scripts/image-mappings.json is a JSON file that controls what scripts should be used in a given image.

Small go program getlanguageis used to return language name based on mappings in the image-mappings.json file. This information is then used to execute dev-* scripts instead of build-in s2i scripts inside the image. If image name is not in the mapping file, the regular s2i scripts are executed.

image-mappings.json

    {
        "language": "nodejs",
        "images": [
            "rhscl/nodejs-8-rhel7",
            "rhoar-nodejs/nodejs-8",
            "rhoar-nodejs/nodejs-10"
        ]
    }

This means that in images that are named as rhscl/nodejs-8-rhel7, rhoar-nodejs/nodejs-8, rhoar-nodejs/nodejs-10 the scripts in language-scripts/nodejs will be executed instead of s2i scripts build into the images.

This effects only image specified in image-mappings.json, every other image works as before.

girishramnani commented 5 years ago

Why no hot reload for nodejs?

kadel commented 5 years ago

Why no hot reload for nodejs?

It was not reliable, so I decided to go step be step. First Introduce these scripts. Make sure that this works, and only after that start working on hot-reload.

kadel commented 5 years ago

There are no examples yet right @kadel ? I'm assuming integration tests would beadde upstream within https://github.com/openshift/odo

yes, there are even few tests running on Travis here, is something would be horribly broken we should see it. I've also tested this with https://github.com/openshift/odo/pull/1974 and everything should be ok

alanconway commented 5 years ago

looks good - doesn't change build performance for me but I understand this is to make a place for new scripts that are coming later, right?

kadel commented 5 years ago

looks good - doesn't change build performance for me but I understand this is to make a place for new scripts that are coming later, right?

yes, that is correct

kadel commented 5 years ago

Tests will be failing as the https://github.com/openshift/odo/pull/1974 is required for successful tests

openshift-ci-robot commented 5 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mik-dass

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/openshift/odo-init-image/blob/master/OWNERS)~~ [mik-dass] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment