Search code examples
gitopenshiftgit-branchopenshift-client-toolsopenshift-web-console

Create Openshift app using branch from existing repository (with `rhc create`)


The OpenShift web console allows to create a new app using a branch/tag from an existing remote repository which I do not know how to use through rhc create.

The relevant command line option --from-code URL works great for the default repository path, but how to tell which specific branch to use? I can't find anything at the OpenShift documentation or any other web resource.

I tried the following and some other variants, but without success:

rhc app create my_new_app_name python-3.3 postgresql-9.2 --from-code https://github.com/my_user/my_repository/tree/my_branch

rhc app create my_new_app_name python-3.3 postgresql-9.2 --from-code https://github.com/my_user/my_repository.git/my_branch

The resulting message:

Source code repository could not be cloned: 'https://github.com/my_user/my_repository.git/my_branch'. Please verify the repository is correct and contact support.

I need to use rhc create to create the new app, because this allows app creation with more than one cartridge (here python-3.3 and postgresql-9.2), which is not possible through the web console.


Solution

  • You were close. You can create your application from a branch by doing the following:

    rhc app create my_new_app_name python-3.3 postgresql-9.2 --from-code https://github.com/my_user/my_repository#mybranch