Skip to content

Commit

Permalink
feat(ublue-builder): add github groups and make it much more verbose …
Browse files Browse the repository at this point in the history
…for debugging RPM failures (#172)
  • Loading branch information
tulilirockz authored Feb 15, 2025
1 parent bcec4aa commit e69dfda
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
with:
containerfiles: |
./${{ env.IMAGE_NAME }}/Containerfile
context: ${{ env.IMAGE_NAME }}
image: ${{ env.IMAGE_NAME }}
tags: ${{ env.DEFAULT_TAG }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
4 changes: 2 additions & 2 deletions ublue-builder/Containerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM registry.fedoraproject.org/fedora:latest

COPY ublue-builder/mock-wrapper /usr/bin
COPY mock-wrapper /usr/bin

RUN dnf install -y mock rpmdevtools rpkg copr-cli && dnf clean all
RUN dnf install -y mock rpmdevtools rpkg copr-cli rpmlint && dnf clean all

ENTRYPOINT ["/usr/bin/mock-wrapper"]
30 changes: 26 additions & 4 deletions ublue-builder/mock-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,47 @@ BUILDER_NO_INCLUDE_SRPM=${BUILDER_NO_INCLUDE_SRPM:-0}
SPEC_FILE=$1
shift

set -xeuo pipefail
set -euo pipefail

if [ "$SPEC_FILE" == "" ] ; then
echo "No spec file selected"
exit 1
fi

group_start() {
WHAT=$1
shift
printf "::group:: ===$WHAT===\n"
set -x
}
group_end() {
set +x
printf "::endgroup::\n"
}

group_start "Generate spec file with rpkg"
OUTDIR=$(mktemp -d)

SPEC_PATH=$(realpath $(dirname $SPEC_FILE))

rpkg --path ${SPEC_PATH} spec --outdir $OUTDIR
cat $OUTDIR/*.spec
group_end

spectool -ag ${OUTDIR}/*.spec -C ${OUTDIR}
group_start "Lint spec file (non-blocking)"
set +euo pipefail
rpmlint "${OUTDIR}/*.spec"
set -euo pipefail
group_end

group_start "Fetch sources and generate srpm"
spectool -ag ${OUTDIR}/*.spec -C ${OUTDIR}
rpkg --path ${SPEC_PATH} srpm --outdir $OUTDIR
ls -lah ${OUTDIR}
group_end

group_start "Build RPM with mock"
if [ "$BUILDER_NO_INCLUDE_SRPM" != "1" ] ; then
mock --isolation=simple $OUTDIR/*.src.rpm $@
else
mock --isolation=simple $@
fi
group_end

0 comments on commit e69dfda

Please sign in to comment.