Skip to content

Commit

Permalink
Merge pull request #815 from anuruddhal/master
Browse files Browse the repository at this point in the history
Add support for JDK 21
  • Loading branch information
anuruddhal authored Nov 13, 2024
2 parents f5cc96b + df510b6 commit 06919fe
Show file tree
Hide file tree
Showing 14 changed files with 123 additions and 82 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-timestamped-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- name: Change to Timestamped Version
run: |
startTime=$(TZ="Asia/Kolkata" date +'%Y%m%d-%H%M00')
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/central-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17.0.7
distribution: "adopt"
java-version: 21
distribution: "temurin"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
108 changes: 72 additions & 36 deletions .github/workflows/generate-base-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ jobs:
build-jre-docker:
needs: pre-validate-registry-sync
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.tag-gen.outputs.TAG }}
MAJ_MIN_TAG: ${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
MAJ_TAG: ${{ steps.tag-gen.outputs.MAJ_TAG }}
GENERATE_ONLY_ONE_TAG: ${{ steps.tag-gen.outputs.GENERATE_ONLY_ONE_TAG }}
GENERATE_ONLY_TWO_TAG: ${{ steps.tag-gen.outputs.GENERATE_ONLY_TWO_TAG }}
GENERATE_ONLY_THREE_TAG: ${{ steps.tag-gen.outputs.GENERATE_ONLY_THREE_TAG }}
GENERATE_ONLY_FOUR_TAG: ${{ steps.tag-gen.outputs.GENERATE_ONLY_FOUR_TAG }}
DOCKER_HUB_NAME: ${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}
steps:
- name: Checkout branch
uses: actions/checkout@v3
Expand Down Expand Up @@ -191,80 +200,107 @@ jobs:
echo ::set-output name=DOCKER_HUB_NAME::$docker_hub_name
id: tag-gen
push-images:
needs: build-jre-docker
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}

steps:
- name: Checkout branch
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.BAL_DOCKER_HUB_USERNAME }}
password: ${{ secrets.BAL_DOCKER_HUB_ACCESS_TOKEN }}

