C#Bot Development Environment: Source Code
Where the source is stored
When an application is created on the Codebots Platform, a corresponding git repository is created and hosted by Codebots.
There are currently plans to allow self-nominated repositories to be included, estimated for release in late August. This would allow you to provide your own git repository and access token details for an application, which would allow the codebot to write to your designated repository instead of a Codebots-owned repository).
When you are invited onto the platform, the Codebots support team will provide you with your access details. (This is currently a manual process. Please contact support if you have not received these details).
The login details for your account will work across any of the applications which are made on your site, despite them having different URLs.
As a general rule of thumb, your git repository URL will take the format of
https://git.codebots.com/cb[subdomain]/[project-slug].git
When the source is updated
Hitting the ‘Build Application’ button from inside the Platform will trigger the codebot to build and write any changes to the application’s git repository.
Currently, the codebot writes directly to the develop
branch. If changes occur during the code writing process, the codebot will pull the latest changes and perform a git merge. If there are conflicts, the codebot will push the code with conflicts, and an status message indicating this will appear inside the Codebots Platform.
Setup project source
In order to download or pull your code from the source repository you will be required to download a git client which can either be one that uses the command line (recommended for experts) or a GUI.
If you prefer a git GUI you can find a many free and paid options available here.
For the purpose of this article we will make use of the command line (i.e, “Command Prompt” for windows, “Terminal” for Linux and Mac), but feel free to use your favourite git client.
Install Git
- Download Git from https://git-scm.com/downloads for your operating system.
- Follow the instructions to install
-
Configure your details as shown for First Time Git Setup. We only really care about the email and name. e.g
- git config –global user.name “John Doe”
- git config –global user.email johndoe@example.com
Version Control
By cloning your application repository on your development environment, you can follow a simple set of git commands to update your application.
Setup
Setup your application source code on your local environment
It is best practice to store the source on an encrypted drive (setup not covered here). From this point on, on Windows it is assumed that
G:
is your encrypted drive, and on Mac or Linux your whole drive is encrypted.
-
Setup Project Drive or Directory
Windows
All project source files should be cloned in
G:
.Mac or Linux
Create the directory
/data/repository
sudo mkdir /data cd /data sudo mkdir repository cd repository
-
Clone your repository (substituting in your provided git URL) and switch to the develop branch.
The commands to enter to clone your application repository are:cd [project drive or directory] git clone https://git.codebots.com/cb[subdomain]/[project-slug].git cd [project-slug] git checkout develop
Update
- Make the changes to your application
- Commit those changes:
git add . ; git commit -m "These are my changes"
- Make sure to do a git pull in case of any other changes from other developers:
git pull
- Push those changes to the remote git server:
git push origin master
If all of the commands ran successfully, then the latest code should be in you remote git repository. You should now be able to pull those changes onto your server environment.
Was this article helpful?