Interrogations about "servless CI with git" bash script -


i in reference excellent article david gageot: serverless ci git.

let me include david's script here:

#!/bin/bash if [ 0 -eq `git remote -v | grep -c push` ];   remote_repo=`git remote -v | sed 's/origin//'` else   remote_repo=`git remote -v | grep "(push)" | sed 's/origin//' | sed 's/(push)//'` fi  if [ ! -z "$1" ];   git add .   git commit -a -m "$1" fi  git pull  if [ ! -d ".privatebuild" ];   git clone . .privatebuild fi  cd .privatebuild git clean -df git pull  if [ -e "pom.xml" ];   mvn clean install    if [ $? -eq 0 ];     echo "publishing to: $remote_repo"     git push $remote_repo master   else     echo "unable build"     exit $?   fi fi 

if understand correctly script, clone initial git repository second hidden git repository unit tests run.

if unit tests pass, second hidden repository pushed initial working repository.

my questions follows:

  • how 1 supposed use script? invoking instead of git commit command? pre-commit hook?
  • what happens if changes made initial git repository when units test running?

the script little outdated here's how worked: you'd use script either push local changes or commit , push local changes. latter behaviour got rid of in newer versions of script because should have single responsibility. before running build, pull remote, clone whole repo, run build clone push. if changes pushed else in meantime, push fail. if make changes in repo in meantime, theses changes unknown clone.

here's version use everyday https://github.com/dgageot/dotfiles/blob/master/bin/git-build

hope helps.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -