Skip to content

Commit eae84a4

Browse files
authored
Replace centos:8 with almalinux:8 since centos docker images are deprecated (#19154)
* Replace centos:8 with almalinux:8 since centos docker images are deprecated Signed-off-by: Craig Perkins <[email protected]> * Add to CHANGELOG Signed-off-by: Craig Perkins <[email protected]> * Update Dockerfile Signed-off-by: Craig Perkins <[email protected]> --------- Signed-off-by: Craig Perkins <[email protected]>
1 parent 5b89711 commit eae84a4

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1818
- Add CompletionStage variants to methods in the Client Interface and default to ActionListener impl ([#18998](https://github.com/opensearch-project/OpenSearch/pull/18998))
1919
- IllegalArgumentException when scroll ID references a node not found in Cluster ([#19031](https://github.com/opensearch-project/OpenSearch/pull/19031))
2020
- Adding ScriptedAvg class to painless spi to allowlist usage from plugins ([#19006](https://github.com/opensearch-project/OpenSearch/pull/19006))
21+
- Replace centos:8 with almalinux:8 since centos docker images are deprecated ([#19154](https://github.com/opensearch-project/OpenSearch/pull/19154))
2122

2223
### Fixed
2324
- Fix unnecessary refreshes on update preparation failures ([#15261](https://github.com/opensearch-project/OpenSearch/issues/15261))

buildSrc/src/main/java/org/opensearch/gradle/DockerBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* This class models the different Docker base images that are used to build Docker distributions of OpenSearch.
3737
*/
3838
public enum DockerBase {
39-
CENTOS("centos:8");
39+
ALMALINUX("almalinux:8");
4040

4141
private final String image;
4242

distribution/docker/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ project.ext {
132132
}
133133

134134
void addCopyDockerContextTask(Architecture architecture, DockerBase base) {
135-
if (base != DockerBase.CENTOS) {
135+
if (base != DockerBase.ALMALINUX) {
136136
throw new GradleException("The only allowed docker base image for builds is CENTOS")
137137
}
138138

@@ -181,8 +181,8 @@ opensearch_distributions {
181181
tasks.named("preProcessFixture").configure {
182182
dependsOn opensearch_distributions.docker
183183
// always run the task, otherwise the folders won't be created
184-
outputs.upToDateWhen {
185-
false
184+
outputs.upToDateWhen {
185+
false
186186
}
187187
doLast {
188188
// tests expect to have an empty repo
@@ -208,7 +208,7 @@ tasks.named("check").configure {
208208
}
209209

210210
void addBuildDockerImage(Architecture architecture, DockerBase base) {
211-
if (base != DockerBase.CENTOS) {
211+
if (base != DockerBase.ALMALINUX) {
212212
throw new GradleException("The only allowed docker base image for builds is CENTOS")
213213
}
214214

@@ -234,7 +234,7 @@ void addBuildDockerImage(Architecture architecture, DockerBase base) {
234234
for (final Architecture architecture : Architecture.values()) {
235235
// We only create Docker images for the distribution on CentOS.
236236
for (final DockerBase base : DockerBase.values()) {
237-
if (base == DockerBase.CENTOS) {
237+
if (base == DockerBase.ALMALINUX) {
238238
addCopyDockerContextTask(architecture, base)
239239
addBuildDockerImage(architecture, base)
240240
}
@@ -257,7 +257,7 @@ subprojects { Project subProject ->
257257
apply plugin: 'distribution'
258258

259259
final Architecture architecture = subProject.name.contains('arm64-') ? Architecture.ARM64 : Architecture.X64
260-
final DockerBase base = DockerBase.CENTOS
260+
final DockerBase base = DockerBase.ALMALINUX
261261

262262
final String arch = architecture == Architecture.ARM64 ? '-arm64' : ''
263263
final String extension = 'docker.tar'

distribution/docker/docker-build-context/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tasks.register("buildDockerBuildContext", Tar) {
1919
archiveClassifier = "docker-build-context"
2020
archiveBaseName = "opensearch"
2121
// Non-local builds don't need to specify an architecture.
22-
with dockerBuildContext(null, DockerBase.CENTOS, false)
22+
with dockerBuildContext(null, DockerBase.ALMALINUX, false)
2323
}
2424

2525
tasks.named("assemble").configure { dependsOn "buildDockerBuildContext" }

distribution/docker/src/docker/Dockerfile

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,12 @@ FROM ${base_image}
6363
6464
ENV OPENSEARCH_CONTAINER true
6565
66-
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* && \\
67-
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.epel.cloud|g' /etc/yum.repos.d/CentOS-Linux-* && \\
68-
for iter in {1..10}; do \\
69-
${package_manager} update --setopt=tsflags=nodocs -y && \\
70-
${package_manager} install --setopt=tsflags=nodocs -y \\
71-
nc shadow-utils zip unzip && \\
72-
${package_manager} clean all && exit_code=0 && break || exit_code=\$? && echo "${package_manager} error: retry \$iter in 10s" && \\
73-
sleep 10; \\
74-
done; \\
75-
(exit \$exit_code)
66+
RUN set -e \\
67+
&& dnf -y update \\
68+
&& dnf -y install --setopt=tsflags=nodocs \\
69+
nmap-ncat shadow-utils zip unzip \\
70+
&& dnf clean all \\
71+
&& rm -rf /var/cache/dnf
7672
7773
RUN groupadd -g 1000 opensearch && \\
7874
adduser -u 1000 -g 1000 -G 0 -d /usr/share/opensearch opensearch && \\

0 commit comments

Comments
 (0)