Skip to content

Commit

Permalink
Merge branch 'main' into 98918_remove_test_logging
Browse files Browse the repository at this point in the history
  • Loading branch information
idegtiarenko committed Nov 3, 2023
2 parents 0e2169c + 8c57de7 commit 3d54b7a
Show file tree
Hide file tree
Showing 626 changed files with 8,923 additions and 3,525 deletions.
6 changes: 3 additions & 3 deletions .buildkite/pipelines/intake.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ steps:
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
- label: part2
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dorg.elasticsearch.build.cache.push=true -Dignore.tests.seed -Dscan.capture-task-input-files checkPart2
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
- label: part3
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dorg.elasticsearch.build.cache.push=true -Dignore.tests.seed -Dscan.capture-task-input-files checkPart3
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
- group: bwc-snapshots
steps:
Expand Down
15 changes: 13 additions & 2 deletions .buildkite/pipelines/periodic.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ steps:
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
env:
ES_RUNTIME_JAVA: "{{matrix.ES_RUNTIME_JAVA}}"
Expand Down Expand Up @@ -82,7 +82,7 @@ steps:
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: custom-32-98304
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
env:
ES_RUNTIME_JAVA: "{{matrix.ES_RUNTIME_JAVA}}"
Expand Down Expand Up @@ -180,3 +180,14 @@ steps:
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-8
buildDirectory: /dev/shm/bk
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+\$/
- label: Check branch consistency
command: .ci/scripts/run-gradle.sh branchConsistency
timeout_in_minutes: 15
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-2
- label: Check branch protection rules
command: .buildkite/scripts/branch-protection.sh
timeout_in_minutes: 5
11 changes: 11 additions & 0 deletions .buildkite/pipelines/periodic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1241,3 +1241,14 @@ steps:
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-8
buildDirectory: /dev/shm/bk
if: build.branch == "main" || build.branch =~ /^[0-9]+\.[0-9]+\$/
- label: Check branch consistency
command: .ci/scripts/run-gradle.sh branchConsistency
timeout_in_minutes: 15
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n2-standard-2
- label: Check branch protection rules
command: .buildkite/scripts/branch-protection.sh
timeout_in_minutes: 5
10 changes: 10 additions & 0 deletions .buildkite/scripts/branch-protection.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -euo pipefail

STATUS=$(curl -s "https://api.github.com/repos/elastic/elasticsearch/branches/$BUILDKITE_BRANCH" | jq '.protected')
echo "Branch $BUILDKITE_BRANCH protection status is: $STATUS"
if [[ "$STATUS" == "false" ]]; then
echo "Development branch $BUILDKITE_BRANCH is not set as protected in GitHub but should be."
exit 1
fi
8 changes: 4 additions & 4 deletions .ci/jobs.t/elastic+elasticsearch+branch-consistency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
- job:
name: elastic+elasticsearch+%BRANCH%+branch-consistency
display-name: "elastic / elasticsearch # %BRANCH% - branch consistency"
description: Testing of the Elasticsearch %BRANCH% branch version consistency.
triggers:
- timed: "H 7 * * *"
description: "This job has been migrated to Buildkite.\n"
disabled: true
triggers: []
builders:
- inject:
properties-file: '.ci/java-versions.properties'
properties-file: ".ci/java-versions.properties"
properties-content: |
JAVA_HOME=$HOME/.java/$ES_BUILD_JAVA
- shell: |
Expand Down
6 changes: 3 additions & 3 deletions .ci/jobs.t/elastic+elasticsearch+branch-protection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
- job:
name: elastic+elasticsearch+%BRANCH%+branch-protection
display-name: "elastic / elasticsearch # %BRANCH% - branch protection"
description: Elasticsearch %BRANCH% branch protection.
description: "This job has been migrated to Buildkite.\n"
disabled: true
node: master
triggers:
- timed: "H 7 * * *"
triggers: []
scm: []
parameters: []
builders:
Expand Down
5 changes: 5 additions & 0 deletions .ci/scripts/run-gradle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@ if ! uname -a | grep -q MING; then
export GLIBC_VERSION=$(ldd --version | grep '^ldd' | sed 's/.* \([1-9]\.[0-9]*\).*/\1/')
fi

# Running on 2-core machines without ramdisk can make this value be 0
if [[ "$MAX_WORKERS" == "0" ]]; then
MAX_WORKERS=1
fi

set -e
$GRADLEW -S --max-workers=$MAX_WORKERS $@
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import java.nio.file.Files

