Skip to content

Instantly share code, notes, and snippets.

@samrocketman
Last active April 19, 2019 17:29
Show Gist options
  • Save samrocketman/9391439 to your computer and use it in GitHub Desktop.
Save samrocketman/9391439 to your computer and use it in GitHub Desktop.
Use JENKINS_HOME as a git repository with the following .gitignore file.

I initialze $JENKINS_HOME as a git repository with the following .gitignore file.

#global types to ignore
*.swp

#Only get job configs and ignore other data
!jobs/*
jobs/*/*
!jobs/*/config.xml

#Ignore expanded plugins folders because we only want jpi files
#plugins/*/*

#Ignore all plugins
plugins

#Ignore logs
logs

There is a cron job which automatically updates this repository.

@daily /app/builder/dailycommit.sh

The contents of dailycommit.sh is the following.

#!/bin/bash
#Sam Gleske (sag47)
#Tue Mar  4 14:35:59 EST 2014
#Red Hat Enterprise Linux Server release 6.5 (Santiago)
#Linux 2.6.32-431.3.1.el6.x86_64 x86_64
#GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)

if [ -z "${JENKINS_HOME}" ];then
  echo "JENKINS_HOME not set." 1>&2
  exit 1
fi
if [ ! "${USER}" = "jboss" ];then
  echo "Must be jboss user to run daily commit." 1>&2
  exit 1
fi

export PATH="/usr/local/bin:${PATH}"

cd "${JENKINS_HOME}"
git add .
git add -u
git commit -m "daily commit $(date '+%a %m/%d/%Y')"
git push origin master
@samrocketman
Copy link
Author

Contributed to open source project - github/gitignore#1763

@samrocketman
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment