Skip to content

Commit d9f715d

Browse files
committed
TestBuildInfo parsing + resolver
2 parents 6555be6 + 15c461d commit d9f715d

File tree

148 files changed

+4697
-1214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+4697
-1214
lines changed

.buildkite/scripts/dra-workflow.trigger.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,34 @@
22

33
set -euo pipefail
44

5-
echo "steps:"
6-
75
source .buildkite/scripts/branches.sh
86

7+
# We use that filtering to keep different schedule for different branches
8+
if [ -n "${INCLUDED_BRANCHES:-}" ]; then
9+
# If set, only trigger the pipeline for the specified branches
10+
IFS=',' read -r -a BRANCHES <<< "${INCLUDED_BRANCHES}"
11+
elif [ -n "${EXCLUDED_BRANCHES:-}" ]; then
12+
# If set, listed branches will be excluded from the list of branches in branches.json
13+
IFS=',' read -r -a EXCLUDED_BRANCHES <<< "${EXCLUDED_BRANCHES}"
14+
FILTERED_BRANCHES=()
15+
for BRANCH in "${BRANCHES[@]}"; do
16+
EXCLUDE=false
17+
for EXCLUDED_BRANCH in "${EXCLUDED_BRANCHES[@]}"; do
18+
if [ "$BRANCH" == "$EXCLUDED_BRANCH" ]; then
19+
EXCLUDE=true
20+
break
21+
fi
22+
done
23+
if [ "$EXCLUDE" = false ]; then
24+
FILTERED_BRANCHES+=("$BRANCH")
25+
fi
26+
done
27+
BRANCHES=("${FILTERED_BRANCHES[@]}")
28+
fi
29+
30+
31+
echo "steps:"
32+
933
for BRANCH in "${BRANCHES[@]}"; do
1034
INTAKE_PIPELINE_SLUG="elasticsearch-intake"
1135
BUILD_JSON=$(curl -sH "Authorization: Bearer ${BUILDKITE_API_TOKEN}" "https://api.buildkite.com/v2/organizations/elastic/pipelines/${INTAKE_PIPELINE_SLUG}/builds?branch=${BRANCH}&state=passed&per_page=1" | jq '.[0] | {commit: .commit, url: .web_url}')

BUILDING.md

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ In case of updating a dependency, ensure to remove the unused entry of the outda
8282

8383
You can also automate the generation of this entry by running your build using the `--write-verification-metadata` commandline option:
8484
```
85-
>./gradlew --write-verification-metadata sha256 precommit
85+
./gradlew --write-verification-metadata sha256 precommit
8686
```
8787

8888
The `--write-verification-metadata` Gradle option is generally able to resolve reachable configurations,
@@ -92,10 +92,10 @@ uses the changed dependencies. In most cases, `precommit` or `check` are good ca
9292
We prefer sha256 checksums as md5 and sha1 are not considered safe anymore these days. The generated entry
9393
will have the `origin` attribute been set to `Generated by Gradle`.
9494

95-
>A manual confirmation of the Gradle generated checksums is currently not mandatory.
96-
>If you want to add a level of verification you can manually confirm the checksum (e.g. by looking it up on the website of the library)
97-
>Please replace the content of the `origin` attribute by `official site` in that case.
98-
>
95+
> [!Tip]
96+
> A manual confirmation of the Gradle generated checksums is currently not mandatory.
97+
> If you want to add a level of verification you can manually confirm the checksum (e.g. by looking it up on the website of the library)
98+
> Please replace the content of the `origin` attribute by `official site` in that case.
9999
100100
#### Custom plugin and task implementations
101101

@@ -229,13 +229,9 @@ In addition to snapshot builds JitPack supports building Pull Requests. Simply u
229229
3. Run the Gradle build as needed. Keep in mind the initial resolution might take a bit longer as this needs to be built
230230
by JitPack in the background before we can resolve the adhoc built dependency.
231231

232-
---
233-
234-
**NOTE**
235-
236-
You should only use that approach locally or on a developer branch for production dependencies as we do
232+
> [!Note]
233+
> You should only use that approach locally or on a developer branch for production dependencies as we do
237234
not want to ship unreleased libraries into our releases.
238-
---
239235

240236
#### How to use a custom third party artifact?
241237

