Skip to content

Commit 948927c

Browse files
committed
Added run_type input
- Support custom, unstable, nightly and release - Added changes to release_build_and_test
1 parent 68f564e commit 948927c

File tree

5 files changed

+110
-21
lines changed

5 files changed

+110
-21
lines changed

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

Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ inputs:
3838
custom_build:
3939
description: 'Type of custom release, branch tag or commit. Empty for release'
4040
required: false
41+
run_type:
42+
description: 'Run type, either release, nightly, unstable or custom'
43+
required: true
4144

4245
runs:
4346
using: "composite"
@@ -105,7 +108,7 @@ runs:
105108

106109
- name: Redis release archive
107110
shell: bash
108-
if: inputs.custom_build != ''
111+
if: inputs.run_type != 'release'
109112
run: |
110113
if [[ "${{ inputs.custom_build }}" == "branch" ]]; then
111114
echo "REDIS_DOWNLOAD_URL=https://github.com/redis/redis/archive/refs/heads/${{ inputs.release_tag }}.tar.gz" | tee -a "$GITHUB_ENV"
@@ -126,15 +129,66 @@ runs:
126129
load: true
127130
platforms: ${{ inputs.platform }}
128131
tags: ${{ github.sha }}:${{ steps.platform.outputs.display_name }}
129-
cache-from: type=gha,scope=${{ inputs.distribution }}-${{ steps.platform.outputs.display_name }}
130-
cache-to: type=gha,mode=max,scope=${{ inputs.distribution }}-${{ steps.platform.outputs.display_name }}
132+
cache-from: type=gha${{ inputs.run_type == 'release' && format(',scope={0}-{1}', inputs.distribution, steps.platform.outputs.display_name) || '' }}
133+
cache-to: type=gha,mode=max${{ inputs.run_type == 'release' && format(',scope={0}-{1}', inputs.distribution, steps.platform.outputs.display_name) || '' }}
131134
build-args: |
132135
REDISEARCH_VERSION=${{ inputs.redisearch_version }}
133136
REDISJSON_VERSION=${{ inputs.redisjson_version }}
134137
REDISBLOOM_VERSION=${{ inputs.redisbloom_version }}
135138
REDISTIMESERIES_VERSION=${{ inputs.redistimeseries_version }}
136-
${{ inputs.custom_build != '' && 'CUSTOM_BUILD=true' || '' }}
137-
${{ inputs.custom_build != '' && format('REDIS_DOWNLOAD_URL={0}', env.REDIS_DOWNLOAD_URL) || '' }}
139+
${{ inputs.run_type != 'release' && 'CUSTOM_BUILD=true' || '' }}
140+
${{ inputs.run_type != 'release' && format('REDIS_DOWNLOAD_URL={0}', env.REDIS_DOWNLOAD_URL) || '' }}
141+
142+
- name: Capture build logs on failure
143+
shell: bash
144+
if: failure() && steps.build.outcome == 'failure' && inputs.run_type == 'nightly'
145+
run: |
146+
mkdir -p /tmp/build-logs
147+
148+
echo "Build failed for ${{ inputs.distribution }} on ${{ inputs.platform }}"
149+
echo "Capturing detailed logs for troubleshooting..."
150+
151+
# Get docker history for the built image (might not exist if build failed early)
152+
docker history ${{ github.sha }}:${{ steps.platform.outputs.display_name }} > /tmp/build-logs/image-history.log 2>&1 || echo "Failed to get image history"
153+
154+
# Get docker inspect output (might not exist if build failed early)
155+
docker inspect ${{ github.sha }}:${{ steps.platform.outputs.display_name }} > /tmp/build-logs/image-inspect.json 2>&1 || echo "Failed to inspect image"
156+
157+
# Get docker build cache info
158+
docker buildx du > /tmp/build-logs/buildx-du.log 2>&1 || echo "Failed to get build cache info"
159+
160+
# Get system info
161+
uname -a > /tmp/build-logs/system-info.log 2>&1
162+
docker info > /tmp/build-logs/docker-info.log 2>&1
163+
164+
# Create a summary file
165+
{
166+
echo "Build failure summary for ${{ inputs.distribution }} on ${{ inputs.platform }}"
167+
echo "Date: $(date)"
168+
echo "GitHub SHA: ${{ github.sha }}"
169+
echo "Platform: ${{ steps.platform.outputs.display_name }}"
170+
echo "Distribution: ${{ inputs.distribution }}"
171+
} > /tmp/build-logs/failure-summary.txt
172+
173+
# Try to extract error information from the build logs
174+
echo "Analyzing build failure..."
175+
176+
# Check for common error patterns
177+
if docker buildx build --no-cache ${{ inputs.distribution }} --platform=${{ inputs.platform }} 2>&1 | tee /tmp/build-logs/build-error.log | grep -q "ERROR"; then
178+
echo "Found ERROR in build output"
179+
grep -A 10 -B 5 "ERROR" /tmp/build-logs/build-error.log > /tmp/build-logs/error-context.log || true
180+
fi
181+
182+
echo "Log capture complete"
183+
184+
- name: Upload build failure logs
185+
if: failure() && steps.build.outcome == 'failure' && inputs.run_type == 'nightly'
186+
uses: actions/upload-artifact@v4
187+
with:
188+
name: build-failure-${{ steps.platform.outputs.display_name }}-${{ inputs.distribution }}
189+
path: /tmp/build-logs/
190+
retention-days: 30
191+
if-no-files-found: warn
138192