- name: Login to ACR
uses: docker/login-action@v2
with:
registry: ${{ secrets.DOCKER_ACR_NAME }}.azurecr.io
username: ${{ secrets.DOCKER_ACR_USERNAME }}
password: ${{ secrets.DOCKER_ACR_PASSWORD }}
- name: Build and push only major.minor.patch tag
if: ${{ steps.tag-gen.outputs.GENERATE_ONLY_ONE_TAG == 1 }}
if: ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_ONE_TAG == '1' }}
uses: docker/build-push-action@v3
with:
context: .
file: ./docker-images/base-image/Dockerfile
push: true
tags: |
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
- name: Build and push only major.minor.patch, major.minor
if: ${{ steps.tag-gen.outputs.GENERATE_ONLY_TWO_TAG == 1 }}
if: ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_TWO_TAG == '1' }}
uses: docker/build-push-action@v3
with:
context: .
file: ./docker-images/base-image/Dockerfile
push: true
tags: |
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
- name: Build and push only major.minor.patch, major.minor, major
if: ${{ steps.tag-gen.outputs.GENERATE_ONLY_THREE_TAG == 1 }}
if: ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_THREE_TAG == '1' }}
uses: docker/build-push-action@v3
with:
context: .
file: ./docker-images/base-image/Dockerfile
push: true
tags: |
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_TAG}}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_TAG}}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_TAG }}
- name: Build and push only major.minor.patch, major.minor, major, latest
if: ${{ steps.tag-gen.outputs.GENERATE_ONLY_FOUR_TAG == 1 }}
if: ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_FOUR_TAG == '1' }}
uses: docker/build-push-action@v3
with:
context: .
file: ./docker-images/base-image/Dockerfile
push: true
tags: |
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_TAG}}
${{ steps.tag-gen.outputs.DOCKER_HUB_NAME }}/jvm-runtime:latest
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ steps.tag-gen.outputs.MAJ_TAG}}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_TAG }}
${{ needs.build-jre-docker.outputs.DOCKER_HUB_NAME }}/jvm-runtime:latest
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:${{ needs.build-jre-docker.outputs.MAJ_TAG }}
${{ secrets.DOCKER_ACR_NAME }}.azurecr.io/ballerina/jvm-runtime:latest
- name: Send Notifications
run: |
tags=""
if [[ ${{ steps.tag-gen.outputs.GENERATE_ONLY_ONE_TAG }} == 1 ]]
if [[ ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_ONE_TAG }} == '1' ]]
then
tags="${{ steps.tag-gen.outputs.TAG }} (patch)"
elif [[ ${{ steps.tag-gen.outputs.GENERATE_ONLY_TWO_TAG }} == 1 ]]
tags="${{ needs.build-jre-docker.outputs.TAG }} (patch)"
elif [[ ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_TWO_TAG }} == '1' ]]
then
tags="${{ steps.tag-gen.outputs.TAG }} (patch), ${{ steps.tag-gen.outputs.MAJ_MIN_TAG }} (minor)"
elif [[ ${{ steps.tag-gen.outputs.GENERATE_ONLY_THREE_TAG }} == 1 ]]
tags="${{ needs.build-jre-docker.outputs.TAG }} (patch), ${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }} (minor)"
elif [[ ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_THREE_TAG }} == '1' ]]
then
tags="${{ steps.tag-gen.outputs.TAG }} (patch), ${{ steps.tag-gen.outputs.MAJ_MIN_TAG }} (minor), ${{ steps.tag-gen.outputs.MAJ_TAG }} (major)"
elif [[ ${{ steps.tag-gen.outputs.GENERATE_ONLY_FOUR_TAG }} == 1 ]]
tags="${{ needs.build-jre-docker.outputs.TAG }} (patch), ${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }} (minor), ${{ needs.build-jre-docker.outputs.MAJ_TAG }} (major)"
elif [[ ${{ needs.build-jre-docker.outputs.GENERATE_ONLY_FOUR_TAG }} == '1' ]]
then
tags="${{ steps.tag-gen.outputs.TAG }} (patch), ${{ steps.tag-gen.outputs.MAJ_MIN_TAG }} (minor), ${{ steps.tag-gen.outputs.MAJ_TAG }} (major), latest"
tags="${{ needs.build-jre-docker.outputs.TAG }} (patch), ${{ needs.build-jre-docker.outputs.MAJ_MIN_TAG }} (minor), ${{ needs.build-jre-docker.outputs.MAJ_TAG }} (major), latest"
else
tags="no tags has been updated"
tags="no tags have been updated"
fi
docker run -e SPACE_ID="${{ secrets.SPACE_ID }}" -e MESSAGE_KEY="${{ secrets.MESSAGE_KEY }}" -e CHAT_TOKEN="${{ secrets.CHAT_TOKEN }}" -e TAGS="${tags}" ballerina/base_image_update_notifications
post-validate-registry-sync:
needs: build-jre-docker
uses: ./.github/workflows/validate-registry-sync.yml
secrets: inherit
8 changes: 4 additions & 4 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: 17.0.7
distribution: 'temurin'
java-version: 21
- name: Set version env variable
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | rev | cut --complement -d- -f1 | rev)" >> $GITHUB_ENV
- name : Pre release depenency version update
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17.0.7
distribution: 'adopt'
java-version: 21
distribution: 'temurin'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Code2cloud extension implementation for ballerina.

## How to build