@@ -265,12 +261,9 @@ allprojects {
265261
```
266262
4. Run the Gradle build as needed with `--write-verification-metadata` to ensure the Gradle dependency verification does not fail on your custom dependency.
267263

268-
---
269-
**NOTE**
270-
271-
As Gradle prefers to use modules whose descriptor has been created from real meta-data rather than being generated,
264+
> [!Note]
265+
> As Gradle prefers to use modules whose descriptor has been created from real meta-data rather than being generated,
272266
flat directory repositories cannot be used to override artifacts with real meta-data from other repositories declared in the build.
273-
For example, if Gradle finds only `jmxri-1.2.1.jar` in a flat directory repository, but `jmxri-1.2.1.pom` in another repository
267+
> For example, if Gradle finds only `jmxri-1.2.1.jar` in a flat directory repository, but `jmxri-1.2.1.pom` in another repository
274268
that supports meta-data, it will use the second repository to provide the module.
275-
Therefore, it is recommended to declare a version that is not resolvable from public repositories we use (e.g. Maven Central)
276-
---
269+
> Therefore, it is recommended to declare a version that is not resolvable from public repositories we use (e.g. Maven Central)

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,8 @@ It is important that the only code covered by the Elastic licence is contained
401401
within the top-level `x-pack` directory. The build will fail its pre-commit
402402
checks if contributed code does not have the appropriate license headers.
403403

404-
> **NOTE:** If you have imported the project into IntelliJ IDEA the project will
404+
> [!NOTE]
405+
> If you have imported the project into IntelliJ IDEA the project will
405406
> be automatically configured to add the correct license header to new source
406407
> files based on the source location.
407408

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/DockerBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ public enum DockerBase {
3131
// spotless:on
3232
// Based on WOLFI above, with more extras. We don't set a base image because
3333
// we programmatically extend from the wolfi image.
34-
CLOUD_ESS(null, "-cloud-ess", "apk", "Dockerfile.cloud-ess"),
34+
CLOUD_ESS(null, "-cloud-ess", "apk", "Dockerfile.ess"),
3535

3636
CLOUD_ESS_FIPS(
3737
"docker.elastic.co/wolfi/chainguard-base-fips:sha256-ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7@sha256:ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7",
3838
"-cloud-ess-fips",
3939
"apk",
40-
"Dockerfile"
40+
"Dockerfile.ess-fips"
4141
);
4242

4343
private final String image;

build-tools-internal/src/main/resources/checkstyle.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868

6969
<!-- Unused imports are forbidden -->
7070
<module name="UnusedImports" />
71+
<module name="SuppressionCommentFilter">
72+
<property name="offCommentFormat" value="begin generated imports"/>
73+
<property name="onCommentFormat" value="end generated imports"/>
74+
<property name="checkFormat" value="UnusedImports"/>
75+
</module>
7176

7277
<!-- Non-inner classes must be in files that match their names. -->
7378
<module name="OuterTypeFilename" />

distribution/docker/src/docker/Dockerfile

Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ RUN chmod 0555 /bin/tini
4141
<% } else { %>
4242
4343
# Install required packages to extract the Elasticsearch distribution
44-
<% if (docker_base == "wolfi" || docker_base == "cloud_ess_fips") { %>
44+
<% if (docker_base == "wolfi") { %>
4545
RUN <%= retry.loop(package_manager, "export DEBIAN_FRONTEND=noninteractive && ${package_manager} update && ${package_manager} update && ${package_manager} add --no-cache curl") %>
4646
<% } else { %>
4747
RUN <%= retry.loop(package_manager, "${package_manager} install -y findutils tar gzip") %>
@@ -115,51 +115,6 @@ RUN sed -i -e 's/ES_DISTRIBUTION_TYPE=tar/ES_DISTRIBUTION_TYPE=docker/' bin/elas
115115
chmod 0775 bin config config/jvm.options.d data logs plugins && \\
116116
find config -type f -exec chmod 0664 {} +
117117

118-
<% if (docker_base == "cloud_ess_fips") { %>
119-
120-
# Add plugins infrastructure
121-
RUN mkdir -p /opt/plugins/archive
122-
RUN chmod -R 0555 /opt/plugins
123-
124-
RUN mkdir -p /fips/libs
125-
COPY fips/libs/*.jar /fips/libs/
126-
127-
COPY filebeat-${version}.tar.gz metricbeat-${version}.tar.gz /tmp/
128-
RUN set -eux ; \\
129-
for beat in filebeat metricbeat ; do \\
130-
if [ ! -s /tmp/\$beat-${version}.tar.gz ]; then \\
131-
echo "/tmp/\$beat-${version}.tar.gz is empty - cannot uncompress" 2>&1 ; \\
132-
exit 1 ; \\
133-
fi ; \\
134-
if ! tar tf /tmp/\$beat-${version}.tar.gz >/dev/null; then \\
135-
echo "/tmp/\$beat-${version}.tar.gz is corrupt - cannot uncompress" 2>&1 ; \\
136-
exit 1 ; \\
137-
fi ; \\
138-
mkdir -p /opt/\$beat ; \\
139-
tar xf /tmp/\$beat-${version}.tar.gz -C /opt/\$beat --strip-components=1 ; \\
140-
done
141-
142-
COPY plugins/*.zip /opt/plugins/archive/
143-
144-
RUN chown 1000:1000 /opt/plugins/archive/*
145-
RUN chmod 0444 /opt/plugins/archive/*
146-
147-
COPY fips/resources/fips_java.security /usr/share/elasticsearch/config/fips_java.security
148-
COPY fips/resources/fips_java.policy /usr/share/elasticsearch/config/fips_java.policy
149-
150-
WORKDIR /usr/share/elasticsearch/config
151-
152-
## Add fips specific JVM options
153-
RUN cat <<EOF > /usr/share/elasticsearch/config/jvm.options.d/fips.options
154-
-Djavax.net.ssl.keyStoreType=BCFKS
155-
-Dorg.bouncycastle.fips.approved_only=true
156-
-Djava.security.properties=config/fips_java.security
157-
-Djava.security.policy=config/fips_java.policy
158-
EOF
159-
160-
<% } %>
161-
162-
163118
################################################################################
164119
# Build stage 2 (the actual Elasticsearch image):
165120
#
@@ -179,7 +134,7 @@ RUN ${package_manager} update --setopt=tsflags=nodocs -y && \\
179134
nc shadow-utils zip findutils unzip procps-ng && \\
180135
${package_manager} clean all
181136
182-
<% } else if (docker_base == "wolfi" || docker_base == "cloud_ess_fips") { %>
137+
<% } else if (docker_base == "wolfi") { %>
183138
RUN <%= retry.loop(package_manager,
184139
"export DEBIAN_FRONTEND=noninteractive && \n" +
185140
" ${package_manager} update && \n" +
@@ -208,7 +163,7 @@ RUN <%= retry.loop(
208163
<% } %>
209164
210165
211-
<% if (docker_base == "wolfi" || docker_base == "cloud_ess_fips") { %>
166+
<% if (docker_base == "wolfi") { %>
212167
RUN groupadd -g 1000 elasticsearch && \
213168
adduser -G elasticsearch -u 1000 elasticsearch -D --home /usr/share/elasticsearch elasticsearch && \
214169
adduser elasticsearch root && \
@@ -224,7 +179,7 @@ ENV ELASTIC_CONTAINER=true
224179
WORKDIR /usr/share/elasticsearch
225180
226181
COPY --from=builder --chown=0:0 /usr/share/elasticsearch /usr/share/elasticsearch
227-
<% if (docker_base != "wolfi" && docker_base != "cloud_ess_fips") { %>
182+
<% if (docker_base != "wolfi") { %>
228183
COPY --from=builder --chown=0:0 /bin/tini /bin/tini
229184
<% } %>
230185
@@ -249,7 +204,7 @@ RUN chmod g=u /etc/passwd && \\
249204
chmod 0775 /usr/share/elasticsearch && \\
250205
chown elasticsearch bin config config/jvm.options.d data logs plugins
251206

252-
<% if (docker_base == 'wolfi' || docker_base == "cloud_ess_fips") { %>
207+
<% if (docker_base == 'wolfi') { %>
253208
RUN ln -sf /etc/ssl/certs/java/cacerts /usr/share/elasticsearch/jdk/lib/security/cacerts
254209
<% } else { %>
255210
RUN ln -sf /etc/pki/ca-trust/extracted/java/cacerts /usr/share/elasticsearch/jdk/lib/security/cacerts
@@ -292,7 +247,7 @@ RUN mkdir /licenses && ln LICENSE.txt /licenses/LICENSE
292247
COPY LICENSE /licenses/LICENSE.addendum
293248
<% } %>
294249

295-
<% if (docker_base == "wolfi" || docker_base == "cloud_ess_fips") { %>
250+
<% if (docker_base == "wolfi") { %>
296251
# Our actual entrypoint is `tini`, a minimal but functional init program. It
297252
# calls the entrypoint we provide, while correctly forwarding signals.
298253
ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/docker-entrypoint.sh"]
@@ -311,13 +266,6 @@ USER 1000:0
311266
<% if (docker_base == 'iron_bank') { %>
312267
HEALTHCHECK --interval=10s --timeout=5s --start-period=1m --retries=5 CMD curl -I -f --max-time 5 http://localhost:9200 || exit 1
313268
<% } %>
314-
315-
<% if (docker_base == 'cloud_ess_fips') { %>
316-
COPY --from=builder --chown=0:0 /opt /opt
317-
ENV ES_PLUGIN_ARCHIVE_DIR=/opt/plugins/archive
318-
WORKDIR /usr/share/elasticsearch
319-
COPY --from=builder --chown=0:0 /fips/libs/*.jar /usr/share/elasticsearch/lib/
320-
<% } %>
321269
################################################################################
322270
# End of multi-stage Dockerfile
323271
################################################################################

0 commit comments

Comments
 (0)