diff --git a/.buildkite/bk.integration.pipeline.yml b/.buildkite/bk.integration.pipeline.yml index 223165e19c1..42331abefef 100644 --- a/.buildkite/bk.integration.pipeline.yml +++ b/.buildkite/bk.integration.pipeline.yml @@ -6,12 +6,14 @@ env: # The following images are defined here and their values will be updated by updatecli # Please do not change them manually. - IMAGE_UBUNTU_2404_X86_64: "platform-ingest-elastic-agent-ubuntu-2404-1749258065" - IMAGE_UBUNTU_2404_ARM_64: "platform-ingest-elastic-agent-ubuntu-2404-aarch64-1749258065" - IMAGE_RHEL_8: "platform-ingest-elastic-agent-rhel-8-1749258065" - IMAGE_DEBIAN_12: "platform-ingest-elastic-agent-debian-12-1749258065" - IMAGE_WIN_2022: "platform-ingest-elastic-agent-windows-2022-1749258065" - IMAGE_WIN_2025: "platform-ingest-elastic-agent-windows-2025-1749258065" + IMAGE_UBUNTU_2404_X86_64: "platform-ingest-elastic-agent-ubuntu-2404-1750467641" + IMAGE_UBUNTU_2404_ARM_64: "platform-ingest-elastic-agent-ubuntu-2404-aarch64-1750467641" + IMAGE_RHEL_8: "platform-ingest-elastic-agent-rhel-8-1750467641" + 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.17.8 DRA and stack are released + AGENT_VERSION: "8.17.8-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 diff --git a/.buildkite/integration.pipeline.yml b/.buildkite/integration.pipeline.yml index 1516599dd8c..c9cb7f422f8 100644 --- a/.buildkite/integration.pipeline.yml +++ b/.buildkite/integration.pipeline.yml @@ -2,6 +2,9 @@ env: VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp" + # Remove AGENT_PACKAGE_VERSION and AGENT_VERSION pinning once 8.17.8 DRA and stack are released + AGENT_PACKAGE_VERSION: "8.17.8" + BEAT_VERSION: "8.17.8" steps: - group: "Integration tests: packaging" diff --git a/.buildkite/scripts/buildkite-integration-tests.ps1 b/.buildkite/scripts/buildkite-integration-tests.ps1 index d96c1439ad6..86b7d39c41a 100644 --- a/.buildkite/scripts/buildkite-integration-tests.ps1 +++ b/.buildkite/scripts/buildkite-integration-tests.ps1 @@ -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 diff --git a/.buildkite/scripts/buildkite-integration-tests.sh b/.buildkite/scripts/buildkite-integration-tests.sh index 885763f1b26..b8e56603e2c 100755 --- a/.buildkite/scripts/buildkite-integration-tests.sh +++ b/.buildkite/scripts/buildkite-integration-tests.sh @@ -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}" diff --git a/.buildkite/scripts/common.sh b/.buildkite/scripts/common.sh index 97b3a3a4904..3074a839009 100755 --- a/.buildkite/scripts/common.sh +++ b/.buildkite/scripts/common.sh @@ -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 diff --git a/magefile.go b/magefile.go index 1cbbe387096..368535c66ea 100644 --- a/magefile.go +++ b/magefile.go @@ -821,41 +821,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) diff --git a/testing/integration/upgrade_broken_package_test.go b/testing/integration/upgrade_broken_package_test.go index 5ece19ddbd8..ac50b180bbd 100644 --- a/testing/integration/upgrade_broken_package_test.go +++ b/testing/integration/upgrade_broken_package_test.go @@ -31,6 +31,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()