Skip to content

Commit 6a7a507

Browse files
authored
Add workflow for building Strimzi (strimzi#11789)
Signed-off-by: Jakub Stejskal <xstejs24@gmail.com>
1 parent d894d01 commit 6a7a507

31 files changed

Lines changed: 549 additions & 82 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: "Build Documentation"
2+
description: "Builds Strimzi documentation in HTML and PDF formats"
3+
4+
inputs:
5+
artifactName:
6+
description: "Name of the documentation artifact to upload"
7+
required: false
8+
default: "documentation.tar"
9+
runnerArch:
10+
description: "Runner architecture (amd64, arm64)"
11+
required: false
12+
default: "amd64"
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Install yq
18+
uses: ./.github/actions/dependencies/install-yq
19+
with:
20+
architecture: ${{ inputs.runnerArch }}
21+
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: '3.2'
26+
27+
- name: Install asciidoctor
28+
shell: bash
29+
run: |
30+
gem install asciidoctor
31+
gem install asciidoctor-pdf
32+
33+
- name: Build documentation
34+
shell: bash
35+
run: make docu_html docu_htmlnoheader docu_pdf
36+
37+
- name: Create documentation archive
38+
shell: bash
39+
run: tar -cvpf documentation.tar ./documentation/html ./documentation/htmlnoheader ./documentation/pdf
40+
41+
- name: Upload documentation artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: ${{ inputs.artifactName }}
45+
path: documentation.tar

.github/actions/build-strimzi-binaries/action.yml renamed to .github/actions/build/build-strimzi-binaries/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ runs:
1515
using: "composite"
1616
steps:
1717
- name: Install yq
18-
uses: ./.github/actions/install-yq
18+
uses: ./.github/actions/dependencies/install-yq
1919
with:
2020
architecture: ${{ inputs.runnerArch }}
2121
- name: Install Shellcheck
22-
uses: ./.github/actions/install-shellcheck
22+
uses: ./.github/actions/dependencies/install-shellcheck
2323
with:
2424
architecture: ${{ inputs.runnerArch }}
2525
- name: Install Helm
26-
uses: ./.github/actions/install-helm
26+
uses: ./.github/actions/dependencies/install-helm
2727
- name: Setup Java
2828
uses: actions/setup-java@v5
2929
with:

.github/actions/containers-build/action.yml renamed to .github/actions/build/containers-build/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ runs:
1515
using: "composite"
1616
steps:
1717
- name: Install Docker
18-
uses: ./.github/actions/install-docker
18+
uses: ./.github/actions/dependencies/install-docker
1919
- name: Install yq
20-
uses: ./.github/actions/install-yq
20+
uses: ./.github/actions/dependencies/install-yq
2121
with:
2222
architecture: ${{ inputs.runnerArch }}
2323
- name: Install Shellcheck
24-
uses: ./.github/actions/install-shellcheck
24+
uses: ./.github/actions/dependencies/install-shellcheck
2525
with:
2626
architecture: ${{ inputs.runnerArch }}
2727

File renamed without changes.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: "Push Containers"
2+
description: "Pushes container images and creates manifests"
3+
4+
inputs:
5+
architectures:
6+
description: "Comma-separated list of architectures (e.g., 'amd64,arm64,s390x,ppc64le')"
7+
required: true
8+
runnerArch:
9+
description: "Runner architecture (amd64, arm64)"
10+
required: false
11+
default: "amd64"
12+
quayUser:
13+
description: "Quay.io username"
14+
required: true
15+
quayPass:
16+
description: "Quay.io password"
17+
required: true
18+
cosignPassword:
19+
description: "Cosign password for signing"
20+
required: true
21+
cosignPrivateKey:
22+
description: "Cosign private key for signing"
23+
required: true
24+
25+
runs:
26+
using: "composite"
27+
steps:
28+
- name: Install prerequisites
29+
shell: bash
30+
run: |
31+
.azure/scripts/install_cosign.sh
32+
.azure/scripts/install_syft.sh
33+
env:
34+
ARCH: ${{ inputs.runnerArch }}
35+
36+
- uses: ./.github/actions/dependencies/install-docker
37+
- uses: ./.github/actions/dependencies/install-yq
38+
with:
39+
architecture: ${{ inputs.runnerArch }}
40+
41+
- name: Download container artifact
42+
uses: actions/download-artifact@v5
43+
with:
44+
pattern: containers-*
45+
path: ./
46+
merge-multiple: true
47+
48+
- name: Extract container archives
49+
shell: bash
50+
run: |
51+
IFS=',' read -ra ARCH_ARRAY <<< "${{ inputs.architectures }}"
52+
for arch in "${ARCH_ARRAY[@]}"; do
53+
tar -xvf "containers-${arch}.tar"
54+
rm "containers-${arch}.tar"
55+
done
56+
57+
- name: Login to container registry
58+
shell: bash
59+
run: docker login -u ${{ inputs.quayUser }} -p ${{ inputs.quayPass }} ${{ env.DOCKER_REGISTRY }}
60+
61+
- name: Delete existing container manifests
62+
shell: bash
63+
run: make docker_delete_manifest
64+
env:
65+
BUILD_REASON: "IndividualCI"
66+
BRANCH: ${{ github.ref }}
67+
68+
- name: Push containers and create manifests
69+
shell: bash
70+
run: |
71+
IFS=',' read -ra ARCH_ARRAY <<< "${{ inputs.architectures }}"
72+
for arch in "${ARCH_ARRAY[@]}"; do
73+
echo "Processing architecture: ${arch}"
74+
export DOCKER_ARCHITECTURE="${arch}"
75+
make docker_load docker_tag docker_push docker_amend_manifest docker_delete_archive
76+
done
77+
env:
78+
BUILD_REASON: "IndividualCI"
79+
BRANCH: ${{ github.ref }}
80+
81+
- name: Push container manifests
82+
shell: bash
83+
run: make docker_push_manifest
84+
env:
85+
BUILD_REASON: "IndividualCI"
86+
BRANCH: ${{ github.ref }}
87+
88+
# TODO - We can use cosign in better way. See https://github.com/strimzi/strimzi-kafka-operator/issues/11826 for more details.
89+
- name: Sign container manifests
90+
shell: bash
91+
run: make docker_sign_manifest
92+
env:
93+
BUILD_REASON: "IndividualCI"
94+
BRANCH: ${{ github.ref }}
95+
BUILD_ID: ${{ github.run_number }}
96+
BUILD_COMMIT: ${{ github.sha }}
97+
COSIGN_PASSWORD: ${{ inputs.cosignPassword }}
98+
COSIGN_PRIVATE_KEY: ${{ inputs.cosignPrivateKey }}
99+
100+
# TODO - We can use existing GitHub Action for SBOMs - https://github.com/strimzi/strimzi-kafka-operator/issues/11827
101+
- name: Generate SBOMs
102+
shell: bash
103+
run: |
104+
IFS=',' read -ra ARCH_ARRAY <<< "${{ inputs.architectures }}"
105+
for arch in "${ARCH_ARRAY[@]}"; do
106+
echo "Generating SBOM for architecture: ${arch}"
107+
export DOCKER_ARCHITECTURE="${arch}"
108+
make docker_sbom
109+
done
110+
env:
111+
BUILD_REASON: "IndividualCI"
112+
BRANCH: ${{ github.ref }}
113+
COSIGN_PASSWORD: ${{ inputs.cosignPassword }}
114+
COSIGN_PRIVATE_KEY: ${{ inputs.cosignPrivateKey }}
115+
116+
- name: Create SBOM archive
117+
shell: bash
118+
run: tar -z -C ./sbom/ -cvpf sbom.tar.gz ./
119+
120+
- name: Upload SBOM artifact
121+
uses: actions/upload-artifact@v4
122+
with:
123+
name: SBOMs-${{ env.DOCKER_TAG }}
124+
path: sbom.tar.gz
125+
126+
- name: Push SBOMs to registry
127+
if: ${{ startsWith(github.ref, 'refs/heads/release-') }}
128+
shell: bash
129+
run: |
130+
IFS=',' read -ra ARCH_ARRAY <<< "${{ inputs.architectures }}"
131+
for arch in "${ARCH_ARRAY[@]}"; do
132+
echo "Generating SBOM for architecture: ${arch}"
133+
export DOCKER_ARCHITECTURE="${arch}"
134+
make docker_push_sbom
135+
done
136+
env:
137+
BUILD_REASON: "IndividualCI"
138+
BRANCH: ${{ github.ref }}
139+
COSIGN_PASSWORD: ${{ inputs.cosignPassword }}
140+
COSIGN_PRIVATE_KEY: ${{ inputs.cosignPrivateKey }}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: "Deploy Java Artifacts"
2+
description: "Deploys Java artifacts to Maven Central"
3+
4+
inputs:
5+
runnerArch:
6+
description: "Runner architecture (amd64, arm64)"
7+
required: false
8+
default: "amd64"
9+
gpgPassphrase:
10+
description: "GPG passphrase for signing"
11+
required: true
12+
gpgSigningKey:
13+
description: "GPG signing key"
14+
required: true
15+
centralUsername:
16+
description: "Maven Central username"
17+
required: true
18+
centralPassword:
19+
description: "Maven Central password"
20+
required: true
21+
22+
runs:
23+
using: "composite"
24+
steps:
25+
- name: Set up JDK
26+
uses: actions/setup-java@v4
27+
with:
28+
java-version: '17'
29+
distribution: 'temurin'
30+
31+
- name: Cache Maven dependencies
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.m2/repository
35+
key: "maven-cache | **/pom.xml"
36+
restore-keys: |
37+
maven | ${{ github.job }}
38+
maven
39+
40+
- name: Install yq
41+
uses: ./.github/actions/dependencies/install-yq
42+
with:
43+
architecture: ${{ inputs.runnerArch }}
44+
45+
- name: Deploy Java artifacts
46+
shell: bash
47+
run: make pushtocentral
48+
env:
49+
BUILD_REASON: "IndividualCI"
50+
BRANCH: ${{ github.ref }}
51+
GPG_PASSPHRASE: ${{ inputs.gpgPassphrase }}
52+
GPG_SIGNING_KEY: ${{ inputs.gpgSigningKey }}
53+
CENTRAL_USERNAME: ${{ inputs.centralUsername }}
54+
CENTRAL_PASSWORD: ${{ inputs.centralPassword }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Publish Documentation"
2+
description: "Publishes documentation to the Strimzi website"
3+
4+
inputs:
5+
artifactName:
6+
description: "Name of the documentation artifact to download"
7+
required: false
8+
default: "Documentation"
9+
githubDeployKey:
10+
description: "GitHub deploy key for website publishing"
11+
required: true
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Download documentation artifact
17+
uses: actions/download-artifact@v4
18+
with:
19+
name: ${{ inputs.artifactName }}
20+
path: ./
21+
22+
- name: Extract documentation
23+
shell: bash
24+
run: tar -xvf documentation.tar
25+
26+
- name: Publish docs to website
27+
shell: bash
28+
run: make docu_pushtowebsite
29+
env:
30+
BUILD_REASON: "IndividualCI"
31+
BRANCH: ${{ github.ref }}
32+
GITHUB_DEPLOY_KEY: ${{ inputs.githubDeployKey }}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: "Test Strimzi"
2+
description: "Runs Strimzi unit and integration tests with Maven"
3+
4+
inputs:
5+
runnerArch:
6+
description: "Runner architecture (amd64, arm64)"
7+
required: false
8+
default: "amd64"
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Set up JDK
14+
uses: actions/setup-java@v4
15+
with:
16+
java-version: "17"
17+
distribution: 'temurin'
18+
19+
- name: Cache Maven dependencies
20+
uses: actions/cache@v4
21+
with:
22+
path: ~/.m2/repository
23+
key: "maven-cache | **/pom.xml"
24+
restore-keys: |
25+
maven | ${{ github.job }}
26+
maven
27+
28+
- name: Install yq
29+
uses: ./.github/actions/dependencies/install-yq
30+
with:
31+
architecture: ${{ inputs.runnerArch }}
32+
33+
- name: Install Docker
34+
uses: ./.github/actions/dependencies/install-docker
35+
36+
- name: Setup Kind cluster
37+
uses: ./.github/actions/dependencies/setup-kind
38+
with:
39+
architecture: ${{ inputs.runnerArch }}
40+
41+
- name: Run unit and integration tests
42+
shell: bash
43+
run: |
44+
mvn -e -V -B -Dmaven.javadoc.skip=true \
45+
-Dsurefire.rerunFailingTestsCount=5 \
46+
-Dfailsafe.rerunFailingTestsCount=2 \
47+
install
48+
env:
49+
# Test container optimization and eliminate pulling RYUK image from DockerHub to prevent limits
50+
TESTCONTAINERS_RYUK_DISABLED: true
51+
TESTCONTAINERS_CHECKS_DISABLE: true
52+
# Disable container logging for cleaner test output
53+
STRIMZI_TEST_CONTAINER_LOGGING_ENABLED: false
54+
55+
- name: Publish test results
56+
uses: dorny/test-reporter@v2
57+
if: always()
58+
with:
59+
name: 'Unit & Integration Tests'
60+
path: '**/TEST-*.xml'
61+
reporter: java-junit
62+
fail-on-error: false
63+
64+
- name: Upload test coverage to Codecov
65+
uses: codecov/codecov-action@v5
66+
with:
67+
files: ./target/site/jacoco/jacoco.xml
68+
flags: unittests
69+
name: codecov-umbrella
70+
fail_ci_if_error: false

.github/actions/containers-push-manifest/action.yml

Lines changed: 0 additions & 10 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)