简体   繁体   中英

Use an git repo from an existing app with a new app in openshift

I have created an app in openshift that uses some code of mine. It is a django project. I want to be able to create a new app using their REST API but to make the new app use the existing repo as source code. is it possible? In my openshift web console, in the existing app section It gives a url and asks me to copy it to git clone. The url is of this form

ssh://a_very_large_string@appname-domain.rhcloud.com/~/git/appname.git/

I use the REST API call like this

curl -k -X POST https://openshift.redhat.com/broker/rest/domains/rhombus/applications --user "username:password" --data "name=client1&cartridge=python-2.7&scale=false&gear_profile=small&initial_git_url=ssh://a_ver_large_string@appname-domain.rhcloud.com/~/git/appname.git/"

But the response I get is the following:

{"api_version":1.7,
 "data":null,
 "messages":[{"exit_code":216,"field":"initial_git_url",
              "index":null,
              "severity":"error",
              "text":"Invalid initial git URL"}
    ],
 "status":"unprocessable_entity",
 "supported_api_versions":[1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7],
 "type":null,
 "version":"1.7"}

How can I obtain my git repo url to use it in a new application?

From your command line, you can type in rhc apps to get all the info about your existing apps - including the git URL.

Here is the page in the documentation if you want to see it: https://access.redhat.com/site/documentation/en-US/OpenShift_Online/2.0/html/User_Guide/Viewing_Applications_for_a_User.html

You might also be interested in the article on cloning an existing application.

This StackOverflow post also includes instructions for using an existing git repo for a new app on OpenShift. I haven't tried it myself yet, but it looks promising. (The relevant info is in the first answer, but it's down a little ways, so you'll need to skim to find it.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM