Skip to content

Commit 5d843e7

Browse files
Revert "ci: pin elastic-agent version (elastic#8736)"
This reverts commit 5c5b174.
1 parent 2252fdd commit 5d843e7

File tree

8 files changed

+38
-52
lines changed

8 files changed

+38
-52
lines changed

.buildkite/bk.integration-fips.pipeline.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ env:
77
IMAGE_UBUNTU_2404_X86_64: "platform-ingest-elastic-agent-ubuntu-2404-1750467641"
88
IMAGE_UBUNTU_X86_64_FIPS: "platform-ingest-elastic-agent-ubuntu-2204-fips-1750467641"
99
IMAGE_UBUNTU_ARM64_FIPS: "platform-ingest-elastic-agent-ubuntu-2204-fips-aarch64-1750467641"
10-
# Remove AGENT_PACKAGE_VERSION and AGENT_VERSION pinning once 9.2.0 DRA and stack are released
11-
AGENT_VERSION: "9.1.0-SNAPSHOT"
1210

1311
steps:
1412
- label: Build and push custom elastic-agent image

.buildkite/bk.integration.pipeline.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ env:
1212
IMAGE_DEBIAN_12: "platform-ingest-elastic-agent-debian-12-1750467641"
1313
IMAGE_WIN_2022: "platform-ingest-elastic-agent-windows-2022-1750467641"
1414
IMAGE_WIN_2025: "platform-ingest-elastic-agent-windows-2025-1750467641"
15-
# Remove AGENT_PACKAGE_VERSION and AGENT_VERSION pinning once 9.2.0 DRA and stack are released
16-
AGENT_VERSION: "9.1.0-SNAPSHOT"
17-
1815

1916
# This section is used to define the plugins that will be used in the pipeline.
2017
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins

.buildkite/integration.pipeline.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
env:
44
VAULT_PATH: "kv/ci-shared/observability-ingest/cloud/gcp"
5-
# Remove AGENT_PACKAGE_VERSION and AGENT_VERSION pinning once 9.2.0 DRA and stack are released
6-
AGENT_PACKAGE_VERSION: "9.1.0"
7-
BEAT_VERSION: "9.1.0"
85

96
steps:
107
- group: "Integration tests: packaging"

.buildkite/scripts/buildkite-integration-tests.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ go install gotest.tools/gotestsum
2525
gotestsum --version
2626

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

3432
Write-Output "~~~ Agent version: $env:AGENT_VERSION"
3533
$env:SNAPSHOT = $true

.buildkite/scripts/buildkite-integration-tests.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ echo "~~~ Running integration tests as $USER"
3737

3838
make install-gotestsum
3939

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

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

.buildkite/scripts/common.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ fi
99
if [[ -z "${SETUP_GVM_VERSION-""}" ]]; then
1010
SETUP_GVM_VERSION="v0.5.2" # https://github.com/andrewkroh/gvm/issues/44#issuecomment-1013231151
1111
fi
12-
13-
if [[ -z "${BEAT_VERSION-""}" ]]; then
14-
BEAT_VERSION=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+(\-[a-zA-Z]+[0-9]+)?' "${WORKSPACE}/version/version.go")
15-
export BEAT_VERSION
16-
fi
12+
BEAT_VERSION=$(grep -oE '[0-9]+\.[0-9]+\.[0-9]+(\-[a-zA-Z]+[0-9]+)?' "${WORKSPACE}/version/version.go")
13+
export BEAT_VERSION
1714

