Skip to content

Commit f7ae944

Browse files
authored
Backport(v6) ci deb: use reusable workflow (#1032) (#1033)
In the previous versions, current (v6) and next major (v7) version were built in same workflow job. It tend to reach maximum timeout (6h) easily in recent actions. So let's split into two jobs and use reusable workflow for them. * previous build job was split into build, build-next * to reuse workflow for amd64 and arm64, runner.arch to distinct them * v7 could be buildable for arm64 now (disabled) Signed-off-by: Kentaro Hayashi <hayashi@clear-code.com>
1 parent 790ff36 commit f7ae944

3 files changed

Lines changed: 112 additions & 84 deletions

File tree

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Reusable Build Deb
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
rake-job:
7+
required: true
8+
type: string
9+
rake-options:
10+
required: false
11+
type: string
12+
default: ""
13+
run-on:
14+
required: true
15+
type: string
16+
next-major:
17+
required: true
18+
type: boolean
19+
cache-group:
20+
required: true
21+
type: string
22+
23+
jobs:
24+
build:
25+
runs-on: ${{ inputs.run-on }}
26+
steps:
27+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
28+
- name: cache deb
29+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
30+
id: cache-deb
31+
with:
32+
path: |
33+
fluent-package/apt/repositories
34+
fluent-apt-source/apt/repositories
35+
fluent-lts-apt-source/apt/repositories
36+
v7-test/fluent-package/apt/repositories
37+
key: ${{ runner.os }}-cache-${{ inputs.rake-job }}-${{ runner.arch }}-${{ inputs.cache-group }}-${{ hashFiles('**/config.rb', '**/Rakefile', '**/Gemfile*', 'fluent-package/templates/**', 'fluent-package/debian/**', 'fluent-package/apt/**/Dockerfile') }}
38+
- uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
39+
with:
40+
ruby-version: '3.4'
41+
- name: Install dependencies
42+
if: ${{ ! steps.cache-deb.outputs.cache-hit }}
43+
run: |
44+
gem install serverspec --no-document
45+
- name: Build deb with Docker
46+
if: ${{ ! steps.cache-deb.outputs.cache-hit && ! inputs.next-major }}
47+
run: |
48+
rake apt:build APT_TARGETS=${{ inputs.rake-job }} ${{ inputs.rake-options }}
49+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
50+
if: ${{ ! steps.cache-deb.outputs.cache-hit && inputs.next-major }}
51+
with:
52+
path: v7-test
53+
- name: Build v7 deb with Docker
54+
if: ${{ ! steps.cache-deb.outputs.cache-hit && inputs.next-major }}
55+
run: |
56+
cd v7-test
57+
git config user.email "fluentd@googlegroups.com"
58+
git config user.name "Fluentd developers"
59+
git am fluent-package/bump-version-v7.patch
60+
rake apt:build APT_TARGETS=${{ inputs.rake-job }} ${{ inputs.rake-options }}
61+
- name: Upload fluent-package deb
62+
if: ${{ ! inputs.next-major }}
63+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
64+
with:
65+
name: packages-${{ inputs.rake-job }}
66+
path: fluent-package/apt/repositories
67+
- name: Upload fluent-apt-source deb
68+
if: ${{ ! inputs.next-major }}
69+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
70+
with:
71+
name: packages-apt-source-${{ inputs.rake-job }}
72+
path: fluent-apt-source/apt/repositories
73+
- name: Upload fluent-lts-apt-source deb
74+
if: ${{ ! inputs.next-major }}
75+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
76+
with:
77+
name: packages-lts-apt-source-${{ inputs.rake-job }}
78+
path: fluent-lts-apt-source/apt/repositories
79+
- name: Upload v7 fluent-package deb
80+
if: ${{ inputs.next-major }}
81+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
82+
with:
83+
name: v7-packages-${{ inputs.rake-job }}
84+
path: v7-test/fluent-package/apt/repositories

.github/workflows/apt-arm.yml

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,14 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }}
28-
runs-on: ubuntu-24.04-arm
29-
steps:
30-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31-
- name: cache deb
32-
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
33-
id: cache-deb
34-
with:
35-
path: |
36-
fluent-package/apt/repositories
37-
key: ${{ runner.os }}-cache-${{ matrix.rake-job }}-arm64-${{ hashFiles('**/config.rb', '**/Rakefile', '**/Gemfile*', 'fluent-package/templates/**', 'fluent-package/debian/**', 'fluent-package/apt/**/Dockerfile') }}
38-
- uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
39-
with:
40-
ruby-version: '3.4'
41-
- name: Install dependencies
42-
if: ${{ ! steps.cache-deb.outputs.cache-hit }}
43-
run: |
44-
gem install serverspec --no-document
45-
- name: Build deb with Docker
46-
if: ${{ ! steps.cache-deb.outputs.cache-hit }}
47-
run: |
48-
rake apt:build APT_TARGETS=${{ matrix.rake-job }}-arm64 ${{ matrix.rake-options }}
49-
- name: Upload fluent-package deb
50-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
51-
with:
52-
name: packages-${{ matrix.rake-job }}-arm64
53-
path: fluent-package/apt/repositories
28+
uses: ./.github/workflows/_build_deb_reusable.yml
29+
with:
30+
rake-job: ${{ matrix.rake-job }}-arm64
31+
run-on: ubuntu-24.04-arm
32+
next-major: false
33+
cache-group: v6
34+
rake-options: ${{ matrix.rake-options }}
35+
5436
check_package_size:
5537
name: Check Package Size
5638
runs-on: ubuntu-24.04-arm

