Skip to content

Commit 8f6ff81

Browse files
committed
Simplify GHA (part 2): re-use template workflow
Move the majority of the workflow configuration into a template workflow, defined in image-workflow-template.yml, and call it from the workflows for each image. Pass in "image" as a workflow input. Signed-off-by: Jonathan Dowland <[email protected]>
1 parent 23c9250 commit 8f6ff81

File tree

5 files changed

+54
-112
lines changed

5 files changed

+54
-112
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: UBI9 OpenJDK S2I Image CI template
2+
on:
3+
workflow_call:
4+
inputs:
5+
image:
6+
required: true
7+
type: string
8+
env:
9+
LANG: en_US.UTF-8
10+
jobs:
11+
openjdkci:
12+
name: OpenJDK S2I Build and Test
13+
runs-on: ubuntu-20.04
14+
strategy:
15+
fail-fast: false
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Verify latest UBI image is present
19+
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest
20+
21+
- name: Install CEKit
22+
uses: cekit/[email protected]
23+
24+
- name: Build
25+
run: |
26+
cekit -v --descriptor ${{ inputs.image }}.yaml build docker
27+
28+
- name: Install and cache S2I CLI tool from GitHub
29+
uses: redhat-actions/openshift-tools-installer@v1
30+
with:
31+
source: "github"
32+
github_pat: ${{ github.token }}
33+
s2i: "1.3.4"
34+
35+
- name: Behave Tests
36+
run: |
37+
echo /home/runner/work/_temp/openshift-bin >> $GITHUB_PATH
38+
cekit -v --descriptor ${{ inputs.image }}.yaml test behave

.github/workflows/ubi9-openjdk-11-runtime.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,7 @@ env:
44
LANG: en_US.UTF-8
55
IMAGE: ubi9-openjdk-11-runtime
66
jobs:
7-
openjdkci:
8-
name: OpenJDK S2I Build and Test
9-
runs-on: ubuntu-20.04
10-
strategy:
11-
fail-fast: false
12-
steps:
13-
- uses: actions/checkout@v2
14-
- name: Verify latest UBI image is present
15-
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest
16-
17-
- name: Install CEKit
18-
uses: cekit/[email protected]
19-
20-
- name: Build
21-
run: |
22-
cekit -v --descriptor ${{ env.IMAGE }}.yaml build docker
23-
24-
- name: Install and cache S2I CLI tool from GitHub
25-
uses: redhat-actions/openshift-tools-installer@v1
26-
with:
27-
source: "github"
28-
github_pat: ${{ github.token }}
29-
s2i: "1.3.6"
30-
31-
- name: Behave Tests
32-
run: |
33-
echo /home/runner/work/_temp/openshift-bin >> $GITHUB_PATH
34-
cekit -v --descriptor ${{ env.IMAGE }}.yaml test behave
7+
call-openjdkci:
8+
uses: ./.github/workflows/image-workflow-template.yml
9+
with:
10+
image: ubi9-openjdk-17

.github/workflows/ubi9-openjdk-11.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,7 @@ env:
44
LANG: en_US.UTF-8
55
IMAGE: ubi9-openjdk-11
66
jobs:
7-
openjdkci:
8-
name: OpenJDK S2I Build and Test
9-
runs-on: ubuntu-20.04
10-
strategy:
11-
fail-fast: false
12-
steps:
13-
- uses: actions/checkout@v2
14-
- name: Verify latest UBI image is present
15-
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest
16-
17-
- name: Install CEKit
18-
uses: cekit/[email protected]
19-
20-
- name: Build
21-
run: |
22-
cekit -v --descriptor ${{ env.IMAGE }}.yaml build docker
23-
24-
- name: Install and cache S2I CLI tool from GitHub
25-
uses: redhat-actions/openshift-tools-installer@v1
26-
with:
27-
source: "github"
28-
github_pat: ${{ github.token }}
29-
s2i: "1.3.6"
30-
31-
- name: Behave Tests
32-
run: |
33-
echo /home/runner/work/_temp/openshift-bin >> $GITHUB_PATH
34-
cekit -v --descriptor ${{ env.IMAGE }}.yaml test behave
7+
call-openjdkci:
8+
uses: ./.github/workflows/image-workflow-template.yml
9+
with:
10+
image: ubi9-openjdk-17

.github/workflows/ubi9-openjdk-17-runtime.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,7 @@ env:
44
LANG: en_US.UTF-8
55
IMAGE: ubi9-openjdk-17-runtime
66
jobs:
7-
openjdkci:
8-
name: OpenJDK S2I Build and Test
9-
runs-on: ubuntu-20.04
10-
strategy:
11-
fail-fast: false
12-
steps:
13-
- uses: actions/checkout@v2
14-
- name: Verify latest UBI image is present
15-
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest
16-
17-
- name: Install CEKit
18-
uses: cekit/[email protected]
19-
20-
- name: Build
21-
run: |
22-
cekit -v --descriptor ${{ env.IMAGE }}.yaml build docker
23-
24-
- name: Install and cache S2I CLI tool from GitHub
25-
uses: redhat-actions/openshift-tools-installer@v1
26-
with:
27-
source: "github"
28-
github_pat: ${{ github.token }}
29-
s2i: "1.3.6"
30-
31-
- name: Behave Tests
32-
run: |
33-
echo /home/runner/work/_temp/openshift-bin >> $GITHUB_PATH
34-
cekit -v --descriptor ${{ env.IMAGE }}.yaml test behave
7+
call-openjdkci:
8+
uses: ./.github/workflows/image-workflow-template.yml
9+
with:
10+
image: ubi9-openjdk-17

.github/workflows/ubi9-openjdk-17.yml

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,7 @@ env:
44
LANG: en_US.UTF-8
55
IMAGE: ubi9-openjdk-17
66
jobs:
7-
openjdkci:
8-
name: OpenJDK S2I Build and Test
9-
runs-on: ubuntu-20.04
10-
strategy:
11-
fail-fast: false
12-
steps:
13-
- uses: actions/checkout@v2
14-
- name: Verify latest UBI image is present
15-
run: docker pull registry.access.redhat.com/ubi9/ubi-minimal:latest
16-
17-
- name: Install CEKit
18-
uses: cekit/[email protected]
19-
20-
- name: Build
21-
run: |
22-
cekit -v --descriptor ${{ env.IMAGE }}.yaml build docker
23-
24-
- name: Install and cache S2I CLI tool from GitHub
25-
uses: redhat-actions/openshift-tools-installer@v1
26-
with:
27-
source: "github"
28-
github_pat: ${{ github.token }}
29-
s2i: "1.3.6"
30-
31-
- name: Behave Tests
32-
run: |
33-
echo /home/runner/work/_temp/openshift-bin >> $GITHUB_PATH
34-
cekit -v --descriptor ${{ env.IMAGE }}.yaml test behave
7+
call-openjdkci:
8+
uses: ./.github/workflows/image-workflow-template.yml
9+
with:
10+
image: ubi9-openjdk-17

0 commit comments

Comments
 (0)