2. Puppet Forge Automation, which has been enabled with Continue-Integration system (for example: Cruise Control/Jenkins), will be triggered periodically based upon VCS commits to execute "puppet module build" for a new revision of puppet module located under DEV repo (for example: http://pulp-server.local.lab/pulp/puppet/qxc_dev/system/releases/q/qxc)
if [ -e ${puppet_forge_working_directory} ]; then
# copy the VCS checkout into ${puppet_forge_modules_folder}
cp -rf ${puppet_forge_working_directory}/${puppet_forge_author}/* ${puppet_forge_modules_folder}
# make sure all text file in unix format
find ${puppet_forge_modules_folder} -type f -exec dos2unix {} \;
# execute puppet module build
cd ${puppet_forge_modules_folder}
for i in `ls`; do puppet module build $i; done
# publish puppet module to dev repoid
cd ${puppet_forge_modules_folder}
for i in `ls`; do pulp-admin -u ${pulp_server_admin_name} -p ${pulp_server_admin_password} puppet repo uploads upload --repo-id ${puppet_forge_dev_repoid} --dir ${puppet_forge_modules_folder}/$i/pkg; done
pulp-admin -u ${pulp_server_admin_name} -p ${pulp_server_admin_password} puppet repo publish run --repo-id ${puppet_forge_dev_repoid}
fi
4. After puppet module verification successfully, Puppet Forge Automation will promote puppet module into PROD repo (for example: http://pulp-server.local.lab/pulp/puppet/qxc/system/releases/q/qxc) to release.
# publish module from dev repo to prod repo
for i in `echo "common thirdparty qxc"`
do
pulp-admin -u ${pulp_server_admin_name} -p ${pulp_server_admin_password} puppet repo copy --from-repo-id ${puppet_forge_dev_repoid} --to-repo-id ${puppet_forge_prod_repoid} --str-eq="name=$i" --str-eq="author=${puppet_forge_author}" --str-eq="version=${puppet_forge_version}"
done
pulp-admin -u ${pulp_server_admin_name} -p ${pulp_server_admin_password} puppet repo publish run --repo-id ${puppet_forge_prod_repoid}
# create puppet modules tar gz
if [ -d ${puppet_forge_modules_folder} ];
then
rm -rf ${puppet_forge_modules_folder}
fi
if [ -d /etc/puppet/modules ];
then
rm -rf /etc/puppet/modules
fi
mkdir -p ${puppet_forge_modules_folder}
mkdir -p ${puppet_forge_modules_folder}/${my_puppet_module_name}/etc/puppet/modules
cd ${puppet_forge_modules_folder}/${my_puppet_module_name}/etc/puppet/modules
puppet module install --module_repository http://.:${puppet_forge_prod_repoid}@${pulp_server} ${puppet_forge_author}/${my_puppet_module_name} --version ${puppet_forge_version} -i .
cd ${puppet_forge_modules_folder}/${my_puppet_module_name}
tar -zPcvpf ${puppet_forge_tar_gz_folder}/${my_puppet_module_name}-${3_digit_rtm_info}-`date +"%Y%m%d"`.${ci_buildnumber}.tar.gz `find etc -type f`
No comments:
Post a Comment