Now we can build a particular tag

This commit is contained in:
Philippe Caseiro 2015-08-20 17:35:43 +02:00
parent 82df5bffea
commit eb43a3188a
3 changed files with 24 additions and 6 deletions

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source "${TAMARIN_UTIL}" source "${TAMARIN_UTIL}"
if [ -f debian/changelog ] || [ ! -d .git ]; then if [ -f debian/changelog ] || [ ! -d .git ]; then
@ -9,7 +8,22 @@ fi
# Get commits log as changelog # Get commits log as changelog
tags=$(git tag master -l "release/*"|sort -r) BUILD_BRANCH=$(get_opt build_branch dist/ubuntu/precise/master)
BUILD_TAG=$(get_opt build_tag "last")
echo "BUILD TAG IS ${BUILD_TAG}"
if [[ ${BUILD_TAG} == "last" ]]
then
git checkout ${BUILD_BRANCH}
tags=$(git tag master -l "release/*"|sort -r)
else
info "DEBUG DEBUG DEBUG "
tagbranch="build-tag-${BUILD_TAG}"
git checkout -b ${tagbranch}
set_opt "tag_branch" "${tag_branch}"
tags="${BUILD_TAG}"
fi
if [[ -z ${tags} ]] if [[ -z ${tags} ]]
then then
@ -17,7 +31,6 @@ then
exit 2 exit 2
fi fi
git checkout $(get_opt build_branch dist/ubuntu/precise/master)
touch debian/changelog touch debian/changelog
for tag in ${tags} for tag in ${tags}

View File

@ -10,6 +10,7 @@ SRC_DIR="${BASE_DIR}/src"
PROJECT_NAME=${1} PROJECT_NAME=${1}
BUILD_BRANCH=${2} BUILD_BRANCH=${2}
BUILD_DIR=${3} BUILD_DIR=${3}
BUILD_TAG=${4}
function build_project() function build_project()
{ {
@ -19,6 +20,7 @@ function build_project()
set_opt project_name "${PROJECT_NAME}" set_opt project_name "${PROJECT_NAME}"
set_opt build_dir "${BUILD_DIR}" set_opt build_dir "${BUILD_DIR}"
set_opt build_branch "${BUILD_BRANCH}" set_opt build_branch "${BUILD_BRANCH}"
set_opt build_tag "${BUILD_TAG}"
local workspace=$(mktemp -p ${BUILD_DIR} -d)/${PROJECT_NAME} local workspace=$(mktemp -p ${BUILD_DIR} -d)/${PROJECT_NAME}
info "Build dir is ${workspace}" info "Build dir is ${workspace}"

View File

@ -62,10 +62,10 @@ EOF
if [[ -z ${BUILD_DIR} ]] if [[ -z ${BUILD_DIR} ]]
then then
echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /tmp" >> "$temp_dir/Dockerfile" echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /tmp ${BUILD_TAG}" >> "$temp_dir/Dockerfile"
else else
echo " VOLUME /build" >> "$temp_dir/Dockerfile" echo " VOLUME /build" >> "$temp_dir/Dockerfile"
echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /build" >> "$temp_dir/Dockerfile" echo " CMD /root/.tamarin/lib/build.sh ${projectName} ${BUILD_BRANCH} /build ${BUILD_TAG}" >> "$temp_dir/Dockerfile"
fi fi
exec_hooks "containerbuild" "$temp_dir" exec_hooks "containerbuild" "$temp_dir"
@ -116,7 +116,7 @@ function main {
# #
# Parsing options # Parsing options
# #
while getopts "kp:d:i:b:B:" option while getopts "kp:d:i:b:B:t:" option
do do
case $option in case $option in
k) k)
@ -137,6 +137,9 @@ do
B) B)
BUILD_BRANCH=${OPTARG} BUILD_BRANCH=${OPTARG}
;; ;;
t)
BUILD_TAG=${OPTARG}
;;
*) *)
show_usage show_usage
;; ;;