Created
October 21, 2013 03:22
-
-
Save otsuarez/7078186 to your computer and use it in GitHub Desktop.
creating an rpm (or deb) package from a tgz file using a jenkins job and scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # http://jenkins.example.com/job/Deploy_Pkg/ | |
if [ ! -d ${REPO_HOME}/${ENV} ]; | |
then | |
mkdir -p ${REPO_HOME} | |
fi | |
pwd | |
ls -alR | |
echo "environment:" | |
echo $ENV | |
echo "jenkins home: ${JENKINS_HOME} " | |
sudo /usr/local/acme/jenkins/deployPkg.sh ${ENV}/${PACKAGE_NAME} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sudo -u sysop scp "/opt/jenkins-data/repo/$1" server1:/var/tmp/ | |
PKG=`basename $1` | |
echo "checking rpm file in qa" | |
sudo -u sysop ssh server1 "rpm -ivvh --test /var/tmp/${PKG}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://jenkins.example.com/job/# http://jenkins.example.com/job/packing | |
rm -fr * | |
## JOB PARAMETERS | |
PKG_NAME=${name} | |
VERSION=${version} | |
ITERATION="RC${BUILD_NUMBER}" | |
#ENV="STAGING" | |
ENV=${ENV} | |
## GLOBAL PARAMETERS | |
## file options | |
OUTPUT_TYPE="rpm" | |
INPUT_TYPE="dir" | |
## metadata | |
VENDOR="acme" | |
LICENSE="GPL Code" | |
MAINTAINER="<sysop-team@acme.com>" | |
## ENV PARAMETERS | |
# env :: < QA | STAGING | PROD > | |
QA_USER="httpd" | |
QA_GROUP="httpd" | |
STAGING_USER="httpd" | |
STAGING_GROUP="httpd" | |
PROD_USER="www-data" | |
PROD_GROUP="www-data" | |
QA_PREFIX="/home/www/sites" | |
STAGING_PREFIX="/var/www/sites" | |
PROD_PREFIX="/var/www/sites" | |
# package specific vars | |
NAME="panel" | |
DESCRIPTION="The new panel implementation deployed in site/admin/acme folder" | |
URI="http://www.github.com/acme-inc/panel" | |
ARCH="noarch" | |
COMPONENT="site" | |
CATEGORY="site" | |
COMPONENT_PREFIX="panel.acme.com" | |
# DYNAMIC VARS | |
PACKAGE_NAME_PREFIX="acme-$COMPONENT" | |
USER="httpd" | |
GROUP="httpd" | |
PREFIX="${QA_PREFIX}/${COMPONENT_PREFIX}" | |
wget http://jfrog.example.com//artifactory/simple/panel//${name}-${version}.zip | |
mkdir ${name} | |
cd ${name} | |
unzip ../${PKG_NAME}-${VERSION}.zip | |
cd .. | |
fpm -t ${OUTPUT_TYPE} -s ${INPUT_TYPE} --prefix ${PREFIX} --name ${NAME} --version ${VERSION} --iteration ${ITERATION} --architecture ${ARCH} --maintainer ${MAINTAINER} --description "\"${DESCRIPTION}\"" --url ${URI} --rpm-user ${USER} --rpm-group ${GROUP} -C ${NAME} . | |
rpm -ivh ${PKG_NAME}-${VERSION}-${ITERATION}.noarch.rpm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment