Skip to content

Commit

Permalink
[ci] Add Alma Linux 9 to matrix in packaging and platform jobs (#118331
Browse files Browse the repository at this point in the history
…) (#119314)

SmbTestContainer base image upgraded from Ubuntu 16.04 to 24.04 to avoid
 hanging Python module compilation when installing samba package.
 Installing SMB had to be moved from container building to starting because
 SYS_ADMIN capability is required.

(cherry picked from commit a0f64d2)

# Conflicts:
#	.buildkite/pipelines/pull-request/packaging-tests-unix.yml

Co-authored-by: Mariusz Józala <[email protected]>
  • Loading branch information
mark-vieira and jozala authored Dec 27, 2024
1 parent 873f01e commit 3a07b77
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
1 change: 1 addition & 0 deletions .buildkite/pipelines/periodic-packaging.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ steps:
- rhel-8
- rhel-9
- almalinux-8
- almalinux-9
agents:
provider: gcp
image: family/elasticsearch-{{matrix.image}}
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipelines/periodic-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ steps:
- rhel-8
- rhel-9
- almalinux-8
- almalinux-9
agents:
provider: gcp
image: family/elasticsearch-{{matrix.image}}
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipelines/periodic-platform-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ steps:
- rhel-8
- rhel-9
- almalinux-8
- almalinux-9
agents:
provider: gcp
image: family/elasticsearch-{{matrix.image}}
Expand Down
2 changes: 2 additions & 0 deletions x-pack/test/smb-fixture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apply plugin: 'elasticsearch.java'
apply plugin: 'elasticsearch.cache-test-fixtures'

dependencies {
implementation "com.fasterxml.jackson.core:jackson-annotations:${versions.jackson}"

api project(':test:fixtures:testcontainer-utils')
api "junit:junit:${versions.junit}"
api "org.testcontainers:testcontainers:${versions.testcontainer}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,34 @@

package org.elasticsearch.test.fixtures.smb;

import com.github.dockerjava.api.model.Capability;

import org.elasticsearch.test.fixtures.testcontainers.DockerEnvironmentAwareTestContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.containers.wait.strategy.WaitAllStrategy;
import org.testcontainers.images.builder.ImageFromDockerfile;

import java.time.Duration;

public final class SmbTestContainer extends DockerEnvironmentAwareTestContainer {

private static final String DOCKER_BASE_IMAGE = "ubuntu:16.04";
private static final String DOCKER_BASE_IMAGE = "ubuntu:24.04";
public static final int AD_LDAP_PORT = 636;
public static final int AD_LDAP_GC_PORT = 3269;

public SmbTestContainer() {
super(
new ImageFromDockerfile("es-smb-fixture").withDockerfileFromBuilder(
builder -> builder.from(DOCKER_BASE_IMAGE)
.run("apt-get update -qqy && apt-get install -qqy samba ldap-utils")
.env("TZ", "Etc/UTC")
.run("DEBIAN_FRONTEND=noninteractive apt-get update -qqy && apt-get install -qqy tzdata winbind samba ldap-utils")
.copy("fixture/provision/installsmb.sh", "/fixture/provision/installsmb.sh")
.copy("fixture/certs/ca.key", "/fixture/certs/ca.key")
.copy("fixture/certs/ca.pem", "/fixture/certs/ca.pem")
.copy("fixture/certs/cert.pem", "/fixture/certs/cert.pem")
.copy("fixture/certs/key.pem", "/fixture/certs/key.pem")
.run("chmod +x /fixture/provision/installsmb.sh")
.run("/fixture/provision/installsmb.sh")
.cmd("service samba-ad-dc restart && sleep infinity")
.cmd("/fixture/provision/installsmb.sh && service samba-ad-dc restart && echo Samba started && sleep infinity")
.build()
)
.withFileFromClasspath("fixture/provision/installsmb.sh", "/smb/provision/installsmb.sh")
Expand All @@ -37,10 +43,20 @@ public SmbTestContainer() {
.withFileFromClasspath("fixture/certs/cert.pem", "/smb/certs/cert.pem")
.withFileFromClasspath("fixture/certs/key.pem", "/smb/certs/key.pem")
);
// addExposedPort(389);
// addExposedPort(3268);

addExposedPort(AD_LDAP_PORT);
addExposedPort(AD_LDAP_GC_PORT);

setWaitStrategy(
new WaitAllStrategy().withStartupTimeout(Duration.ofSeconds(120))
.withStrategy(Wait.forLogMessage(".*Samba started.*", 1))
.withStrategy(Wait.forListeningPort())
);

getCreateContainerCmdModifiers().add(createContainerCmd -> {
createContainerCmd.getHostConfig().withCapAdd(Capability.SYS_ADMIN);
return createContainerCmd;
});
}

public String getAdLdapUrl() {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/smb-fixture/src/main/resources/smb/provision/installsmb.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cat $SSL_DIR/ca.pem >> /etc/ssl/certs/ca-certificates.crt

mv /etc/samba/smb.conf /etc/samba/smb.conf.orig

samba-tool domain provision --server-role=dc --use-rfc2307 --dns-backend=SAMBA_INTERNAL --realm=AD.TEST.ELASTICSEARCH.COM --domain=ADES --adminpass=Passw0rd --use-ntvfs
samba-tool domain provision --server-role=dc --use-rfc2307 --dns-backend=SAMBA_INTERNAL --realm=AD.TEST.ELASTICSEARCH.COM --domain=ADES --adminpass=Passw0rd

cp /var/lib/samba/private/krb5.conf /etc/krb5.conf

Expand Down

0 comments on commit 3a07b77

Please sign in to comment.