1. Download and install JDK 17
1. Download and install JDK 21
1. Export github personal access token & user name as environment variables.
```bash
export packagePAT=<Token>
export packageUser=<username>
```
1. (optional) Specify the Java home path for JDK 17 ie;
1. (optional) Specify the Java home path for JDK 21 ie;
```bash
export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-17.jdk/Contents/Home/
export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home
```
1. Install Docker
1. Get a clone or download the source from this repository (https://github.com/ballerina-platform/module-ballerina-c2c)
Expand Down
2 changes: 1 addition & 1 deletion ballerina/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
org = "ballerina"
name = "cloud"
version = "3.1.0"
version = "3.1.1"
repository = "https://github.com/ballerina-platform/module-ballerina-c2c"
license = ["Apache-2.0"]
keywords = ["cloud", "kubernetes", "docker", "k8s", "c2c"]
Expand Down
2 changes: 1 addition & 1 deletion ballerina/CompilerPlugin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ id = "code2cloud"
class = "io.ballerina.c2c.C2CCompilerPlugin"

[[dependency]]
path = "../compiler-plugin/build/libs/cloud-compiler-plugin-3.1.0.jar"
path = "../compiler-plugin/build/libs/cloud-compiler-plugin-3.1.1-SNAPSHOT.jar"
4 changes: 2 additions & 2 deletions ballerina/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

[ballerina]
dependencies-toml-version = "2"
distribution-version = "2201.10.0"
distribution-version = "2201.11.0-20241111-172200-095db58f"

[[package]]
org = "ballerina"
name = "cloud"
version = "3.1.0"
version = "3.1.1"
modules = [
{org = "ballerina", packageName = "cloud", moduleName = "cloud"}
]
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ ext.projectReportingOutputEncoding = "UTF-8"
ext.puppycrawlCheckstyleVersion = "10.12.0"
ext.slf4jVersion = "1.7.26"
ext.testngVersion = "7.6.1"
ext.lombokVersion = "1.18.28"
ext.lombokVersion = "1.18.30"
ext.commonIoVersion = "2.13.0"
ext.jacksonYamlVersion = " 2.15.2"
ext.jacksonYamlVersion = "2.17.3"
ext.commonsCodecVersion = "1.16.0"

allprojects {
Expand Down
35 changes: 20 additions & 15 deletions docker-images/base-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,41 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM alpine:3.18.9
FROM alpine:3.20.3

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'

# fontconfig and ttf-dejavu added to support serverside image generation by Java programs
RUN apk upgrade --no-cache && apk add --no-cache fontconfig libretls musl-locales musl-locales-lang ttf-dejavu tzdata zlib libc6-compat gcompat\
&& rm -rf /var/cache/apk/*

ENV JAVA_VERSION jdk-17.0.9+9
ENV JAVA_VERSION jdk-27.0.5_11


RUN set -eux; \
ARCH="$(apk --print-arch)"; \
case "${ARCH}" in \
amd64|x86_64) \
ESUM='70e5d108f51ae7c7b2435d063652df058723e303a18b4f72f17f75c5320052d3'; \
BINARY_URL='https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.9%2B9/OpenJDK17U-jre_x64_alpine-linux_hotspot_17.0.9_9.tar.gz'; \
amd64|x86_64) \
ESUM='2dfa33fb8e9474e6967c6cf17964abb5ddce9c17fa6a9f8d7aa221a0ae295df9'; \
BINARY_URL='https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jre_x64_alpine-linux_hotspot_21.0.5_11.tar.gz'; \
;; \
*) \
aarch64) \
ESUM='12b988a3d934e3eb89c6a981a93f8e2adf0a62cc9030487dee76c0c29b93714d'; \
BINARY_URL='https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.5%2B11/OpenJDK21U-jre_aarch64_alpine-linux_hotspot_21.0.5_11.tar.gz'; \
;;\
*) \
echo "Unsupported arch: ${ARCH}"; \
exit 1; \
;; \
;; \
esac; \
wget -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
mkdir -p /opt/java/openjdk; \
tar --extract \
--file /tmp/openjdk.tar.gz \
--directory /opt/java/openjdk \
--strip-components 1 \
--no-same-owner \
wget -O /tmp/openjdk.tar.gz ${BINARY_URL}; \
echo "${ESUM} */tmp/openjdk.tar.gz" | sha256sum -c -; \
mkdir -p /opt/java/openjdk; \
tar --extract \
--file /tmp/openjdk.tar.gz \
--directory /opt/java/openjdk \
--strip-components 1 \
--no-same-owner \
; \
rm -rf /tmp/openjdk.tar.gz;

Expand Down
2 changes: 1 addition & 1 deletion docker-images/native-builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM ghcr.io/graalvm/native-image-community:17-ol8
FROM ghcr.io/graalvm/native-image-community:21.0.1-ol8

COPY build-native.sh build/
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ org.gradle.jvmargs='-Dfile.encoding=UTF-8'
group=io.ballerina
version=3.1.1-SNAPSHOT
systemProp.org.gradle.internal.publish.checksums.insecure=true
ballerinaLangVersion=2201.10.0
ballerinaLangVersion=2201.11.0-20241111-172200-095db58f
stdlibConstraintVersion=1.5.0
stdlibIoVersion=1.6.1
stdlibLogVersion=2.10.0
Expand Down

0 comments on commit 06919fe

Please sign in to comment.