ManageAllAdminScriptsWithGit: Difference between revisions
Jump to navigation
Jump to search
(Created page with "* The admin scripts are managed by [http://git.iihe.ac.be Git] * They should be mounted on all machines managed by quattor in '''/scripts''' <br> === Git Workflow === ==== Ad...") |
No edit summary |
||
Line 1: | Line 1: | ||
__TOC__ | |||
* The admin scripts are managed by [http://git.iihe.ac.be Git] | * The admin scripts are managed by [http://git.iihe.ac.be Git] | ||
* They should be mounted on all machines managed by quattor in '''/scripts''' | * They should be mounted on all machines managed by quattor in '''/scripts''' | ||
Line 11: | Line 13: | ||
# Make your new scripts or modifications | # Make your new scripts or modifications | ||
# If you made new files/directories, prepare them for atomic commit: '''git add -N myfile''' | # If you made new files/directories, prepare them for atomic commit: '''git add -N myfile''' | ||
# Select the chunks of code you want to commit: '''git add -p''' , (explanations of letters [[ManageAllAdminScriptsWithGit# | # Select the chunks of code you want to commit: '''git add -p''' , (explanations of letters [[ManageAllAdminScriptsWithGit#Summary_Of_Git_Commands|here]]). Be as small and precise as possible for each commits. | ||
# If you want to revert the adding chunks to the index you just did : '''git reset -p''' | # If you want to revert the adding chunks to the index you just did : '''git reset -p''' | ||
# Do the commit for the chunks you selected '''git commit -m"short message" [-m"long message"]'''. The long message is optional. | # Do the commit for the chunks you selected '''git commit -m"short message" [-m"long message"]'''. The long message is optional. | ||
Line 18: | Line 20: | ||
# Make a merge request on the [http://git.iihe.ac.be git site]: <br>[[File: git_merge_request.png|700px|center]] | # Make a merge request on the [http://git.iihe.ac.be git site]: <br>[[File: git_merge_request.png|700px|center]] | ||
=== Summary Of Git Commands === | ==== Summary Of Git Commands ==== | ||
<pre> | <pre> | ||
Line 60: | Line 62: | ||
</pre> | </pre> | ||
<br> | |||
=== Adding /scripts to a machine and getting access to it === | |||
* You need to mount with nfs (or autofs) the /storage of tesla | |||
* Then create a symlink from '''/storage_mnt/storage/group/admin/iihe-scripts''' to '''/scripts''' | |||
* Or you can just include the template in '''config/nfs/storage''' in your machine, which does all this. | |||
* It is in read-only for non-root users of the '''admins''' group, so you cannot make any modifications there. | |||
* If you want access as non-root user, you need to add yourself in [http://freeipa.wn.iihe.ac.be freeipa] [accessible through tunnel only] to the '''admins''' group. | |||
<br> | |||
*[[ManageAllAdminScriptsWithSVN| | === Old Wiki page for using SVN === | ||
*[[ManageAllAdminScriptsWithSVN| here]] |
Revision as of 15:17, 11 December 2015
- The admin scripts are managed by Git
- They should be mounted on all machines managed by quattor in /scripts
Git Workflow
Adding/Modifying the scripts from your computer
- Request an account from git admins
- add your ssh key to your profile
- Do an git clone git@git.iihe.ac.be:iihe-scripts.git to download the content of iihe-scripts locally
- Change the branch name git branch -m CurrentBranch BranchImWorkingOn. The branch name should reflect what you plan on doing. Never use directly the master branch !!
You can check this worked with git branch -ra that lists local & remote branches. - Make your new scripts or modifications
- If you made new files/directories, prepare them for atomic commit: git add -N myfile
- Select the chunks of code you want to commit: git add -p , (explanations of letters here). Be as small and precise as possible for each commits.
- If you want to revert the adding chunks to the index you just did : git reset -p
- Do the commit for the chunks you selected git commit -m"short message" [-m"long message"]. The long message is optional.
- To list the last commits git log -NumberOfCommits
- Last, you need to push the local changes to the remote server : git push origin BranchImWorkingOn
- Make a merge request on the git site:
Summary Of Git Commands
# First git clone git.blahblah git checkout -b newbranch or git branch -m oldbranch newbranch git branch -ra ==> lists repo & local branches # Atomic commit (by hunks): git add -N myfile #first prepare file before patchadding git add -p y - indexer cette partie n - ne pas indexer cette partie a - indexer cette partie et toutes celles restantes dans ce fichier d - ne pas indexer cette partie ni aucune de celles restantes dans ce fichier g - sélectionner une partie à voir / - chercher une partie correspondant à la regexp donnée j - laisser cette partie non décidée, voir la prochaine partie non encore décidée J - laisser cette partie non décidée, voir la prochaine partie k - laisser cette partie non décidée, voir la partie non encore décidée précédente K - laisser cette partie non décidée, voir la partie précédente s - couper la partie courante en parties plus petites e - modifier manuellement la partie courante ? - afficher l'aide ==> this add hunks to index, needs git commit -m"" git reset -p ==> revert the adding to index git commit -m"" [-m"long message"] git diff ==> local / index git diff HEAD ==> local / repo git diff --cached ==> index / repo git log -3 ==> lists commit # Pushing git push origin newbranch ==> pushes local branch to repo & creates new repo branch
Adding /scripts to a machine and getting access to it
- You need to mount with nfs (or autofs) the /storage of tesla
- Then create a symlink from /storage_mnt/storage/group/admin/iihe-scripts to /scripts
- Or you can just include the template in config/nfs/storage in your machine, which does all this.
- It is in read-only for non-root users of the admins group, so you cannot make any modifications there.
- If you want access as non-root user, you need to add yourself in freeipa [accessible through tunnel only] to the admins group.