.github/workflows/apt.yml

Lines changed: 20 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -21,67 +21,29 @@ jobs:
2121
working-directory: .github/workflows/
2222
build:
2323
name: Build
24-
timeout-minutes: 180
2524
needs: define-matrix
25+
uses: ./.github/workflows/_build_deb_reusable.yml
2626
strategy:
2727
fail-fast: false
2828
matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }}
29-
runs-on: ubuntu-latest
30-
steps:
31-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
32-
- name: cache deb
33-
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
34-
id: cache-deb
35-
with:
36-
path: |
37-
fluent-package/apt/repositories
38-
fluent-apt-source/apt/repositories
39-
fluent-lts-apt-source/apt/repositories
40-
v7-test/fluent-package/apt/repositories
41-
key: ${{ runner.os }}-cache-${{ matrix.rake-job }}-${{ hashFiles('**/config.rb', '**/Rakefile', '**/Gemfile*', 'fluent-package/templates/**', 'fluent-package/debian/**', 'fluent-package/apt/**/Dockerfile') }}
42-
- uses: ruby/setup-ruby@3ff19f5e2baf30647122352b96108b1fbe250c64 # v1.299.0
43-
with:
44-
ruby-version: '3.4'
45-
- name: Install dependencies
46-
if: ${{ ! steps.cache-deb.outputs.cache-hit }}
47-
run: |
48-
gem install serverspec --no-document
49-
- name: Build deb with Docker
50-
if: ${{ ! steps.cache-deb.outputs.cache-hit }}
51-
run: |
52-
rake apt:build APT_TARGETS=${{ matrix.rake-job }}
53-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
54-
if: ${{ ! steps.cache-deb.outputs.cache-hit }}
55-
with:
56-
path: v7-test
57-
- name: Build v7 deb with Docker
58-
if: ${{ ! steps.cache-deb.outputs.cache-hit }}
59-
run: |
60-
cd v7-test
61-
git config user.email "fluentd@googlegroups.com"
62-
git config user.name "Fluentd developers"
63-
git am fluent-package/bump-version-v7.patch
64-
rake apt:build APT_TARGETS=${{ matrix.rake-job }}
65-
- name: Upload fluent-package deb
66-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
67-
with:
68-
name: packages-${{ matrix.rake-job }}
69-
path: fluent-package/apt/repositories
70-
- name: Upload v7 fluent-package deb
71-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
72-
with:
73-
name: v7-packages-${{ matrix.rake-job }}
74-
path: v7-test/fluent-package/apt/repositories
75-
- name: Upload fluent-apt-source deb
76-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
77-
with:
78-
name: packages-apt-source-${{ matrix.rake-job }}
79-
path: fluent-apt-source/apt/repositories
80-
- name: Upload fluent-lts-apt-source deb
81-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
82-
with:
83-
name: packages-lts-apt-source-${{ matrix.rake-job }}
84-
path: fluent-lts-apt-source/apt/repositories
29+
with:
30+
rake-job: ${{ matrix.rake-job }}
31+
run-on: ubuntu-latest
32+
next-major: false
33+
cache-group: v6
34+
35+
build-next:
36+
name: Build next major
37+
needs: define-matrix
38+
uses: ./.github/workflows/_build_deb_reusable.yml
39+
strategy:
40+
fail-fast: false
41+
matrix: ${{ fromJSON(needs.define-matrix.outputs.matrix) }}
42+
with:
43+
rake-job: ${{ matrix.rake-job }}
44+
run-on: ubuntu-latest
45+
next-major: true
46+
cache-group: v7
8547

8648
check_package_size:
8749
name: Check Package Size
@@ -194,7 +156,7 @@ jobs:
194156
/fluentd/fluent-package/apt/binstubs-test.sh
195157
test:
196158
name: Test ${{ matrix.label }} ${{ matrix.test }}
197-
needs: [check_package_size, installation_test, piuparts_test, serverspec_test, binstubs_test]
159+
needs: [build-next, check_package_size, installation_test, piuparts_test, serverspec_test, binstubs_test]
198160
runs-on: ubuntu-latest
199161
timeout-minutes: 15
200162
strategy:

0 commit comments

Comments
 (0)