-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/go_modules/github.com/elastic/go-…
…elasticsearch/v8-8.16.0
- Loading branch information
Showing
7 changed files
with
274 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
function ess_up { | ||
param ( | ||
[string]$StackVersion, | ||
[string]$EssRegion = "gcp-us-west2" | ||
) | ||
|
||
Write-Output "~~~ Starting ESS Stack" | ||
|
||
$Workspace = & git rev-parse --show-toplevel | ||
$TfDir = Join-Path -Path $Workspace -ChildPath "test_infra/ess/" | ||
|
||
if (-not $StackVersion) { | ||
Write-Error "Error: Specify stack version: ess_up [stack_version]" | ||
return 1 | ||
} | ||
|
||
$Env:EC_API_KEY = Retry-Command -ScriptBlock { | ||
vault kv get -field=apiKey kv/ci-shared/platform-ingest/platform-ingest-ec-prod | ||
} | ||
|
||
if (-not $Env:EC_API_KEY) { | ||
Write-Error "Error: Failed to get EC API key from vault" | ||
exit 1 | ||
} | ||
|
||
$BuildkiteBuildCreator = if ($Env:BUILDKITE_BUILD_CREATOR) { $Env:BUILDKITE_BUILD_CREATOR } else { get_git_user_email } | ||
$BuildkiteBuildNumber = if ($Env:BUILDKITE_BUILD_NUMBER) { $Env:BUILDKITE_BUILD_NUMBER } else { "0" } | ||
$BuildkitePipelineSlug = if ($Env:BUILDKITE_PIPELINE_SLUG) { $Env:BUILDKITE_PIPELINE_SLUG } else { "elastic-agent-integration-tests" } | ||
|
||
Push-Location -Path $TfDir | ||
& terraform init | ||
& terraform apply -auto-approve ` | ||
-var="stack_version=$StackVersion" ` | ||
-var="ess_region=$EssRegion" ` | ||
-var="creator=$BuildkiteBuildCreator" ` | ||
-var="buildkite_id=$BuildkiteBuildNumber" ` | ||
-var="pipeline=$BuildkitePipelineSlug" | ||
|
||
$Env:ELASTICSEARCH_HOST = & terraform output -raw es_host | ||
$Env:ELASTICSEARCH_USERNAME = & terraform output -raw es_username | ||
$Env:ELASTICSEARCH_PASSWORD = & terraform output -raw es_password | ||
$Env:KIBANA_HOST = & terraform output -raw kibana_endpoint | ||
$Env:KIBANA_USERNAME = $Env:ELASTICSEARCH_USERNAME | ||
$Env:KIBANA_PASSWORD = $Env:ELASTICSEARCH_PASSWORD | ||
Pop-Location | ||
} | ||
|
||
function ess_down { | ||
$Workspace = & git rev-parse --show-toplevel | ||
$TfDir = Join-Path -Path $Workspace -ChildPath "test_infra/ess/" | ||
$stateFilePath = Join-Path -Path $TfDir -ChildPath "terraform.tfstate" | ||
|
||
if (-not (Test-Path -Path $stateFilePath)) { | ||
Write-Output "Terraform state file not found. Skipping ESS destroy." | ||
return 0 | ||
} | ||
Write-Output "~~~ Tearing down the ESS Stack(created for this step)" | ||
try { | ||
$Env:EC_API_KEY = Retry-Command -ScriptBlock { | ||
vault kv get -field=apiKey kv/ci-shared/platform-ingest/platform-ingest-ec-prod | ||
} | ||
Push-Location -Path $TfDir | ||
& terraform init | ||
& terraform destroy -auto-approve | ||
Pop-Location | ||
} catch { | ||
Write-Output "Error: Failed to destroy ESS stack(it will be auto-deleted later): $_" | ||
} | ||
} | ||
|
||
function get_git_user_email { | ||
if (!(git rev-parse --is-inside-work-tree *>&1)) { | ||
return "unknown" | ||
} | ||
|
||
$email = & git config --get user.email | ||
|
||
if (-not $email) { | ||
return "unknown" | ||
} else { | ||
return $email | ||
} | ||
} | ||
|
||
function Retry-Command { | ||
param ( | ||
[scriptblock]$ScriptBlock, | ||
[int]$MaxRetries = 3, | ||
[int]$DelaySeconds = 5 | ||
) | ||
|
||
$lastError = $null | ||
|
||
for ($attempt = 1; $attempt -le $MaxRetries; $attempt++) { | ||
try { | ||
$result = & $ScriptBlock | ||
return $result | ||
} | ||
catch { | ||
$lastError = $_ | ||
Write-Warning "Attempt $attempt failed: $($_.Exception.Message)" | ||
Write-Warning "Retrying in $DelaySeconds seconds..." | ||
Start-Sleep -Seconds $DelaySeconds | ||
} | ||
} | ||
|
||
Write-Error "All $MaxRetries attempts failed. Original error: $($lastError.Exception.Message)" | ||
throw $lastError.Exception | ||
} | ||
|
||
function Get-Ess-Stack { | ||
param ( | ||
[string]$StackVersion | ||
) | ||
|
||
if ($Env:BUILDKITE_RETRY_COUNT -gt 0) { | ||
Write-Output "The step is retried, starting the ESS stack again" | ||
ess_up $StackVersion | ||
Write-Output "ESS stack is up. ES_HOST: $Env:ELASTICSEARCH_HOST" | ||
} else { | ||
# For the first run, we retrieve ESS stack metadata | ||
Write-Output "~~~ Receiving ESS stack metadata" | ||
$Env:ELASTICSEARCH_HOST = & buildkite-agent meta-data get "es.host" | ||
$Env:ELASTICSEARCH_USERNAME = & buildkite-agent meta-data get "es.username" | ||
$Env:ELASTICSEARCH_PASSWORD = & buildkite-agent meta-data get "es.pwd" | ||
$Env:KIBANA_HOST = & buildkite-agent meta-data get "kibana.host" | ||
$Env:KIBANA_USERNAME = & buildkite-agent meta-data get "kibana.username" | ||
$Env:KIBANA_PASSWORD = & buildkite-agent meta-data get "kibana.pwd" | ||
Write-Output "Received ESS stack data from previous step. ES_HOST: $Env:ELASTICSEARCH_HOST" | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
changelog/fragments/1731517501-removed-endpoint-security-from-linux-containers.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Kind can be one of: | ||
# - breaking-change: a change to previously-documented behavior | ||
# - deprecation: functionality that is being removed in a later release | ||
# - bug-fix: fixes a problem in a previous version | ||
# - enhancement: extends functionality but does not break or fix existing behavior | ||
# - feature: new functionality | ||
# - known-issue: problems that we are aware of in a given version | ||
# - security: impacts on the security of a product or a user’s deployment. | ||
# - upgrade: important information for someone upgrading from a prior version | ||
# - other: does not fit into any of the other categories | ||
kind: enhancement | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: removed endpoint security from linux containers | ||
|
||
# Long description; in case the summary is not enough to describe the change | ||
# this field accommodate a description without length limits. | ||
# NOTE: This field will be rendered only for breaking-change and known-issue kinds at the moment. | ||
description: Removed elastic endpoint security from linux containers as it has a dependency on systemd. | ||
|
||
# Affected component; usually one of "elastic-agent", "fleet-server", "filebeat", "metricbeat", "auditbeat", "all", etc. | ||
component: "elastic-agent" | ||
# PR URL; optional; the PR number that added the changeset. | ||
# If not present is automatically filled by the tooling finding the PR where this changelog fragment has been added. | ||
# NOTE: the tooling supports backports, so it's able to fill the original PR number instead of the backport PR number. | ||
# Please provide it if you are adding a fragment for a different PR. | ||
pr: https://github.com/elastic/elastic-agent/pull/6016 | ||
# Issue URL; optional; the GitHub issue related to this changeset (either closes or is part of). | ||
# If not present is automatically filled by the tooling with the issue linked to the PR number. | ||
issue: https://github.com/elastic/elastic-agent/issues/5495 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 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; | ||
// you may not use this file except in compliance with the Elastic License 2.0. | ||
|
||
package pkgcommon | ||
|
||
// PackageType defines the file format of the package (e.g. zip, rpm, etc). | ||
type PackageType int | ||
|
||
// List of possible package types. | ||
const ( | ||
RPM PackageType = iota + 1 | ||
Deb | ||
Zip | ||
TarGz | ||
Docker | ||
) | ||
|
||
var AllPackageTypes = []PackageType{ | ||
RPM, | ||
Deb, | ||
Zip, | ||
TarGz, | ||
Docker, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.