Overview
| Comment: | Add better support for excluding and including branches and initialization commands |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
43857910ad3e2377d2fa4300a8e85ffb |
| User & Date: | rkeene on 2017-10-23 21:43:18.420 |
| Other Links: | manifest | tags |
Context
|
2017-10-24
| ||
| 20:24 | Added a script to generate a CSS snippet for Fossil to rewrite images in the timeline check-in: 4509aefacf user: rkeene tags: trunk | |
|
2017-10-23
| ||
| 21:43 | Add better support for excluding and including branches and initialization commands check-in: 43857910ad user: rkeene tags: trunk | |
| 16:03 | Added tagging support and fixed a few bugs check-in: 90ddcf0e78 user: rkeene tags: trunk | |
Changes
Modified bin/autobuild
from [1d1fbb422c]
to [d01b60e48f].
| ︙ | ︙ | |||
43 44 45 46 47 48 49 |
fossil sync -R "${repository}" >/dev/null 2>/dev/null || :
# 4. Get a list of branches
branches=( $(fossil branch -R "${repository}" list) )
# 5. Get Fossil CI configuration from the trunk branch
## 5.a. Set default config
| | > | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
fossil sync -R "${repository}" >/dev/null 2>/dev/null || :
# 4. Get a list of branches
branches=( $(fossil branch -R "${repository}" list) )
# 5. Get Fossil CI configuration from the trunk branch
## 5.a. Set default config
excludedBranches=()
includedBranches=('')
buildCommands=('./autogen.sh || :' ./configure make)
testCommands=()
releaseCommands=()
builderID=''
projectName="$(fossil info -R "${repository}" | awk '/^project-name:/{ sub(/^project-name: */, ""); gsub(/ /, ""); print; }')"
tagSuffix=''
tagPrefix=''
|
| ︙ | ︙ | |||
73 74 75 76 77 78 79 |
## 5.d. Post-process config
if [ -z "${tagSuffix}" ]; then
if [ -n "${builderID}" ]; then
tagSuffix="-${builderID}"
fi
fi
| > > > > > | > > > > > | > > > | | > > > > > > > > | < < > | | | | | | | | | | | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 |
## 5.d. Post-process config
if [ -z "${tagSuffix}" ]; then
if [ -n "${builderID}" ]; then
tagSuffix="-${builderID}"
fi
fi
# 6. Perform any configured initialization
for cmd in "${initCommands[@]}"; do
eval "${cmd}" >/dev/null 2>/dev/null || :
done
# 7. For each branch, attempt to build
for branch in "${branches[@]}"; do
## 7.a. Only process specific branches
ignoreBranch='1'
for testBranch in "${includedBranches[@]}"; do
if echo "${branch}" | grep "${testBranch}" >/dev/null; then
ignoreBranch='0'
break
fi
done
for testBranch in "${excludedBranches[@]}"; do
if echo "${branch}" | grep "${testBranch}" >/dev/null; then
ignoreBranch='1'
break
fi
done
if [ "${ignoreBranch}" = '1' ]; then
continue
fi
## 7.b. Find the branch working directory
branchdir="$(echo "${branch}" | sed 's@[^A-Za-z0-9-]@_@g')"
builddir="${workdir}/build-output/branch-${branchdir}"
branchdir="${workdir}/working-copies/branch-${branchdir}"
mkdir -p "${branchdir}"
## 7.c. Determine current checkout ID
checkout="$(fossil info -R "${repository}" "${branch}" | awk '/^uuid:/{ print $3 "T" $4 "-" $2 }')"
builddir="${builddir}/checkout-${checkout}"
## 7.d. Determine if build even needs to occur
if [ -d "${builddir}" ]; then
continue
fi
mkdir -p "${builddir}"
## 7.e. Check-out or update the branch
(
cd "${branchdir}" || exit 1
if [ ! -f '.fslckout' ]; then
fossil open "${repository}" "${branch}" --nested
else
fossil update "${branch}"
fi
) > "${builddir}/update.log" 2>&1 || continue
## 7.f. Build and log the results, if there are any
build_pass='1'
(
cd "${branchdir}" || exit 1
for cmd in "${buildCommands[@]}"; do
( eval "set -x; ${cmd}" ) || exit 1
done
) > "${builddir}/build.log" 2>&1 || build_pass='0'
### 7.g. Test the branch
if [ "${build_pass}" = '1' ]; then
tests_pass='1'
(
cd "${branchdir}" || exit 1
for cmd in "${testCommands[@]}"; do
( eval "set -x; ${cmd}" ) || exit 1
done
) > "${builddir}/test.log" 2>&1 || tests_pass='0'
fi
### 7.h. Tag the branch with
tagsToAdd=()
if [ "${build_pass}" = '1' ]; then
tagsToAdd=("${tagsToAdd[@]}" build-pass)
if [ "${tests_pass}" = '1' ]; then
tagsToAdd=("${tagsToAdd[@]}" tests-pass)
else
tagsToAdd=("${tagsToAdd[@]}" tests-fail)
fi
else
tagsToAdd=("${tagsToAdd[@]}" build-fail)
fi
tagsToAddOpts=()
for tag in "${tagsToAdd[@]}"; do
tagsToAddOpts=("${tagsToAddOpts[@]}" --tag "${tagPrefix}${tag}${tagSuffix}")
done
fossil amend -R "${repository}" "${branch}" "${tagsToAddOpts[@]}" > "${builddir}/update.log" 2>&1
### 7.i. Upload the logs somewhere if requested
#### XXX:TODO
### 7.j. Upload build artifacts somewhere if requested
#### XXX:TODO
done
# 8. Clean up any branches that no longer exist
## XXX:TODO
|