Skip to content

Commit 6243e0c

Browse files
committed
simplify
1 parent 2951471 commit 6243e0c

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

.github/workflows/openjdk-base-image.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ on:
99
description: "Select the OpenJDK version to build (leave empty to build all versions)"
1010
required: false
1111
default: ""
12-
type: choice
13-
options:
14-
- ""
15-
- "17"
16-
- "21"
17-
- "24"
1812

1913
env:
2014
dst_img: openjdk-image-obaas
@@ -24,7 +18,7 @@ jobs:
2418
obaas-image:
2519
strategy:
2620
matrix:
27-
base_version: ${{ fromJSON(github.event.inputs.base_version != '' && format('["{0}"]', github.event.inputs.base_version) || '["17","21","24"]') }}
21+
base_version: [17, 21, 24]
2822
runs-on: ubuntu-latest
2923
permissions:
3024
packages: write
@@ -41,9 +35,20 @@ jobs:
4135
username: ${{ github.actor }}
4236
password: ${{ secrets.GITHUB_TOKEN }}
4337

38+
- name: Determine OpenJDK version
39+
id: version
40+
run: |
41+
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.base_version }}" ]; then
42+
echo "Using manual version ${{ github.event.inputs.base_version }}"
43+
echo "VERSION=${{ github.event.inputs.base_version }}" >> $GITHUB_ENV
44+
else
45+
echo "Using matrix version ${{ matrix.base_version }}"
46+
echo "VERSION=${{ matrix.base_version }}" >> $GITHUB_ENV
47+
fi
48+
4449
- name: Get latest Image Software Digest
4550
run: |
46-
latest_digest=$(docker run --rm --entrypoint cat ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }} /image_digest)
51+
latest_digest=$(docker run --rm --entrypoint cat ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ env.VERSION }} /image_digest || true)
4752
echo "Current Digest: $latest_digest"
4853
echo "latest_digest=$latest_digest" >> $GITHUB_ENV
4954
continue-on-error: true
@@ -52,11 +57,12 @@ jobs:
5257
if: github.event_name == 'workflow_dispatch' || env.latest_digest == ''
5358
uses: ./.github/actions/process-image-openjdk
5459
with:
55-
src_image: container-registry.oracle.com/java/openjdk:${{ matrix.base_version }}
56-
dst_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}
60+
src_image: container-registry.oracle.com/java/openjdk:${{ env.VERSION }}
61+
dst_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ env.VERSION }}
5762
description: ${{ env.description }}
5863
push: true
5964
pkg_command: dnf
65+
6066
- name: Run Trivy Vulnerability Scanner
6167
id: trivy_scan
6268
if: env.latest_digest != ''

0 commit comments

Comments
 (0)