Best workflow for local dev & testing
-
So I've had a look through Docs » pfSense » Development and was left wondering: what is the recommended git workflow?
What I've been doing (I'm sure it's very wrong and inefficient!) is
- clone my fork of pfSense and make a new branch for whatever patch I will work on
- connect directly to my "lab" pfSense via SFTP
- make my edits directly to the filesystem (!)
- try to keep track of which files I have touched (!!)
- test, scratch head, test more, bang head, etc.
- once things are working, copy these files back to my local git repo
- run
git ls-files -m
and thengit commit -a
and finallygit push origin {foo}
- submit PR if needed
I am pretty sure this is nuts and am looking for a saner way. I am guessing the proper way is to work out of the files in my local repo/branch and
git pull
directly from there to pfSense? Or should I be branching/editing directly on github.com and pulling from there?I also browsed through
/etc/phpshellsessions/gitsync
and I think maybe I could copy that script, rename itluckman212-gitsync
or something, edit$GIT_REPO
,$DEFAULT_BRANCH
and the$branches()
array and use that...Looking for a little guidance on what the proper way is.
-
I am not sure about others but I use UltraEdit/uex and I open files directly on the firewall over scp/sftp. When done, I make local copies in the repo, check the diffs, and commit. Opening them over scp directly in the editor makes it fairly obvious which ones have changed.
You could do git straight from the firewall or copy things back and forth but anything you do in that area could be error prone or inefficient. For example, you can't just copy back all of
/usr/local/www/
into git locally because a package or other function may have placed a file there that doesn't belong in the main git repo. There are some packages I code where I scp whole directories back and forth when working, like acme, but they are the exception not the rule.You almost have to make live edits or else you'll be doing a ton of copying/syncing every time you make a little syntax change or error fix.
-
Thank you Jim. So I guess my workflow isn't that crazy after all. Sounds similar to yours. I'm on a Mac so I'm using Sublime Text + Mountain Duck for the sftp connection. Still would like to hear from anyone else on how they do development, anything to make it smoother, safer, etc.
-
I use TortoiseGIT (on Windows) to do my git stuff..
And am using 'NetBeans' to make changes to my local copy of the repository. Upon saving a file it gets uploaded automatically to my pfSense test box. Other than that, its pretty similar. To your workflow..- Git-Sync the latest pfSense master repo to local filesystem.
- Make edits / save / test
- Commit changes to a new branch
- Push branch to my github repo
- Submit a PR
The nice thing about NetBeans is that knows the complete 'project' and offers completion of function names and some basic validation of code and variables used..