mirror of
https://github.com/lineageos4microg/docker-lineage-cicd
synced 2024-11-09 10:09:56 +01:00
Merge pull request #602 from lineageos4microg/master
Pull latest from master into lineage-21
This commit is contained in:
commit
e47658603e
6
.github/workflows/docker.yml
vendored
6
.github/workflows/docker.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
# https://github.com/docker/login-action
|
# https://github.com/docker/login-action
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
- name: Log into registry ${{ env.REGISTRY }}
|
||||||
if: github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/pull') && github.actor != 'dependabot[bot]'
|
if: github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/pull') && github.actor != 'dependabot[bot]'
|
||||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
|
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
@ -35,7 +35,7 @@ jobs:
|
|||||||
# https://github.com/docker/metadata-action
|
# https://github.com/docker/metadata-action
|
||||||
- name: Extract Docker metadata
|
- name: Extract Docker metadata
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@dbef88086f6cef02e264edb7dbf63250c17cef6c
|
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
|
||||||
with:
|
with:
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
flavor: latest=${{ github.ref == 'refs/heads/master' }}
|
flavor: latest=${{ github.ref == 'refs/heads/master' }}
|
||||||
@ -43,7 +43,7 @@ jobs:
|
|||||||
# Build and push Docker image with Buildx (don't push on PR)
|
# Build and push Docker image with Buildx (don't push on PR)
|
||||||
# https://github.com/docker/build-push-action
|
# https://github.com/docker/build-push-action
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56
|
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/pull') && github.actor != 'dependabot[bot]' }}
|
push: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/pull') && github.actor != 'dependabot[bot]' }}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM ubuntu:22.04@sha256:e6173d4dc55e76b87c4af8db8821b1feae4146dd47341e4d431118c7dd060a74
|
FROM ubuntu:22.04@sha256:77906da86b60585ce12215807090eb327e7386c8fafb5402369e421f44eff17e
|
||||||
LABEL maintainer="Nicola Corna <nicola@corna.info>"
|
LABEL maintainer="Nicola Corna <nicola@corna.info>"
|
||||||
|
|
||||||
# Environment variables
|
# Environment variables
|
||||||
|
82
src/build.sh
82
src/build.sh
@ -17,6 +17,36 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
do_cleanup() {
|
||||||
|
echo ">> [$(date)] Cleaning up" | tee -a "$DEBUG_LOG"
|
||||||
|
|
||||||
|
if [ "$BUILD_OVERLAY" = true ]; then
|
||||||
|
# The Jack server must be stopped manually, as we want to unmount $TMP_DIR/merged
|
||||||
|
cd "$TMP_DIR"
|
||||||
|
if [ -f "$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin" ]; then
|
||||||
|
"$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin kill-server" &> /dev/null || true
|
||||||
|
fi
|
||||||
|
lsof | grep "$TMP_DIR/merged" | awk '{ print $2 }' | sort -u | xargs -r kill &> /dev/null || true
|
||||||
|
|
||||||
|
while lsof | grep -q "$TMP_DIR"/merged; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
umount "$TMP_DIR/merged"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$CLEAN_AFTER_BUILD" = true ]; then
|
||||||
|
echo ">> [$(date)] Cleaning source dir for device $codename" | tee -a "$DEBUG_LOG"
|
||||||
|
if [ "$BUILD_OVERLAY" = true ]; then
|
||||||
|
cd "$TMP_DIR"
|
||||||
|
rm -rf ./* || true
|
||||||
|
else
|
||||||
|
cd "$source_dir"
|
||||||
|
(set +eu ; mka "${jobs_arg[@]}" clean) &>> "$DEBUG_LOG"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
set -eEuo pipefail
|
set -eEuo pipefail
|
||||||
|
|
||||||
repo_log="$LOGS_DIR/repo-$(date +%Y%m%d).log"
|
repo_log="$LOGS_DIR/repo-$(date +%Y%m%d).log"
|
||||||
@ -357,9 +387,9 @@ for branch in ${BRANCH_NAME//,/ }; do
|
|||||||
|
|
||||||
for codename in ${devices//,/ }; do
|
for codename in ${devices//,/ }; do
|
||||||
if [ -n "$codename" ]; then
|
if [ -n "$codename" ]; then
|
||||||
|
|
||||||
builddate=$(date +%Y%m%d)
|
builddate=$(date +%Y%m%d)
|
||||||
|
|
||||||
if [ "$BUILD_OVERLAY" = true ]; then
|
if [ "$BUILD_OVERLAY" = true ]; then
|
||||||
lowerdir=$SRC_DIR/$branch_dir
|
lowerdir=$SRC_DIR/$branch_dir
|
||||||
upperdir=$TMP_DIR/device
|
upperdir=$TMP_DIR/device
|
||||||
@ -405,6 +435,7 @@ for branch in ${BRANCH_NAME//,/ }; do
|
|||||||
echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG"
|
echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG"
|
||||||
/root/userscripts/post-build.sh "$codename" false "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!"
|
/root/userscripts/post-build.sh "$codename" false "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!"
|
||||||
fi
|
fi
|
||||||
|
do_cleanup
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -420,7 +451,8 @@ for branch in ${BRANCH_NAME//,/ }; do
|
|||||||
build_successful=false
|
build_successful=false
|
||||||
files_to_hash=()
|
files_to_hash=()
|
||||||
|
|
||||||
if (set +eu ; mka "${jobs_arg[@]}" bacon) &>> "$DEBUG_LOG"; then
|
if (set +eu ; mka "${jobs_arg[@]}" otapackage bacon) &>> "$DEBUG_LOG"; then
|
||||||
|
|
||||||
if [ "$MAKE_IMG_ZIP_FILE" = true ]; then
|
if [ "$MAKE_IMG_ZIP_FILE" = true ]; then
|
||||||
# make the `-img.zip` file
|
# make the `-img.zip` file
|
||||||
echo ">> [$(date)] Making -img.zip file" | tee -a "$DEBUG_LOG"
|
echo ">> [$(date)] Making -img.zip file" | tee -a "$DEBUG_LOG"
|
||||||
@ -435,24 +467,28 @@ for branch in ${BRANCH_NAME//,/ }; do
|
|||||||
echo ">> [$(date)] Making -img.zip file disabled"
|
echo ">> [$(date)] Making -img.zip file disabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Move the ROM zip files to the main OUT directory
|
|
||||||
echo ">> [$(date)] Moving build artifacts for $codename to '$ZIP_DIR/$zipsubdir'" | tee -a "$DEBUG_LOG"
|
echo ">> [$(date)] Moving build artifacts for $codename to '$ZIP_DIR/$zipsubdir'" | tee -a "$DEBUG_LOG"
|
||||||
cd out/target/product/"$codename"
|
cd out/target/product/"$codename"
|
||||||
|
|
||||||
|
# Move the ROM zip files to the main OUT directory
|
||||||
|
files_to_hash=()
|
||||||
for build in lineage-*.zip; do
|
for build in lineage-*.zip; do
|
||||||
cp -v system/build.prop "$ZIP_DIR/$zipsubdir/$build.prop" &>> "$DEBUG_LOG"
|
cp -v system/build.prop "$ZIP_DIR/$zipsubdir/$build.prop" &>> "$DEBUG_LOG"
|
||||||
mv "$build" "$ZIP_DIR/$zipsubdir/" &>> "$DEBUG_LOG"
|
mv "$build" "$ZIP_DIR/$zipsubdir/" &>> "$DEBUG_LOG"
|
||||||
files_to_hash+=( "$build" )
|
files_to_hash+=( "$build" )
|
||||||
done
|
done
|
||||||
|
|
||||||
cd "$source_dir/out/target/product/$codename/obj/PACKAGING/target_files_intermediates/lineage_$codename-target_files-eng.root/IMAGES/"
|
# Now handle the .img files - where are they?
|
||||||
|
img_dir=$(find "$source_dir/out/target/product/$codename/obj/PACKAGING" -name "IMAGES")
|
||||||
|
if [ -d "$img_dir" ]; then
|
||||||
|
cd "$img_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$ZIP_UP_IMAGES" = true ]; then
|
if [ "$ZIP_UP_IMAGES" = true ]; then
|
||||||
# zipping the .img files
|
|
||||||
echo ">> [$(date)] Zipping the .img files" | tee -a "$DEBUG_LOG"
|
echo ">> [$(date)] Zipping the .img files" | tee -a "$DEBUG_LOG"
|
||||||
|
|
||||||
files_to_zip=()
|
files_to_zip=()
|
||||||
images_zip_file="lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename-images.zip"
|
images_zip_file="lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename-images.zip"
|
||||||
cd "$source_dir/out/target/product/$codename/obj/PACKAGING/target_files_intermediates/lineage_$codename-target_files-eng.root/IMAGES/"
|
|
||||||
|
|
||||||
for image in recovery boot vendor_boot dtbo super_empty vbmeta vendor_kernel_boot; do
|
for image in recovery boot vendor_boot dtbo super_empty vbmeta vendor_kernel_boot; do
|
||||||
if [ -f "$image.img" ]; then
|
if [ -f "$image.img" ]; then
|
||||||
@ -465,8 +501,9 @@ for branch in ${BRANCH_NAME//,/ }; do
|
|||||||
mv "$images_zip_file" "$ZIP_DIR/$zipsubdir/"
|
mv "$images_zip_file" "$ZIP_DIR/$zipsubdir/"
|
||||||
files_to_hash+=( "$images_zip_file" )
|
files_to_hash+=( "$images_zip_file" )
|
||||||
else
|
else
|
||||||
# just copy the mages to the zips directory
|
|
||||||
echo ">> [$(date)] Zipping the '-img' files disabled"
|
echo ">> [$(date)] Zipping the '-img' files disabled"
|
||||||
|
|
||||||
|
# rename and copy the images to the zips directory
|
||||||
for image in recovery boot vendor_boot dtbo super_empty vbmeta vendor_kernel_boot; do
|
for image in recovery boot vendor_boot dtbo super_empty vbmeta vendor_kernel_boot; do
|
||||||
if [ -f "$image.img" ]; then
|
if [ -f "$image.img" ]; then
|
||||||
recovery_name="lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename-$image.img"
|
recovery_name="lineage-$los_ver-$builddate-$RELEASE_TYPE-$codename-$image.img"
|
||||||
@ -477,6 +514,7 @@ for branch in ${BRANCH_NAME//,/ }; do
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# create the checksum files
|
||||||
cd "$ZIP_DIR/$zipsubdir"
|
cd "$ZIP_DIR/$zipsubdir"
|
||||||
for f in "${files_to_hash[@]}"; do
|
for f in "${files_to_hash[@]}"; do
|
||||||
sha256sum "$f" > "$ZIP_DIR/$zipsubdir/$f.sha256sum"
|
sha256sum "$f" > "$ZIP_DIR/$zipsubdir/$f.sha256sum"
|
||||||
@ -506,37 +544,15 @@ for branch in ${BRANCH_NAME//,/ }; do
|
|||||||
/usr/bin/python /root/clean_up.py -n "$DELETE_OLD_LOGS" -V "$los_ver" -N 1 -c "$codename" "$LOGS_DIR"
|
/usr/bin/python /root/clean_up.py -n "$DELETE_OLD_LOGS" -V "$los_ver" -N 1 -c "$codename" "$LOGS_DIR"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# call post-build.sh
|
||||||
if [ -f /root/userscripts/post-build.sh ]; then
|
if [ -f /root/userscripts/post-build.sh ]; then
|
||||||
echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG"
|
echo ">> [$(date)] Running post-build.sh for $codename" >> "$DEBUG_LOG"
|
||||||
/root/userscripts/post-build.sh "$codename" "$build_successful" "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!"
|
/root/userscripts/post-build.sh "$codename" "$build_successful" "$branch" &>> "$DEBUG_LOG" || echo ">> [$(date)] Warning: post-build.sh failed!"
|
||||||
fi
|
fi
|
||||||
echo ">> [$(date)] Finishing build for $codename" | tee -a "$DEBUG_LOG"
|
echo ">> [$(date)] Finishing build for $codename" | tee -a "$DEBUG_LOG"
|
||||||
|
|
||||||
if [ "$BUILD_OVERLAY" = true ]; then
|
do_cleanup
|
||||||
# The Jack server must be stopped manually, as we want to unmount $TMP_DIR/merged
|
|
||||||
cd "$TMP_DIR"
|
|
||||||
if [ -f "$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin" ]; then
|
|
||||||
"$TMP_DIR/merged/prebuilts/sdk/tools/jack-admin kill-server" &> /dev/null || true
|
|
||||||
fi
|
|
||||||
lsof | grep "$TMP_DIR/merged" | awk '{ print $2 }' | sort -u | xargs -r kill &> /dev/null || true
|
|
||||||
|
|
||||||
while lsof | grep -q "$TMP_DIR"/merged; do
|
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
umount "$TMP_DIR/merged"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$CLEAN_AFTER_BUILD" = true ]; then
|
|
||||||
echo ">> [$(date)] Cleaning source dir for device $codename" | tee -a "$DEBUG_LOG"
|
|
||||||
if [ "$BUILD_OVERLAY" = true ]; then
|
|
||||||
cd "$TMP_DIR"
|
|
||||||
rm -rf ./* || true
|
|
||||||
else
|
|
||||||
cd "$source_dir"
|
|
||||||
(set +eu ; mka "${jobs_arg[@]}" clean) &>> "$DEBUG_LOG"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user