Using GIT in Workflow Development
It is always a good idea to first test your software, or in this case workflows, before you integrate them into your live-system. Not doing this can result in malfunctioning workflows, in some cases even permanent loss of data or other irreparable damage to your system. In the following section we will give you a nice and easy way to develop workflows in the different stages of development (i.e. development, test-phase1, test-phase2, production), synchronize them and cheery-pick selected lines from one stage to the other, via Git. Git is a free software, for almost all plattforms (Windows, MacOS, Linux etc.), which was developped for excactly this purpose. In this little showcase we used Git Extensions the downloadable Git GUI. It is not necessary to download and use the Git Extension. Everything that is going to be shown in the following sections could be just as well done via Git in the command prompt.
The goal of this showcase is to show in detail how to create an architecture that enables you to create and manage different stages of development for your workflows. The following steps are going to be described in detail after some background information about some aspects of Git.
- Create a development directory
- Create its contents (wfconfing & script)
- Initialise Git
- Commit the contents of your directory to Git
- Create a branch
- Create a repository directory
- Add the repository to the development directory
- Push the contents of the development directory
- Copy of the development directory
- Rename and change contents of the copy
- Create branch of the renamed copy
- Push the contents of the copy
- Make a change in the development directory
- Commit and Push those changes
- Pull those changes from the renamed copy branch
- Cherry pick the changes you want
- Commit and Push those changes
- Pull (development)
Creating a Git repository
A repository exisits in two forms in Git:
- Personal repository
- Central repository
The personal repository is selected for every one of the desired devolpment stages to later link them to a central repository. The central repository functions as the administrator of all the personal repositories. It is the place where the data of the personal repositories is collected.
The first step is creating a folder for the first stage of development. After that you need to create the content of your workflow which consits of at least the workflow-config and one script. At this point you want to initialise this folder as a Git personal repository. To do this right-click at an empty space of the choosen folder and select "GitExt Create new repository...". The first field is the directory, which in the most cases can be left as it is. The second field is the option of the presonal and central repository. Choose personal, since this is your folder for the first stage of development.
The next steps are committing the contents of your development folder via Git and creating a branch. A commit is a snapshot of the current state your data is in a the moment
- Commit your files by right-clicking in the development folder and click on "GitExt Commit..." .
- Select all the files you want to comming and enter a "Commit message".
- Click on the commit button.
Now the data is commited via Git.
After committing the data you need to create a branch. A branch is a pointer to a commit. Each stage of development should have their own branch. To create a branch follow these steps.
- Open "Git Browse" by right-clicking somewhere in the development folder.
- Right-click on the first entry and select create new branch.
- Name the branch in a way that makes it easily distinguishable which stage of development this is.
Now since you created a branch you need to create a central repository. The central repository can be on a server or any other location you choose.
- Create a new folder and call it for exemple "Repository".
- Open the folder right-click and select "GitExt Create new repository...".
- Select "Central repository"
You have created your central repository.
Now you need to link the central repository to your exisiting development stage and the corresponding branch.
- Go into "Git Browse" GUI select your branch and
- Click on Repository --> Remote repositories
- Choose a name of your liking
- Enter the URL of the created central repository.
After linking the branch with the central repository you need to "push" the contets of the branch to the central repository. This is done by selecting the blue arrow in the Git browse that point up.
Creating the different development stages
The following steps should be repeated for every stage of development you want to set up.
- Copy the folder of your already established devlopment stage.
It is very important that you do this outside of your workflow root directory. If you do not do this kenaflow
will run into errors since it recognizes the "new" workflow and runs it. Due to the fact that both (the original and the copy) have the same ID kenaflow runs into an problem and throws an error for one of these workflows. To prevent this copy the folder outside ot the root directory and change the ID and all the other necessary entries.
The advantage of copying the folder is that the underlying structure (the connection of the personal and central repository) is maintained.
- Create a new branch for the newly created development stage in the Git browse.
- Push the contents of the new branch.