139193
- name: Run container
140194
shell: bash
@@ -255,15 +309,15 @@ runs:
255309
shell: bash
256310
run: |
257311
# Determine tag prefix based on custom_build and release_tag
258-
if [[ -z "${{ inputs.custom_build }}" ]]; then
259-
# custom_build is empty, use release_tag since it's a rlease
312+
if [[ "${{ inputs.run_type }}" == "release" ]]; then
260313
tag_prefix="${{ inputs.release_tag }}"
261-
elif [[ "${{ inputs.release_tag }}" == "unstable" ]]; then
262-
# custom_build is not empty but release_tag is unstable, use unstable
314+
elif [[ "${{ inputs.run_type }}" == "unstable" || "${{ inputs.run_type }}" == "nightly" ]]; then
263315
tag_prefix="unstable"
264-
else
265-
# custom_build is not empty and release_tag is not unstable, use custom
316+
elif [[ "${{ inputs.run_type }}" == "custom" ]]; then
266317
tag_prefix="custom"
318+
else
319+
echo "Wrong run_type value, available options are release, nightly, unstable and custom"
320+
exit 1
267321
fi
268322
269323
printf "tag=%s:%s-%s-%s-%s" \
@@ -299,8 +353,8 @@ runs:
299353
REDISJSON_VERSION=${{ inputs.redisjson_version }}
300354
REDISBLOOM_VERSION=${{ inputs.redisbloom_version }}
301355
REDISTIMESERIES_VERSION=${{ inputs.redistimeseries_version }}
302-
${{ inputs.custom_build != '' && 'CUSTOM_BUILD=true' || '' }}
303-
${{ inputs.custom_build != '' && format('REDIS_DOWNLOAD_URL={0}', env.REDIS_DOWNLOAD_URL) || '' }}
356+
${{ inputs.run_type != 'release' && 'CUSTOM_BUILD=true' || '' }}
357+
${{ inputs.run_type != 'release' && format('REDIS_DOWNLOAD_URL={0}', env.REDIS_DOWNLOAD_URL) || '' }}
304358
labels: |
305359
${{ steps.get-image-labels.outputs.image-labels }}
306360
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}

.github/workflows/pre-merge.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ on:
3333
type: boolean
3434
default: false
3535
custom_build:
36-
description: 'Run type, either branch, tag or commit. Empty for releases'
36+
description: 'Custom type, either branch, tag or commit. Empty for releases'
37+
required: false
38+
type: string
39+
run_type:
40+
description: 'Run type, either release, unstable, nightly or custom'
3741
required: false
3842
type: string
3943
outputs:
@@ -77,7 +81,7 @@ jobs:
7781
|| ''
7882
}}
7983
- name: Ensure release branch
80-
if: inputs.release_tag != '' && inputs.release_tag != 'unstable' && inputs.custom_build == ''
84+
if: inputs.release_tag != '' && inputs.run_type == 'release'
8185
uses: redis-developer/redis-oss-release-automation/.github/actions/ensure-release-branch@main
8286
with:
8387
release_tag: ${{ inputs.release_tag }}
@@ -96,6 +100,7 @@ jobs:
96100
redisbloom_version: ${{ inputs.redisbloom_version }}
97101
redistimeseries_version: ${{ inputs.redistimeseries_version }}
98102
custom_build: ${{ inputs.custom_build }}
103+
run_type: ${{ inputs.run_type }}
99104

