Merge "Add Centos7 support for GoCD application"

This commit is contained in:
Jenkins 2016-09-01 14:55:33 +00:00 committed by Gerrit Code Review
commit de88788c50
2 changed files with 50 additions and 6 deletions

View File

@ -17,7 +17,7 @@
if [ "$1" == "server" ]; then
service go-server restart
elif [ "$1" == "agent" ]; then
sed -i -e "s/\(GO_SERVER=\).*/\1${2}/" /etc/default/go-agent
sed -i -e "s/\(GO_SERVER_URL=\).*/\1https:\/\/${2}:8154\/go/" /etc/default/go-agent
service go-agent restart
else
echo "Unknown node role"

View File

@ -13,14 +13,58 @@
# $1 = server/agent
echo "deb https://download.go.cd /" | sudo tee /etc/apt/sources.list.d/gocd.list
curl https://download.go.cd/GOCD-GPG-KEY.asc | sudo apt-key add -
sudo apt-get update
function add_repo {
OS=$1
if [ "$OS" == "rhel" ]; then
echo "
[gocd]
name = GoCD YUM Repository
baseurl = https://download.go.cd
enabled = 1
gpgcheck = 1
gpgkey = https://download.go.cd/GOCD-GPG-KEY.asc
" | sudo tee /etc/yum.repos.d/gocd.repo
elif [ "$OS" == "debian" ]; then
echo "deb https://download.go.cd /" | sudo tee /etc/apt/sources.list.d/gocd.list
curl https://download.go.cd/GOCD-GPG-KEY.asc | sudo apt-key add -
sudo apt-get update
fi
}
function install_gocd_agent {
OS=$1
if [ "$OS" == "rhel" ]; then
sudo mkdir /var/go
sudo yum install -y java-1.7.0-openjdk go-agent
elif [ "$OS" == "debian" ]; then
sudo apt-get install -y go-agent
fi
}
function install_gocd_server {
OS=$1
if [ "$OS" == "rhel" ]; then
sudo mkdir /var/go
sudo yum install -y java-1.7.0-openjdk go-server
elif [ "$OS" == "debian" ]; then
sudo apt-get install -y go-server
fi
}
if [ -f "/etc/redhat-release" ]; then
OS="rhel"
elif [ -f "/etc/lsb-release" ]; then
OS="debian"
else
OS="unknown"
fi
add_repo $OS
if [ "$1" == "server" ]; then
sudo apt-get install -y go-server
install_gocd_server $OS
elif [ "$1" == "agent" ]; then
sudo apt-get install -y go-agent
install_gocd_agent $OS
else
echo "Unknown node role"
fi