Skip to content

Commit dc40999

Browse files
authored
ci deb: use reusable workflow (#1032)
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 34b62f6 commit dc40999

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

.github/workflows/apt.yml

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

8850
check_package_size:
8951
name: Check Package Size
@@ -196,7 +158,7 @@ jobs:
196158
/fluentd/fluent-package/apt/binstubs-test.sh
197159
test:
198160
name: Test ${{ matrix.label }} ${{ matrix.test }}
199-
needs: [check_package_size, installation_test, piuparts_test, serverspec_test, binstubs_test]
161+
needs: [build-next, check_package_size, installation_test, piuparts_test, serverspec_test, binstubs_test]
200162
runs-on: ubuntu-latest
201163
timeout-minutes: 15
202164
strategy:

0 commit comments

Comments
 (0)