String buildNumber = System.getenv('BUILD_NUMBER') ?: System.getenv('BUILDKITE_BUILD_NUMBER')
String performanceTest = System.getenv('BUILD_PERFORMANCE_TEST')
if (buildNumber && performanceTest == null && GradleUtils.isIncludedBuild(project) == false) {
Boolean isNested = System.getProperty("scan.tag.NESTED") != null

if (buildNumber && performanceTest == null && GradleUtils.isIncludedBuild(project) == false && isNested == false) {
def uploadFilePath = "build/${buildNumber}.tar.bz2"
File uploadFile = file(uploadFilePath)
project.gradle.buildFinished { result ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ buildScan {
def jobName = (System.getenv('BUILDKITE_LABEL') ?: '').replaceAll(/[^a-zA-Z0-9_\-]+/, ' ').trim().replaceAll(' ', '_').toLowerCase()

tag 'CI'
link 'CI Build', buildKiteUrl
link 'CI Build', "${buildKiteUrl}#${System.getenv('BUILDKITE_JOB_ID')}"
value 'Job Number', System.getenv('BUILDKITE_BUILD_NUMBER')
value 'Build ID', System.getenv('BUILDKITE_BUILD_ID')
value 'Job ID', System.getenv('BUILDKITE_JOB_ID')

value 'Pipeline', System.getenv('BUILDKITE_PIPELINE_SLUG')
tag System.getenv('BUILDKITE_PIPELINE_SLUG')
Expand All @@ -129,19 +131,30 @@ buildScan {
link 'Source', "https://github.com/${repository}/tree/${BuildParams.gitRevision}"
}

buildScanPublished { scan ->
// Attach build scan link as build metadata
// See: https://buildkite.com/docs/pipelines/build-meta-data
new ProcessBuilder('buildkite-agent', 'meta-data', 'set', "build-scan-${System.getenv('BUILDKITE_JOB_ID')}", "${scan.buildScanUri}")
.start()
.waitFor()

// Add a build annotation
// See: https://buildkite.com/docs/agent/v3/cli-annotate
def body = """<div class="mb3"><span class="p1 border rounded">${System.getenv('BUILDKITE_LABEL')}</span> :gradle: build ran: <a href="${scan.buildScanUri}"><code>gradle ${gradle.startParameter.taskNames.join(' ')}</code></a></div>"""
new ProcessBuilder('buildkite-agent', 'annotate', '--context', 'gradle-build-scans', '--append', '--style', 'info', body)
.start()
.waitFor()
buildFinished { result ->
buildScanPublished { scan ->
// Attach build scan link as build metadata
// See: https://buildkite.com/docs/pipelines/build-meta-data
new ProcessBuilder('buildkite-agent', 'meta-data', 'set', "build-scan-${System.getenv('BUILDKITE_JOB_ID')}", "${scan.buildScanUri}")
.start()
.waitFor()

// Add a build annotation
// See: https://buildkite.com/docs/agent/v3/cli-annotate
def body = """<div class="mb3"><span class="p1 border rounded">${System.getenv('BUILDKITE_LABEL')}</span> :gradle: ${result.failure ? 'failed' : 'successful'} build: <a href="${scan.buildScanUri}"><code>gradle ${gradle.startParameter.taskNames.join(' ')}</code></a></div>"""
new ProcessBuilder(
'buildkite-agent',
'annotate',
'--context',
result.failure ? 'gradle-build-scans-failed' : 'gradle-build-scans',
'--append',
'--style',
result.failure ? 'error' : 'info',
body
)
.start()
.waitFor()
}
}
} else {
tag 'LOCAL'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
public class ExportElasticsearchBuildResourcesTask extends DefaultTask {

private final Logger logger = Logging.getLogger(ExportElasticsearchBuildResourcesTask.class);
private static final Logger logger = Logging.getLogger(ExportElasticsearchBuildResourcesTask.class);

private final Set<String> resources = new HashSet<>();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

package org.elasticsearch.gradle.internal.docker;

import java.util.Objects;

/**
* This class models the result of running a command. It captures the exit code, standard output and standard error and allows
* applying String filter for stdout as this is intended to create configuration cache compatible output which
* aims to be agnostic.
*/
public class DockerResult {

private int exitCode;
private String stdout;
private String stderr;

public DockerResult(int exitCode, String stdout, String stderr) {
this.exitCode = exitCode;
this.stdout = stdout;
this.stderr = stderr;
}

public int getExitCode() {
return exitCode;
}

public String getStdout() {
return stdout;
}

public String getStderr() {
return stderr;
}

public void setExitCode(int exitCode) {
this.exitCode = exitCode;
}

public void setStdout(String stdout) {
this.stdout = stdout;
}

public void setStderr(String stderr) {
this.stderr = stderr;
}

public boolean isSuccess() {
return exitCode == 0;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DockerResult that = (DockerResult) o;
return exitCode == that.exitCode && Objects.equals(stdout, that.stdout) && Objects.equals(stderr, that.stderr);
}

@Override
public int hashCode() {
return Objects.hash(exitCode, stdout, stderr);
}
}
Loading

0 comments on commit 3d54b7a

Please sign in to comment.