1815
getOSOptions() {
1916
case $(uname | tr '[:upper:]' '[:lower:]') in

magefile.go

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -996,10 +996,11 @@ func (Cloud) Image(ctx context.Context) {
996996
// Looks in build/distributions for an elastic-agent-cloud*.docker.tar.gz artifact and imports it as docker.elastic.co/beats-ci/elastic-agent-cloud:$VERSION
997997
// DOCKER_IMPORT_SOURCE - override source for import
998998
func (Cloud) Load() error {
999-
agentVersion, err := mage.AgentPackageVersion()
1000-
if err != nil {
1001-
return fmt.Errorf("failed to get agent package version: %w", err)
1002-
}
999+
snapshot := os.Getenv(snapshotEnv)
1000+
defer os.Setenv(snapshotEnv, snapshot)
1001+
os.Setenv(snapshotEnv, "true")
1002+
1003+
version := getVersion()
10031004

10041005
// Need to get the FIPS env var flag to see if we are using the normal source cloud image name, or the FIPS variant
10051006
fips := os.Getenv(fipsEnv)
@@ -1008,14 +1009,12 @@ func (Cloud) Load() error {
10081009
if err != nil {
10091010
fipsVal = false
10101011
}
1011-
if err := os.Setenv(fipsEnv, strconv.FormatBool(fipsVal)); err != nil {
1012-
return fmt.Errorf("failed to set fips env var: %w", err)
1013-
}
1012+
os.Setenv(fipsEnv, strconv.FormatBool(fipsVal))
10141013
devtools.FIPSBuild = fipsVal
10151014

1016-
source := "build/distributions/elastic-agent-cloud-" + agentVersion + "-SNAPSHOT-linux-" + runtime.GOARCH + ".docker.tar.gz"
1015+
source := "build/distributions/elastic-agent-cloud-" + version + "-linux-" + runtime.GOARCH + ".docker.tar.gz"
10171016
if fipsVal {
1018-
source = "build/distributions/elastic-agent-cloud-fips-" + agentVersion + "-SNAPSHOT-linux-" + runtime.GOARCH + ".docker.tar.gz"
1017+
source = "build/distributions/elastic-agent-cloud-fips-" + version + "-linux-" + runtime.GOARCH + ".docker.tar.gz"
10191018
}
10201019
if envSource, ok := os.LookupEnv("DOCKER_IMPORT_SOURCE"); ok && envSource != "" {
10211020
source = envSource
@@ -1027,9 +1026,20 @@ func (Cloud) Load() error {
10271026
// Push builds a cloud image tags it correctly and pushes to remote image repo.
10281027
// Previous login to elastic registry is required!
10291028
func (Cloud) Push() error {
1030-
agentVersion, err := mage.AgentPackageVersion()
1031-
if err != nil {
1032-
return fmt.Errorf("failed to get agent package version: %w", err)
1029+
snapshot := os.Getenv(snapshotEnv)
1030+
defer os.Setenv(snapshotEnv, snapshot)
1031+
1032+
os.Setenv(snapshotEnv, "true")
1033+
1034+
version := getVersion()
1035+
var tag string
1036+
if envTag, isPresent := os.LookupEnv("CUSTOM_IMAGE_TAG"); isPresent && len(envTag) > 0 {
1037+
tag = envTag
1038+
} else {
1039+
commit := dockerCommitHash()
1040+
time := time.Now().Unix()
1041+
1042+
tag = fmt.Sprintf("%s-%s-%d", version, commit, time)
10331043
}
10341044

10351045
// Need to get the FIPS env var flag to see if we are using the normal source cloud image name, or the FIPS variant
@@ -1039,46 +1049,38 @@ func (Cloud) Push() error {
10391049
if err != nil {
10401050
fipsVal = false
10411051
}
1042-
if err := os.Setenv(fipsEnv, strconv.FormatBool(fipsVal)); err != nil {
1043-
return fmt.Errorf("failed to set fips env var: %w", err)
1044-
}
1052+
os.Setenv(fipsEnv, strconv.FormatBool(fipsVal))
10451053
devtools.FIPSBuild = fipsVal
10461054

1047-
sourceCloudImageName := fmt.Sprintf("docker.elastic.co/beats-ci/elastic-agent-cloud:%s-SNAPSHOT", agentVersion)
1055+
sourceCloudImageName := fmt.Sprintf("docker.elastic.co/beats-ci/elastic-agent-cloud:%s", version)
10481056
if fipsVal {
1049-
sourceCloudImageName = fmt.Sprintf("docker.elastic.co/beats-ci/elastic-agent-cloud-fips:%s-SNAPSHOT", agentVersion)
1050-
}
1051-
var targetTag string
1052-
if envTag, isPresent := os.LookupEnv("CUSTOM_IMAGE_TAG"); isPresent && len(envTag) > 0 {
1053-
targetTag = envTag
1054-
} else {
1055-
targetTag = fmt.Sprintf("%s-%s-%d", agentVersion, dockerCommitHash(), time.Now().Unix())
1057+
sourceCloudImageName = fmt.Sprintf("docker.elastic.co/beats-ci/elastic-agent-cloud-fips:%s", version)
10561058
}
10571059
var targetCloudImageName string
10581060
if customImage, isPresent := os.LookupEnv("CI_ELASTIC_AGENT_DOCKER_IMAGE"); isPresent && len(customImage) > 0 {
1059-
targetCloudImageName = fmt.Sprintf("%s:%s", customImage, targetTag)
1061+
targetCloudImageName = fmt.Sprintf("%s:%s", customImage, tag)
10601062
} else {
1061-
targetCloudImageName = fmt.Sprintf(cloudImageTmpl, targetTag)
1063+
targetCloudImageName = fmt.Sprintf(cloudImageTmpl, tag)
10621064
}
10631065

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

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

10781080
return nil
10791081
}
10801082

1081-
// Create a new devmachine that will be auto-deleted in 6 hours.
1083+
// Creates a new devmachine that will be auto-deleted in 6 hours.
10821084
// Example: MACHINE_IMAGE="family/platform-ingest-elastic-agent-ubuntu-2204" ZONE="us-central1-a" mage devmachine:create "pavel-dev-machine"
10831085
// ZONE defaults to 'us-central1-a', MACHINE_IMAGE defaults to 'family/platform-ingest-elastic-agent-ubuntu-2204'
10841086
func (Devmachine) Create(instanceName string) error {

testing/integration/ess/upgrade_broken_package_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ func TestUpgradeBrokenPackageVersion(t *testing.T) {
3232
Local: false, // requires Agent installation
3333
Sudo: true, // requires Agent installation
3434
})
35-
t.Skip("Skip this test until elastic agent version pinning is removed from Integration test runs on CI")
3635

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

0 commit comments

Comments
 (0)