Skip to content

Commit f28587b

Browse files
ci: Send email if the reproducible build process fails
Changelog-None.
1 parent 2791c60 commit f28587b

File tree

1 file changed

+50
-15
lines changed

1 file changed

+50
-15
lines changed

.github/workflows/repro.yml

+50-15
Original file line numberDiff line numberDiff line change
@@ -19,42 +19,48 @@ jobs:
1919
- name: Git checkout
2020
uses: actions/checkout@v4
2121

22-
- name: Build environment setup
22+
- name: Build environment setup - ${{ matrix.version }}
2323
run: |
2424
echo "Building base image for ${{ matrix.version }}"
25+
echo "STEP=Build environment setup" >> "$GITHUB_ENV"
2526
sudo docker run --rm -v $(pwd):/build ubuntu:${{ matrix.version }} bash -c "\
26-
apt-get update && \
27-
apt-get install -y debootstrap && \
28-
debootstrap ${{ matrix.version }} /build/${{ matrix.version }}"
27+
apt-get update && \
28+
apt-get install -y debootstrap && \
29+
debootstrap ${{ matrix.version }} /build/${{ matrix.version }}"
2930
sudo tar -C ${{ matrix.version }} -c . | docker import - ${{ matrix.version }}
3031
31-
- name: Builder image setup
32-
run: docker build -t cl-repro-${{ matrix.version }} - < contrib/reprobuild/Dockerfile.${{ matrix.version }}
32+
- name: Builder image setup - ${{ matrix.version }}
33+
run: |
34+
echo "STEP=Builder image setup" >> "$GITHUB_ENV"
35+
docker build -t cl-repro-${{ matrix.version }} - < contrib/reprobuild/Dockerfile.${{ matrix.version }}
3336
34-
- name: Build using the builder image and store Git state
37+
- name: Build reproducible image and store Git state - ${{ matrix.version }}
3538
run: |
39+
echo "STEP=Build reproducible image and store Git state" >> "$GITHUB_ENV"
40+
3641
# Create release directory.
3742
mkdir $GITHUB_WORKSPACE/release
3843
3944
# Perform the repro build.
4045
docker run --name cl-build -v $GITHUB_WORKSPACE:/repo -e FORCE_MTIME=$(date +%F) -t cl-repro-${{ matrix.version }}
4146
4247
# Commit the image in order to inspect the build later.
43-
docker commit cl-build cl-release
48+
docker commit cl-build cl-repro
4449
4550
# Inspect the version.
46-
docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-release bash -c "make version > /repo/release/version.txt"
51+
docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-repro bash -c "make version > /repo/release/version.txt"
4752
4853
# Inspect the Git tree state.
49-
docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-release bash -c "\
54+
docker run --rm -v $GITHUB_WORKSPACE:/repo -t cl-repro bash -c "\
5055
git --no-pager status > /repo/release/git.log && \
5156
git --no-pager diff >> /repo/release/git.log"
5257
5358
# Change permissions on the release files for access by the runner environment.
5459
sudo chown -R runner $GITHUB_WORKSPACE/release
5560
56-
- name: Assert clean version and release
61+
- name: Assert clean version - ${{ matrix.version }}
5762
run: |
63+
echo "STEP=Assert clean version" >> "$GITHUB_ENV"
5864
echo 'Version:'
5965
cat release/version.txt
6066
echo -e
@@ -63,16 +69,45 @@ jobs:
6369
echo 'Release file:'
6470
ls -al release/clightning-*
6571
echo -e
66-
6772
if [ -n "$(cat release/version.txt | sed -n '/-modded/p')" ] || \
68-
[ -n "$(echo $releasefile | sed -n '/-modded/p')" ]
69-
then
73+
[ -n "$(echo $releasefile | sed -n '/-modded/p')" ]; then
7074
echo "Git Status and Diff:"
7175
cat release/git.log
7276
echo -e
73-
7477
echo 'Error: release modded / dirty tree.'
7578
exit 1
7679
else
7780
echo 'Success! Clean release.'
7881
fi
82+
83+
- name: Upload release artifact - ${{ matrix.version }}
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: release-${{ matrix.version }}
87+
path: release
88+
retention-days: 3 # Automatically delete after 3 days
89+
90+
- name: Send email on failure
91+
if: ${{ failure() }}
92+
uses: dawidd6/action-send-mail@v3
93+
with:
94+
server_address: smtp.gmail.com
95+
server_port: 587
96+
username: ${{ secrets.EMAIL_USERNAME }}
97+
password: ${{ secrets.EMAIL_PASSWORD }}
98+
from: ${{ secrets.EMAIL_USERNAME }}
99+
to: ${{ vars.DISTRIBUTION_LIST }}
100+
subject: "CI Failure: Step ${{ env.STEP }} failed for distro ${{ matrix.version }}"
101+
convert_markdown: true
102+
html_body: |
103+
<html>
104+
<body>
105+
<p>GitHub Workflow ${{ github.workflow }} Failed! For more details, click on the action below.</p>
106+
<strong>Failure Details:</strong><br/>
107+
<strong>Event: </strong>${{ github.event_name }}<br/>
108+
<strong>Job: </strong>${{ github.job }}<br/>
109+
<strong>Distro: </strong>${{ matrix.version }}<br/>
110+
<strong>Step: </strong>${{ env.STEP }}<br/>
111+
<strong>Action: </strong><a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}</a><br/>
112+
</body>
113+
</html>

0 commit comments

Comments
 (0)