Upload
deveo
View
689
Download
2
Embed Size (px)
Citation preview
How to create a localAndroid open source
project mirror
1. Obtain necessaryinformation
Before you set up a local Android open sourceproject mirror using Deveo, you need to know:
correct at time of publishing
• The current Android Git server address
android.googlesource.com
correct at time of publishing
•Deveo server address
app.deveo.com
•Name for the Deveo project wewish to setup the local android open source project mirror
• Your Deveo plugin key, company key, andaccount key
These can be found in your user preferenceslocated in the top right of the Deveoweb
interface
• Your Deveo username
• Your company name in DeveoThe company name one you type whenever you
log in to Deveo.
2. Create the Deveo projectfor ourmirror
Wewill create the project programmaticallythroughDeveo REST APIs. But first, lets exportthe Android open source project Git server
URL, Deveo plugin key, company key and youraccount key, as well as the project name and
the Deveo URL as shell variables...
export ANDROID_URL=android.googlesource.com
export PLUGIN_KEY=3a12d59d6220aa024cb45b8c7b82db12
exportCOMPANY_KEY=c18c6317641b13223228b1cd7254e9b8
exportACCOUNT_KEY=462c0f154875824a626c81a26ab3212f
export DEVEO_URL=app.deveo.com
export DEVEO_PROJECT=my-android-open-source-project-fork
export DEVEO_USERNAME=ilmarideveocom
REMEMBER TOREPLACE THE EXAMPLEKEYS, URLS ETC.WITHYOUROWN
For example:
Now use the following curl command to createa newDeveo project in Deveo:
curl -X POST \
-H "Accept: application/vnd.deveo.v1" \
-H "Authorization: deveoplugin_key='$PLUGIN_KEY',company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY" \
-H "Content-Type: application/json" \
-d '{ "id": "$DEVEO_PROJECT", "name":"$DEVEO_PROJECT" }' \
https://$DEVEO_URL/api/projects
Check the results from theweb interface.There should be a new project in your Deveo
dashboard with the appropriate name.
3. Create the repositories
Create a Git repository in Deveo, using thefollowing curl snippet:
curl -X POST \
-H "Accept: application/vnd.deveo.v1" \
-H "Authorization: deveoplugin_key='$PLUGIN_KEY',company_key='$COMPANY_KEY',account_key='$ACCOUNT_KEY'" \
-H "Content-Type: application/json" \
-d '{ "id": "platform/manifest", "type": "git"}' \
https://$DEVEO_URL/api/projects/$DEVEO_PROJECT/repositories
Grab it from:
https://github.com/Deveo/local-android-open-source-project-mirror
Since it would be tedious to copy-paste thecode snippet over and over for each repositoryin themanifest.xml file, we created an XSL
template that can be used to read and create afile containing one curl snippet for each
repository.
4. Clone the originalrepositories from officialAndroid open sourceproject repository
Clone the repositories using --bare switch inorder to store the repositories within the
hierarchical structure in the local filesystem.
For example:
With themanifest repository, wewould do as follows:
cd platform/manifestgit remote add deveohttps://$DEVEO_USERNAME@$DEVEO_URL/$DEVEO_COMPANY/projects/$DEVEO_PROJECT/repositories/git/platform/manifestgit push --mirror deveocd -
Get the template here:https://github.com/Deveo/local-android-open-source-project-mirror
Tomake this easier, we've used a similartemplate based approach for going through allrepositories.
5. Push the repositories tothe Deveo project
To push repositories to Deveo, go to thedirectory of the repository, add a new remoteto the repository pointing to the Deveorepository URL, and finally, push the changesusing --mirror switch.
For example,With themanifest repository,wewould do as follows:
cd platform/manifest git remote adddeveohttps://$DEVEO_USERNAME@$DEVEO_URL/$DEVEO_COMPANY/projects/$DEVEO_PROJECT/repositories/git/platfor m/manifest git push --mirror deveo cd -
For this snippet to work we need to exportDeveo username and company name as
command line variables.
For example:export DEVEO_USERNAME=ilmarideveocomexport DEVEO_COMPANY=deveo
Like in the previous two steps, our XSLtemplate based approach takes care of the
heavy lifting and copy-pasting.
Get the XSL here:https://github.com/Deveo/local-android-open-source-project-mirror
6. Test everythingworks
Now you have all of the repositories pushed toDeveo, youmust test things out following the
official Android open source projectinstructions, and using Deveo as the clone URL.
For example, run this repo command toinitialize a new client from your freshly created
local mirror:
repo init -uhttps://[email protected]/deveo/projects/aosp-testi/repositories/git/platform/manifest
Howdid you get on?
Let us know!Tweet us@DeveoTeam