Skip to content

Commit 900b4a6

Browse files
authored
Build image for testing early jdk8 (#11594)
1 parent 7c9d164 commit 900b4a6

File tree

5 files changed

+140
-0
lines changed

5 files changed

+140
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: PR build early jdk8 images for smoke tests
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "smoke-tests/images/early-jdk8/**"
7+
- ".github/workflows/pr-smoke-test-early-jdk8-images.yml"
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
17+
18+
- name: Free disk space
19+
run: .github/scripts/gha-free-disk-space.sh
20+
21+
- name: Set up JDK for running Gradle
22+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
23+
with:
24+
distribution: temurin
25+
java-version-file: .java-version
26+
27+
- name: Setup Gradle
28+
uses: gradle/actions/setup-gradle@d9336dac04dea2507a617466bc058a3def92b18b # v3.4.0
29+
with:
30+
cache-read-only: true
31+
# gradle enterprise is used for the build cache
32+
gradle-home-cache-excludes: caches/build-cache-1
33+
34+
- name: Build Docker image
35+
run: ./gradlew :smoke-tests:images:early-jdk8:imageBuild
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish early jdk8 images for smoke tests
2+
3+
on:
4+
push:
5+
paths:
6+
- "smoke-tests/images/early-jdk8/**"
7+
- ".github/workflows/pr-smoke-test-early-jdk8-images.yml"
8+
branches:
9+
- main
10+
workflow_dispatch:
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Free disk space
19+
run: .github/scripts/gha-free-disk-space.sh
20+
21+
- name: Set up JDK for running Gradle
22+
uses: actions/setup-java@v4
23+
with:
24+
distribution: temurin
25+
java-version-file: .java-version
26+
27+
- name: Login to GitHub package registry
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Set tag
35+
run: echo "TAG=$(date '+%Y%m%d').$GITHUB_RUN_ID" >> $GITHUB_ENV
36+
37+
- name: Setup Gradle
38+
uses: gradle/actions/setup-gradle@d9336dac04dea2507a617466bc058a3def92b18b # v3.4.0
39+
40+
- name: Build Docker image
41+
run: ./gradlew :smoke-tests:images:early-jdk8:dockerPush -PextraTag=${{ env.TAG }}
42+
43+
workflow-notification:
44+
needs:
45+
- publish
46+
if: always()
47+
uses: ./.github/workflows/reusable-workflow-notification.yml
48+
with:
49+
success: >-
50+
${{
51+
needs.publishLinux.result == 'success' &&
52+
needs.publishWindows.result == 'success'
53+
}}

settings.gradle.kts

+1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ include(":testing-common:library-for-integration-tests")
145145

146146
// smoke tests
147147
include(":smoke-tests")
148+
include(":smoke-tests:images:early-jdk8")
148149
include(":smoke-tests:images:fake-backend")
149150
include(":smoke-tests:images:grpc")
150151
include(":smoke-tests:images:play")
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# https://github.com/zulu-openjdk/zulu-openjdk/blob/master/ubuntu/8u412-8.78/Dockerfile
2+
FROM ubuntu:jammy
3+
4+
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
5+
6+
RUN apt-get -qq update && \
7+
apt-get -qq -y --no-install-recommends install software-properties-common locales curl tzdata unzip && \
8+
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
9+
locale-gen en_US.UTF-8 && \
10+
curl -sLO https://cdn.azul.com/zulu/bin/zulu1.8.0_31-8.5.0.1-x86lx64.zip && \
11+
unzip zulu1.8.0_31-8.5.0.1-x86lx64.zip -d /opt && \
12+
apt-get -qq -y purge --auto-remove software-properties-common curl unzip && \
13+
rm zulu1.8.0_31-8.5.0.1-x86lx64.zip
14+
15+
ENV JAVA_HOME=/opt/zulu1.8.0_31-8.5.0.1-x86lx64
16+
ENV PATH="${PATH}:/opt/zulu1.8.0_31-8.5.0.1-x86lx64/bin"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
2+
import com.bmuschko.gradle.docker.tasks.image.DockerPushImage
3+
import java.time.LocalDateTime
4+
import java.time.format.DateTimeFormatter
5+
6+
plugins {
7+
id("com.bmuschko.docker-remote-api")
8+
}
9+
10+
val extraTag = findProperty("extraTag")
11+
?: DateTimeFormatter.ofPattern("yyyyMMdd.HHmmSS").format(LocalDateTime.now())
12+
13+
tasks {
14+
val dockerWorkingDir = layout.buildDirectory.dir("docker")
15+
16+
val imagePrepare by registering(Copy::class) {
17+
into(dockerWorkingDir)
18+
from("Dockerfile")
19+
}
20+
21+
val imageBuild by registering(DockerBuildImage::class) {
22+
dependsOn(imagePrepare)
23+
inputDir.set(dockerWorkingDir)
24+
25+
images.add("ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:$extraTag")
26+
dockerFile.set(dockerWorkingDir.get().file("Dockerfile"))
27+
}
28+
29+
val dockerPush by registering(DockerPushImage::class) {
30+
group = "publishing"
31+
description = "Push all Docker images"
32+
dependsOn(imageBuild)
33+
images.add("ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:$extraTag")
34+
}
35+
}

0 commit comments

Comments
 (0)