Skip to content

Commit 43f7860

Browse files
authored
Redis unstable branch CI (#447)
- Remove SHA verification because we are using changing code - Change modules' version to `master` - Change job's name - Enable dispatch run - Disable push step - Adding a step of analyzing build failures - Capture logs and upload for only failed builds - Make sure checkout is only for 'unstable' branch - Make the workflow callable
1 parent 3626b67 commit 43f7860

File tree

4 files changed

+77
-21
lines changed

4 files changed

+77
-21
lines changed

.github/actions/build-and-tag-locally/action.yml

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ runs:
8888
password: ${{ inputs.registry_password }}
8989

9090
- name: Build
91+
id: build
9192
uses: docker/build-push-action@v6
9293
with:
9394
context: ${{ inputs.distribution }}
@@ -97,6 +98,59 @@ runs:
9798
tags: ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
9899
cache-from: type=gha
99100
cache-to: type=gha,mode=max
101+
env:
102+
BUILDKIT_PROGRESS: plain
103+
104+
- name: Capture build logs on failure
105+
shell: bash
106+
if: failure() && steps.build.outcome == 'failure'
107+
run: |
108+
mkdir -p /tmp/build-logs
109+
110+
echo "Build failed for ${{ inputs.distribution }} on ${{ inputs.platform }}"
111+
echo "Capturing detailed logs for troubleshooting..."
112+
113+
# Get docker history for the built image (might not exist if build failed early)
114+
docker history ${{ github.sha }}:${{ steps.platform.outputs.display_name }} > /tmp/build-logs/image-history.log 2>&1 || echo "Failed to get image history"
115+
116+
# Get docker inspect output (might not exist if build failed early)
117+
docker inspect ${{ github.sha }}:${{ steps.platform.outputs.display_name }} > /tmp/build-logs/image-inspect.json 2>&1 || echo "Failed to inspect image"
118+
119+
# Get docker build cache info
120+
docker buildx du > /tmp/build-logs/buildx-du.log 2>&1 || echo "Failed to get build cache info"
121+
122+
# Get system info
123+
uname -a > /tmp/build-logs/system-info.log 2>&1
124+
docker info > /tmp/build-logs/docker-info.log 2>&1
125+
126+
# Create a summary file
127+
{
128+
echo "Build failure summary for ${{ inputs.distribution }} on ${{ inputs.platform }}"
129+
echo "Date: $(date)"
130+
echo "GitHub SHA: ${{ github.sha }}"
131+
echo "Platform: ${{ steps.platform.outputs.display_name }}"
132+
echo "Distribution: ${{ inputs.distribution }}"
133+
} > /tmp/build-logs/failure-summary.txt
134+
135+
# Try to extract error information from the build logs
136+
echo "Analyzing build failure..."
137+
138+
# Check for common error patterns
139+
if docker buildx build --no-cache ${{ inputs.distribution }} --platform=${{ inputs.platform }} 2>&1 | tee /tmp/build-logs/build-error.log | grep -q "ERROR"; then
140+
echo "Found ERROR in build output"
141+
grep -A 10 -B 5 "ERROR" /tmp/build-logs/build-error.log > /tmp/build-logs/error-context.log || true
142+
fi
143+
144+
echo "Log capture complete"
145+
146+
- name: Upload build failure logs
147+
if: failure() && steps.build.outcome == 'failure'
148+
uses: actions/upload-artifact@v4
149+
with:
150+
name: build-failure-${{ steps.platform.outputs.display_name }}-${{ inputs.distribution }}
151+
path: /tmp/build-logs/
152+
retention-days: 30
153+
if-no-files-found: warn
100154

101155
- name: Save image
102156
shell: bash
@@ -203,13 +257,3 @@ runs:
203257
echo "ReJSON test failed: expected 'allkeys-lru', got $result"
204258
exit 1
205259
fi
206-
207-
- name: Push image
208-
uses: docker/build-push-action@v6
209-
if: ${{ inputs.publish_image == 'true' && contains(fromJSON('["amd64"]'), steps.platform.outputs.display_name) }}
210-
with:
211-
context: ${{ inputs.distribution }}
212-
push: true
213-
tags: ${{ inputs.registry_repository }}:${{ github.sha }}-${{ inputs.distribution }}
214-
cache-from: type=gha
215-
cache-to: type=gha,mode=max

.github/workflows/pre-merge.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
name: Build and Test
1+
name: Build and Test Unstable
22
on:
33
pull_request:
44
branches:
5-
- master
6-
- release/*
5+
- unstable
76
workflow_call:
87

98
jobs:
109
build-and-test:
11-
runs-on: ${{ contains(matrix.platform, 'arm64') && 'ubuntu24-arm64-2-8' || 'ubuntu-latest' }}
10+
runs-on: 'ubuntu-latest'
1211
strategy:
12+
fail-fast: false
1313
matrix:
1414
distribution:
1515
- debian
@@ -23,7 +23,7 @@ jobs:
2323
- linux/mips64le
2424
- linux/ppc64le
2525
- linux/s390x
26-
- linux/arm64
26+
# - linux/arm64 # Currently the unstable isn't running on arm64
2727
- linux/riscv64
2828
exclude:
2929
- distribution: alpine

alpine/Dockerfile

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

debian/Dockerfile

Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)