Skip to content

Instantly share code, notes, and snippets.

Avatar

Geoffroy Jabouley gjabouley-invn

View GitHub Profile
View bashism.sh
yell() { echo "$0: $*" >&2; }
die() { yell "$*"; exit 1; }
try() { "$@" || die "cannot $*"; }
View gist:310b111e749880d62b681c8f7645e77e
# Create a branch name using short commit sha1, then push on it
BRANCH_NAME=migration/$(git log -1 --pretty=format:%h)_submodule_github
git checkout -b $BRANCH_NAME
git commit -am "[GITHUB MIGRATION] Update submodules urls on protected branches"
git push --set-upstream origin $BRANCH_NAME
# Git lfs migrate
export REPO_URL=<REPO_COMPLETE_URL>
git clone --mirror ${REPO_URL} local_folder && pushd local_folder && git lfs fetch --all && git lfs migrate --everything info
git lfs migrate import --everything --verbose --object-map=../mapping_file.map.txt --include="<PATTERNS>" (ex: *.apk,*.png)
View gist:6b9d18cd6403f89ee8ca12fe1e532357
# Jenkins symlinks becoming folders: https://support.cloudbees.com/hc/en-us/articles/216227047-After-moving-a-job-symlinks-for-folders-became-actual-folders
find $JENKINS_BUILDS_FOLDER -type d \( -name "last*Build" -o -name "lastStable" -o -name "lastSuccessful" \) -exec echo Directory: {} \;
find $JENKINS_BUILDS_FOLDER -type d \( -name "last*Build" -o -name "lastStable" -o -name "lastSuccessful" \) -exec mv {} {}.err \;
find $JENKINS_BUILDS_FOLDER -type d -name "*.err" -exec rm -rf {} \;
# Change ownership to bitnami of all folders being member of root group (not recursive)
find . -maxdepth 1 -group root -exec sudo chown -hR bitnami:bitnami {} \;
find . -maxdepth 1 -group root -exec sudo chown -hR jenkins:staff {} \;