100105
collect-images-metadata:
101106
runs-on: ubuntu-latest
@@ -129,7 +134,7 @@ jobs:
129134
notify-slack:
130135
runs-on: ubuntu-latest
131136
needs: collect-images-metadata
132-
if: ${{ inputs.release_tag && needs.collect-images-metadata.outputs.docker_images_metadata != '[]' }}
137+
if: ${{ inputs.release_tag && needs.collect-images-metadata.outputs.docker_images_metadata != '[]' && inputs.run_type == 'release' }}
133138
steps:
134139
- name: Checkout code
135140
uses: actions/checkout@v4
@@ -148,7 +153,7 @@ jobs:
148153
notify-slack-when-failed:
149154
runs-on: ubuntu-latest
150155
needs: collect-images-metadata
151-
if: ${{ inputs.release_tag && failure() }}
156+
if: ${{ inputs.release_tag && failure() && inputs.run_type == 'release' }}
152157
steps:
153158
- name: Checkout code
154159
uses: actions/checkout@v4

.github/workflows/release_build_and_test.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,33 @@ on:
1414
workflow_uuid:
1515
description: 'Optional UUID to identify this workflow run'
1616
required: false
17+
redisearch_version:
18+
description: 'Redisearch version to build'
19+
required: false
20+
redisjson_version:
21+
description: 'Redisjson version to build'
22+
required: false
23+
redisbloom_version:
24+
description: 'Redisbloom version to build'
25+
required: false
26+
redistimeseries_version:
27+
description: 'Redistimeseries version to build'
28+
required: false
29+
custom_build:
30+
description: 'Custom type, either branch, tag or commit. Empty for releases'
31+
required: false
32+
run_type:
33+
description: 'Run type, either release, unstable or custom'
34+
required: true
35+
default: "custom"
1736

1837
# UUID is used to help automation to identify workflow run in the list of workflow runs.
19-
run-name: "Release Build and Test${{ github.event.inputs.workflow_uuid && format(': {0}', github.event.inputs.workflow_uuid) || '' }}"
38+
run-name: "${{ github.event.inputs.run_type }} build and test${{ github.event.inputs.workflow_uuid && format(': {0}', github.event.inputs.workflow_uuid) || '' }}"
2039

2140
jobs:
2241
prepare-release:
2342
runs-on: ["ubuntu-latest"]
43+
if: github.event.inputs.run_type == 'release'
2444
steps:
2545
- name: Checkout code
2646
uses: actions/checkout@v4
@@ -55,10 +75,17 @@ jobs:
5575
build-and-test:
5676
uses: ./.github/workflows/pre-merge.yml
5777
needs: prepare-release
78+
if: always() && (needs.prepare-release.result == 'success' || needs.prepare-release.result == 'skipped')
5879
secrets: inherit
5980
with:
6081
release_tag: ${{ github.event.inputs.release_tag }}
6182
publish_image: true
83+
redisearch_version: ${{ github.event.inputs.redisearch_version }}
84+
redisjson_version: ${{ github.event.inputs.redisjson_version }}
85+
redisbloom_version: ${{ github.event.inputs.redisbloom_version }}
86+
redistimeseries_version: ${{ github.event.inputs.redistimeseries_version }}
87+
custom_build: ${{ github.event.inputs.custom_build }}
88+
run_type: ${{ github.event.inputs.run_type }}
6289

6390
merge-back-to-release-branch:
6491
needs: [prepare-release, build-and-test]

.github/workflows/release_publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ on:
1212
description: 'Optional UUID to identify this workflow run'
1313
required: false
1414
pr_to_official_library:
15+
description: 'Open a PR to official library repo'
1516
default: false
1617
release_tag:
18+
description: 'Release tag to publish'
1719
default: ""
1820
required: false
1921

2022
env:
2123
TARGET_OFFICIAL_IMAGES_REPO: docker-library/official-images
22-
#TARGET_OFFICIAL_IMAGES_REPO: Peter-Sh/official-images
2324
FORKED_OFFICIAL_IMAGES_REPO: redis-developer/docker-library-official-images
2425
PR_USER_MENTIONS: "@adamiBs @yossigo @adobrzhansky @maxb-io @dagansandler @Peter-Sh"
25-
#PR_USER_MENTIONS: ""
2626

2727
# UUID is used to help automation to identify workflow run in the list of workflow runs.
2828
run-name: "Release Publish${{ github.event.inputs.workflow_uuid && format(': {0}', github.event.inputs.workflow_uuid) || '' }}"

.github/workflows/test-nightly-unstable.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: Test Nightly Unstable Build and Package
22
on:
3+
schedule:
4+
- cron: '0 11 * * *' # Run every day at 11:00 AM UTC
35
push:
46
branches:
57
- unstable-alignment
@@ -14,4 +16,5 @@ jobs:
1416
redisbloom_version: master
1517
redistimeseries_version: master
1618
publish_image: true
17-
custom_build: branch
19+
custom_build: branch
20+
run_type: nightly

0 commit comments

Comments
 (0)