Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .buildkite/bk.integration.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ env:
IMAGE_DEBIAN_12: "platform-ingest-elastic-agent-debian-12-1750467641"
IMAGE_WIN_2022: "platform-ingest-elastic-agent-windows-2022-1750467641"
IMAGE_WIN_2025: "platform-ingest-elastic-agent-windows-2025-1750467641"
# Remove AGENT_VERSION pinning once 8.18.4 DRA and stack are released
AGENT_VERSION: "8.18.3-SNAPSHOT"


# This section is used to define the plugins that will be used in the pipeline.
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
Expand Down
3 changes: 3 additions & 0 deletions .buildkite/integration.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

env:
VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp"
# Remove AGENT_PACKAGE_VERSION and AGENT_VERSION pinning once 8.18.4 DRA and stack are released
AGENT_PACKAGE_VERSION: "8.18.3"
BEAT_VERSION: "8.18.3"

steps:
- group: "Integration tests: packaging"
Expand Down
8 changes: 5 additions & 3 deletions .buildkite/scripts/buildkite-integration-tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ go install gotest.tools/gotestsum
gotestsum --version

$env:TEST_BINARY_NAME = "elastic-agent"
# Parsing version.go. Will be simplified here: https://github.com/elastic/ingest-dev/issues/4925
$AGENT_VERSION = (Get-Content version/version.go | Select-String -Pattern 'const defaultBeatVersion =' | ForEach-Object { $_ -replace '.*?"(.*?)".*', '$1' })
$env:AGENT_VERSION = $AGENT_VERSION + "-SNAPSHOT"
if (-not $env:AGENT_VERSION) {
# Parsing version.go. Will be simplified here: https://github.com/elastic/ingest-dev/issues/4925
$AGENT_VERSION = (Get-Content version/version.go | Select-String -Pattern 'const defaultBeatVersion =' | ForEach-Object { $_ -replace '.*?"(.*?)".*', '$1' })
$env:AGENT_VERSION = $AGENT_VERSION + "-SNAPSHOT"
}

Write-Output "~~~ Agent version: $env:AGENT_VERSION"
$env:SNAPSHOT = $true
Expand Down
9 changes: 6 additions & 3 deletions .buildkite/scripts/buildkite-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ echo "~~~ Running integration tests as $USER"

make install-gotestsum

# Parsing version.go. Will be simplified here: https://github.com/elastic/ingest-dev/issues/4925
AGENT_VERSION=$(grep "const defaultBeatVersion =" version/version.go | cut -d\" -f2)
AGENT_VERSION="${AGENT_VERSION}-SNAPSHOT"
if [[ -z "${AGENT_VERSION:-}" ]]; then
# Parsing version.go. Will be simplified here: https://github.com/elastic/ingest-dev/issues/4925
AGENT_VERSION=$(grep "const defaultBeatVersion =" version/version.go | cut -d\" -f2)
AGENT_VERSION="${AGENT_VERSION}-SNAPSHOT"
fi

export AGENT_VERSION
echo "~~~ Agent version: ${AGENT_VERSION}"

Expand Down
7 changes: 5 additions & 2 deletions .buildkite/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ fi
if [[ -z "${SETUP_GVM_VERSION-""}" ]]; then
SETUP_GVM_VERSION="v0.5.2" # https://github.com/andrewkroh/gvm/issues/44#issuecomment-1013231151
fi
BEAT_VERSION=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+(\-[a-zA-Z]+[0-9]+)?' "${WORKSPACE}/version/version.go")
export BEAT_VERSION

if [[ -z "${BEAT_VERSION-""}" ]]; then
BEAT_VERSION=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+(\-[a-zA-Z]+[0-9]+)?' "${WORKSPACE}/version/version.go")
export BEAT_VERSION
fi

getOSOptions() {
case $(uname | tr '[:upper:]' '[:lower:]') in
Expand Down
30 changes: 13 additions & 17 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,41 +880,37 @@ func (Cloud) Image(ctx context.Context) {
// Push builds a cloud image tags it correctly and pushes to remote image repo.
// Previous login to elastic registry is required!
func (Cloud) Push() error {
snapshot := os.Getenv(snapshotEnv)
defer os.Setenv(snapshotEnv, snapshot)

os.Setenv(snapshotEnv, "true")
agentVersion, err := mage.AgentPackageVersion()
if err != nil {
return fmt.Errorf("failed to get agent package version: %w", err)
}

version := getVersion()
var tag string
var targetTag string
if envTag, isPresent := os.LookupEnv("CUSTOM_IMAGE_TAG"); isPresent && len(envTag) > 0 {
tag = envTag
targetTag = envTag
} else {
commit := dockerCommitHash()
time := time.Now().Unix()

tag = fmt.Sprintf("%s-%s-%d", version, commit, time)
targetTag = fmt.Sprintf("%s-%s-%d", agentVersion, dockerCommitHash(), time.Now().Unix())
}

sourceCloudImageName := fmt.Sprintf("docker.elastic.co/beats-ci/elastic-agent-cloud:%s", version)
sourceCloudImageName := fmt.Sprintf("docker.elastic.co/beats-ci/elastic-agent-cloud:%s-SNAPSHOT", agentVersion)
var targetCloudImageName string
if customImage, isPresent := os.LookupEnv("CI_ELASTIC_AGENT_DOCKER_IMAGE"); isPresent && len(customImage) > 0 {
targetCloudImageName = fmt.Sprintf("%s:%s", customImage, tag)
targetCloudImageName = fmt.Sprintf("%s:%s", customImage, targetTag)
} else {
targetCloudImageName = fmt.Sprintf(cloudImageTmpl, tag)
targetCloudImageName = fmt.Sprintf(cloudImageTmpl, targetTag)
}

fmt.Printf(">> Setting a docker image tag to %s\n", targetCloudImageName)
err := sh.RunV("docker", "tag", sourceCloudImageName, targetCloudImageName)
err = sh.RunV("docker", "tag", sourceCloudImageName, targetCloudImageName)
if err != nil {
return fmt.Errorf("Failed setting a docker image tag: %w", err)
return fmt.Errorf("failed setting a docker image tag: %w", err)
}
fmt.Println(">> Docker image tag updated successfully")

fmt.Println(">> Pushing a docker image to remote registry")
err = sh.RunV("docker", "image", "push", targetCloudImageName)
if err != nil {
return fmt.Errorf("Failed pushing docker image: %w", err)
return fmt.Errorf("failed pushing docker image: %w", err)
}
fmt.Printf(">> Docker image pushed to remote registry successfully: %s\n", targetCloudImageName)

Expand Down
1 change: 1 addition & 0 deletions testing/integration/ess/upgrade_broken_package_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func TestUpgradeBrokenPackageVersion(t *testing.T) {
Local: false, // requires Agent installation
Sudo: true, // requires Agent installation
})
t.Skip("Skip this test until elastic agent version pinning is removed from Integration test runs on CI")

ctx, cancel := testcontext.WithDeadline(t, context.Background(), time.Now().Add(10*time.Minute))
defer cancel()
Expand Down