At the time you create an application , App Factory also creates a trunk repository of the type given by you (e.g., GIT), and associates your (the app owner's) credentials with it. The trunk contains a skeleton application that you can deploy and test. When the app owner adds users to the team, they too receive access to the repository. App Factory supports three types of repositories - the trunk, branches and tags.
This section gives the following information:
|Table of Contents|
Checking in the source code to the trunk
The first step is to check out the trunk repository to your local folder, copy your existing source code and check it in to the trunk repository. If you plan to develop your application from scratch, you can skip this section.
- Log in to the App Factory portal (for the online version, try https://appfactorypreview.wso2.com) as a user who is assigned the
Application Ownerrole or the
developerrole. Only these two user roles have permission to manage the source code and application versions. See roles/permissions list .
- Select an application from the list of apps that you own or are invited to participate in.
- The application opens. Click the Repos and Builds tab on the left panel.
- The Repositories and Builds page opens. It contains information of all versions of the application, which life-cycle stage each version is in and builds and deployment information of each version.
Click the browse icon associated with the trunk to open its repository URL in a separate window. This allows you to browse the files in the skeleton trunk created in the remote repository.
You are navigated to the repository. Log in with your App Factory credentials to see the repository files. For example, click the tree menu to see the folder structure as shown below:
NOTE: You must not perform any updates to the repository (for example, creating a branch) from the repository window. Those actions must happen from the App Factory portal to make sure the life cycle of the application is managed properly.
- Next, let's check out the remote trunk repository to your local environment. To do that, copy the trunk URL using the Copy URL icon associated with the trunk.
- Install the repository client (e.g., GIT client) in your local machine. (See http://git-scm.com/downloads/guis.)
Take a copy of the trunk repository to your local environment.
git clone <URL of the trunk>
- If you have already started developing the application, copy the contents of your existing application to the same folder that you cloned the trunk. Choose to replace any existing files such as the pom.xml.
- Change the following elements in the pom.xml file in your local folder:<groupId> : org.wso2.af<artifactId> : change to the existing app key<version> : SNAPSHOT
If you have resources associated with your application such a datasources, databases, endpoints, you must configure them before committing the source code to the trunk. See Configuring Resources.
Add, commit and push your changes to the remote repository.
git add <file or folder path> git commit -am "commit message" git push origin master
App Factory automatically builds and deploys your application every time a commit happens to the remote repository. To change this, see Auto build and deployment.
At this point, you must have the source code of the application committed in the remote repository. If you are developing the application from scratch, you already have a skeleton code available in trunk. Next step is to create a branch from the trunk.
Creating a branch
Before you start developing the code, you must create a branch from the trunk. The code in trunk is always in Development stage (first stage of the default life cycle). Creating a branch allows you to manage the source code through the entire lifecycle of an application. A new branch is similar to a new version of the application.
- In the Repositories and Builds page, go to trunk, click Create Branch, provide the version number (e.g., 1.0.0) and click the Create Branch button in the pop-up screen.
App Factory supports multiple versions of an application that can be in different lifecycle stages. You can create branches from the trunk or another branch.
- The branch contains a copy of the code checked in to trunk earlier.
- Copy its repository URL as follows:
- Using the repository URL, check out the branch to your local development environment.
You are now ready to develop the application code. See Developing the Code.