Skip to content

Commit

Permalink
[hotfix][ci] Moves Java setup into its own action
Browse files Browse the repository at this point in the history
  • Loading branch information
XComp committed Nov 10, 2023
1 parent 288a752 commit e7e6c71
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 20 deletions.
32 changes: 32 additions & 0 deletions .github/actions/set_java_in_container/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
---
name: "Sets Java version"
description: "Sets the Java version within Flink' CI Docker container"
inputs:
jdk-version:
description: "The JDK version that shall be used as a default within the Flink CI Docker container."
required: true
runs:
using: "composite"
steps:
- name: "Set JDK version to ${{ inputs.jdk-version }}"
shell: bash
run: |
echo "JAVA_HOME=$JAVA_HOME_${{inputs.jdk-version}}_X64" >> ${GITHUB_ENV}
echo "PATH=$JAVA_HOME_${{inputs.jdk-version}}_X64/bin:$PATH" >> ${GITHUB_ENV}
35 changes: 15 additions & 20 deletions .github/workflows/flink-ci-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ jobs:
options: --init

steps:
- name: "Set JDK version"
run: |
echo "JAVA_HOME=$JAVA_HOME_${{inputs.jdk-version}}_X64" >> ${GITHUB_ENV}
echo "PATH=$JAVA_HOME_${{inputs.jdk-version}}_X64/bin:$PATH" >> ${GITHUB_ENV}
- uses: "./github/actions/set_java_in_container"
with:
jdk-version: ${{ inputs.jdk-version }}

- name: "Flink Checkout"
uses: actions/checkout@v3
Expand Down Expand Up @@ -96,10 +95,9 @@ jobs:
stringified_workflow_name=$(echo "${{ github.workflow }}" | tr -C '[:alnum:]._' '-' | tr '[:upper:]' '[:lower:]' | sed -e 's/--*/-/g' -e 's/^-*//g' -e 's/-*$//g')
echo "stringified-workflow-name=${stringified_workflow_name}" >> $GITHUB_OUTPUT
- name: "Set JDK version"
run: |
echo "JAVA_HOME=$JAVA_HOME_${{inputs.jdk-version}}_X64" >> ${GITHUB_ENV}
echo "PATH=$JAVA_HOME_${{inputs.jdk-version}}_X64/bin:$PATH" >> ${GITHUB_ENV}
- uses: "./github/actions/set_java_in_container"
with:
jdk-version: ${{ inputs.jdk-version }}

- name: "Flink Checkout"
uses: actions/checkout@v3
Expand Down Expand Up @@ -148,10 +146,9 @@ jobs:
options: --init

steps:
- name: "Set JDK version"
run: |
echo "JAVA_HOME=$JAVA_HOME_${{inputs.jdk-version}}_X64" >> ${GITHUB_ENV}
echo "PATH=$JAVA_HOME_${{inputs.jdk-version}}_X64/bin:$PATH" >> ${GITHUB_ENV}
- uses: "./github/actions/set_java_in_container"
with:
jdk-version: ${{ inputs.jdk-version }}

- name: "Flink Checkout"
uses: actions/checkout@v3
Expand Down Expand Up @@ -217,10 +214,9 @@ jobs:
stringified-module-name: misc

steps:
- name: "Set JDK version"
run: |
echo "JAVA_HOME=$JAVA_HOME_${{inputs.jdk-version}}_X64" >> ${GITHUB_ENV}
echo "PATH=$JAVA_HOME_${{inputs.jdk-version}}_X64/bin:$PATH" >> ${GITHUB_ENV}
- uses: "./github/actions/set_java_in_container"
with:
jdk-version: ${{ inputs.jdk-version }}

- name: "Flink Checkout"
uses: actions/checkout@v3
Expand Down Expand Up @@ -355,10 +351,9 @@ jobs:
group: [1, 2]

steps:
- name: "Set JDK version"
run: |
echo "JAVA_HOME=$JAVA_HOME_${{inputs.jdk-version}}_X64" >> ${GITHUB_ENV}
echo "PATH=$JAVA_HOME_${{inputs.jdk-version}}_X64/bin:$PATH" >> ${GITHUB_ENV}
- uses: "./github/actions/set_java_in_container"
with:
jdk-version: ${{ inputs.jdk-version }}

- name: "Install missing packages"
run: sudo apt-get install -y net-tools docker-compose
Expand Down

0 comments on commit e7e6c71

Please sign in to comment.