Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
be8740c
Replace Makefile with magefile.go
michel-laterman May 13, 2025
198c763
Add verbosity flag to ci step
michel-laterman May 21, 2025
f4b36bf
Merge branch 'main' into magefile
michel-laterman May 21, 2025
1dbb65a
Update NOTICE-FIPS.txt
michel-laterman May 21, 2025
d31fa31
Add go mod tidy into check:noChanges
michel-laterman May 21, 2025
0855116
Remove FIPS e2e tests
michel-laterman May 21, 2025
83543ac
use combinde output for check:noChanges
michel-laterman May 21, 2025
ee1fa51
Add more logging
michel-laterman May 21, 2025
c5b26d6
buildkite mage installation uses go.mod version
michel-laterman May 21, 2025
a1ea797
Output mage version
michel-laterman May 21, 2025
222a27a
Fix docker:binary,release,cover targets
michel-laterman May 21, 2025
1127eaa
Output git diff on success and failure
michel-laterman May 21, 2025
5049138
output git diff
michel-laterman May 21, 2025
9092013
check:notice serial builds
michel-laterman May 21, 2025
141b7ec
download all -> download
michel-laterman May 21, 2025
50fdc98
Fix notice files
michel-laterman May 21, 2025
d7a4035
Add details for failed step outputs
michel-laterman May 21, 2025
0b39ad2
Pass environ to more mage targets
michel-laterman May 22, 2025
fb8a612
Fix linter issue
michel-laterman May 22, 2025
9621851
Fix e2e tests
michel-laterman May 22, 2025
9002018
Fix fips140=only test step
michel-laterman May 22, 2025
cdf50df
Cleanup
michel-laterman May 22, 2025
678a688
include api key id
michel-laterman May 22, 2025
5daa166
Add DOCKER_REGISTRY to steps
michel-laterman May 22, 2025
87313d1
Fix cloude2e
michel-laterman May 23, 2025
22759cd
Change cloude2e script to call dependecies explicitly, use docker:cov…
michel-laterman May 23, 2025
fc39301
Specify docker image name
michel-laterman May 23, 2025
d4958ff
Attempt to fix variable passing to terraform
michel-laterman May 23, 2025
3985f26
Fix var passing
michel-laterman May 23, 2025
b9b462d
Fix cloude2e, make certs
michel-laterman May 23, 2025
254724b
fix e2e cert gen
michel-laterman May 23, 2025
75f800e
Merge branch 'main' into magefile
michel-laterman May 23, 2025
eaae711
Fix cloud cleanup
michel-laterman May 23, 2025
54d7790
Smaller cloude2e deployments, fix cleanup logging
michel-laterman May 23, 2025
86cc01c
Fix terraform
michel-laterman May 23, 2025
beffaa4
Fix cloude2e runner error
michel-laterman May 23, 2025
183e42f
Fix zip artifact generation
michel-laterman May 23, 2025
d508944
Add default and aliases to magefile, add check:imports target
michel-laterman May 26, 2025
0b61c87
Use custom user to build artifacts in docker
michel-laterman May 27, 2025
8676e99
Fix FIPS image creation
michel-laterman May 27, 2025
34469d4
Merge branch 'main' into magefile
michel-laterman May 27, 2025
52da2f8
Update NOTICE-FIPS.txt
michel-laterman May 27, 2025
57e53d9
Merge branch 'main' into magefile
michel-laterman May 28, 2025
f86a6da
Fix notice fips
michel-laterman May 28, 2025
b80e17a
Use output for git diff
michel-laterman May 28, 2025
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
57 changes: 24 additions & 33 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@

env:
DOCKER_COMPOSE_VERSION: "1.25.5"
DOCKER_REGISTRY: "docker.elastic.co"
DOCKER_IMAGE: "${DOCKER_REGISTRY}/observability-ci/fleet-server" # needs to rename for rollback
DOCKER_IMAGE_SHA_TAG: "git-${BUILDKITE_COMMIT:0:12}" # needs to rename for rollback, should be "git-${BUILDKITE_COMMIT:0:12}"
DOCKER_IMAGE_LATEST_TAG: "latest" # needs to rename for rollback
DOCKER_IMAGE_GIT_TAG: "${BUILDKITE_BRANCH}" # needs to rename for rollback
GO_AGENT_IMAGE: "golang:${GO_VERSION}"
TERRAFORM_VERSION: "1.6.4"

steps:
Expand All @@ -31,19 +25,15 @@ steps:
steps:
- label: ":white_check_mark: Run check-ci"
key: check-ci
command: "make check-ci"
command: ".buildkite/scripts/check_ci.sh"
agents:
image: "${GO_AGENT_IMAGE}"
cpu: "8"
memory: "4G"
provider: "gcp"

- label: ":building_construction: Run local build"
key: make-local
command: "make local"
command: ".buildkite/scripts/local_build.sh"
agents:
image: "${GO_AGENT_IMAGE}"
cpu: "8"
memory: "4G"
provider: "gcp"

- label: ":building_construction: Run local build: MacOS"
key: make-local-macos
Expand All @@ -58,6 +48,8 @@ steps:
- label: "Run go benchmark for PR branch"
key: "go-benchmark-pr"
command: ".buildkite/scripts/run_benchmark.sh pr"
env:
BENCHMARK_ARGS: "-count=8 -benchmem"
artifact_paths:
- build/next.out
- build/next.stat
Expand All @@ -66,8 +58,11 @@ steps:
machineType: "c2-standard-8"

- label: "Run go benchmark for ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}"
skip: true # FIXME: Temporarily disabled until mage is on main
key: "go-benchmark-base"
command: ".buildkite/scripts/run_benchmark.sh base"
env:
BENCHMARK_ARGS: "-count=8 -benchmem"
artifact_paths:
- build/base.out
- build/base.stat
Expand All @@ -76,6 +71,7 @@ steps:
machineType: "c2-standard-8"

- label: "Compare results"
skip: true # FIXME: Temporarily disabled until mage is on main
key: "go-benchmark-compare"
command: ".buildkite/scripts/run_benchmark.sh compare"
artifact_paths:
Expand Down Expand Up @@ -115,10 +111,9 @@ steps:

- label: ":smartbear-testexecute: Run fips140=only unit tests"
key: unit-test-fips140-only
command: ".buildkite/scripts/unit_test.sh"
command: ".buildkite/scripts/unit_test_fipsonly.sh"
env:
FIPS: "true"
GODEBUG: "fips140=only"
agents:
provider: "gcp"
artifact_paths:
Expand Down Expand Up @@ -164,23 +159,6 @@ steps:
branches: "main"
debug: true

- label: "FIPS E2E Test"
key: "fips-e2e-test"
env:
FIPS: true
command: ".buildkite/scripts/e2e_test.sh"
agents:
provider: "gcp"
artifact_paths:
- build/*.xml
- build/e2e-coverage.out
plugins:
- test-collector#v1.10.2:
files: "build/test-*.xml"
format: "junit"
branches: "main"
debug: true

- label: ":junit: Junit annotate"
plugins:
- junit-annotate#v2.4.1:
Expand Down Expand Up @@ -216,6 +194,13 @@ steps:

- label: ":gcloud: Cloud e2e Test"
key: "cloud-e2e-test"
env:
DOCKER_REGISTRY: "docker.elastic.co"
DOCKER_IMAGE: "docker.elastic.co/beats-ci/elastic-agent-cloud-fleet"
DOCKER_IMAGE_TAG: "pr-${BUILDKITE_PULL_REQUEST}-${BUILDKITE_COMMIT:0:12}"
SNAPSHOT: "true"
PLATFORMS: "linux/amd64"
TF_VAR_pull_request: "${BUILDKITE_PULL_REQUEST}"
command: ".buildkite/scripts/cloud_e2e_test.sh"
agents:
provider: "gcp"
Expand All @@ -231,6 +216,12 @@ steps:
- label: ":docker: Publish docker image"
key: "publish"
command: ".buildkite/scripts/build_push_docker_image.sh"
env:
DOCKER_REGISTRY: "docker.elastic.co"
DOCKER_IMAGE: "docker.elastic.co/observability-ci/fleet-server" # needs to rename for rollback
DOCKER_IMAGE_SHA_TAG: "git-${BUILDKITE_COMMIT:0:12}" # needs to rename for rollback, should be "git-${BUILDKITE_COMMIT:0:12}"
DOCKER_IMAGE_LATEST_TAG: "latest" # needs to rename for rollback
DOCKER_IMAGE_GIT_TAG: "${BUILDKITE_BRANCH}" # needs to rename for rollback
if: "build.env('BUILDKITE_PULL_REQUEST') == 'false' && build.env('BUILDKITE_BRANCH') == 'main'"
agents:
provider: "gcp"
Expand Down
12 changes: 9 additions & 3 deletions .buildkite/scripts/build_push_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ set -euo pipefail

source .buildkite/scripts/common.sh

add_bin_path

with_go

with_mage

echo "Building the docker image..."
if ! docker pull -q ${DOCKER_IMAGE}:${DOCKER_IMAGE_SHA_TAG} 2> /dev/null; then
DOCKER_IMAGE_TAG="${DOCKER_IMAGE_SHA_TAG}"
DOCKER_IMAGE=${DOCKER_IMAGE} DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG} make build-and-push-docker
DOCKER_IMAGE=${DOCKER_IMAGE} DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG} mage docker:image docker:push
fi

if [[ "${DOCKER_IMAGE_GIT_TAG}" == "main" ]]; then
DOCKER_IMAGE=${DOCKER_IMAGE} DOCKER_IMAGE_TAG="${DOCKER_IMAGE_LATEST_TAG}" make build-and-push-docker
DOCKER_IMAGE=${DOCKER_IMAGE} DOCKER_IMAGE_TAG="${DOCKER_IMAGE_LATEST_TAG}" mage docker:image docker:push
elif [[ ${BUILDKITE_PULL_REQUEST} == "false" ]]; then
DOCKER_IMAGE=${DOCKER_IMAGE} DOCKER_IMAGE_TAG="${DOCKER_IMAGE_GIT_TAG}" make build-and-push-docker
DOCKER_IMAGE=${DOCKER_IMAGE} DOCKER_IMAGE_TAG="${DOCKER_IMAGE_GIT_TAG}" mage docker:image docker:push
fi
13 changes: 13 additions & 0 deletions .buildkite/scripts/check_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -euo pipefail

source .buildkite/scripts/common.sh

add_bin_path

with_go

with_mage

mage check:ci
35 changes: 34 additions & 1 deletion .buildkite/scripts/cloud_e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,37 @@ with_Terraform

with_docker_compose

USER=fleetserverci make test-cloude2e
with_mage

cleanup() {
r=$?

if [ -f dev-tools/cloud/terraform/.terraform.lock.hcl ] ; then
echo "--- Deployment detected, running cleanup."
mage test:cloudE2EDown
else
echo "--- No deployment detected, skipping cleanup."
fi
exit $r
}
trap cleanup EXIT INT TERM

USER=fleetserverci mage docker:cover docker:customAgentImage docker:push test:cloudE2EUp
FLEET_SERVER_URL=$(terraform output --raw --state=dev-tools/cloud/terraform/terraform.tfstate fleet_url)
echo "Fleet server: \"${FLEET_SERVER_URL}\""
echo "Deployment ID: $(terraform output --raw --state=dev-tools/cloud/terraform/terraform.tfstate deployment_id)"

if [[ "${FLEET_SERVER_URL}" == "" ]]; then
message="FLEET_SERVER_URL is empty, cloud e2e tests cannot be executed"
if [[ "${CI}" == "true" ]]; then
buildkite-agent annotate \
"${message}" \
--context "ctx-cloude2e-test" \
--style "error"
fi
echo "${message}"
exit 0
fi

echo "--- Trigger cloud E2E test"
mage test:cloudE2ERun
16 changes: 5 additions & 11 deletions .buildkite/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ with_msft_go() {
echo "Setting up microsoft/go"
create_workspace
check_platform_architeture
MSFT_DOWNLOAD_URL=https://aka.ms/golang/release/latest/go$(cat .go-version)-1.${platform_type}-${arch_type}.tar.gz
MSFT_DOWNLOAD_URL=https://aka.ms/golang/release/latest/go$(cat .go-version).${platform_type}-${arch_type}.tar.gz
retry 5 $(curl -sL -o - $MSFT_DOWNLOAD_URL | tar -xz -f - -C ${WORKSPACE})
export PATH="${PATH}:${WORKSPACE}/go/bin"
go version
Expand Down Expand Up @@ -148,17 +148,11 @@ download_mbp_packages_from_gcp_bucket() {
}

with_mage() {
local install_packages=(
"github.com/magefile/mage"
"github.com/elastic/go-licenser"
"golang.org/x/tools/cmd/goimports"
"github.com/jstemmer/go-junit-report"
"gotest.tools/gotestsum"
)
create_workspace
for pkg in "${install_packages[@]}"; do
go install "${pkg}@latest"
done
go install github.com/magefile/mage # uses go.mod implicitly
mage -clean
mage -version
which mage
}

cleanup() {
Expand Down
15 changes: 7 additions & 8 deletions .buildkite/scripts/dra_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ set -euo pipefail

source .buildkite/scripts/common.sh

add_bin_path

with_go

with_mage

FOLDER_PATH="build/distributions"
BASE_DIR="${WORKSPACE}/${FOLDER_PATH}"
DRA_OUTPUT="release-manager.out"
Expand All @@ -12,7 +18,7 @@ export TYPE=${1}
# DRA_BRANCH can be used for manually testing packaging with PRs
# e.g. define `DRA_BRANCH="main"` under Options/Environment Variables in the Buildkite UI after clicking new Build
export BRANCH="${DRA_BRANCH:="${BUILDKITE_BRANCH:=""}"}"
export VERSION="$(make get-version)"
export VERSION="$(mage getVersion)"

if [[ "${VERSION}" == *"-SNAPSHOT"* || "${VERSION}" == "" ]]; then
echo "The 'version' parameter is required and it cannot contain the suffix '-SNAPSHOT'."
Expand All @@ -24,14 +30,7 @@ if [[ "${PROJECT}" == "" ]]; then
exit 1
fi

add_bin_path

download_mbp_packages_from_gcp_bucket "${FOLDER_PATH}" "${TYPE}"

with_go

with_mage

export RM_VERSION="${VERSION}"

if [[ ${TYPE} == "snapshot" ]]; then
Expand Down
4 changes: 3 additions & 1 deletion .buildkite/scripts/e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ with_go

with_docker_compose

with_mage

echo "Starting the E2E tests..."
make test-e2e junit-report
mage test:e2e test:junitReport
4 changes: 3 additions & 1 deletion .buildkite/scripts/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ with_go

with_docker_compose

with_mage

echo "Starting the integration tests..."
make test-int junit-report
mage test:integration test:junitReport
4 changes: 3 additions & 1 deletion .buildkite/scripts/local_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ else
with_go
fi

make local
with_mage

mage build:local
4 changes: 2 additions & 2 deletions .buildkite/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ with_mage
case "${TYPE}" in
"snapshot")
export SNAPSHOT=true
make release
mage build:release
;;
"staging")
make release
mage build:release
;;
*)
echo "The option is unsupported yet"
Expand Down
8 changes: 5 additions & 3 deletions .buildkite/scripts/release_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ add_bin_path

with_go

make docker-release
with_mage

mage docker:release

upload_packages_to_gcp_bucket "build/distributions/"

make test-release
mage test:release

make build-docker
mage docker:image
14 changes: 6 additions & 8 deletions .buildkite/scripts/run_benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ add_bin_path

with_go

with_mage

export TYPE=${1}
#export BRANCH="${BUILDKITE_BRANCH}"
export BENCHMARK_ARGS="-count=8 -benchmem"

if [[ ${TYPE} == "pr" ]]; then
echo "Starting the go benchmark for the pull request"
BENCH_BASE=next.out make benchmark
BENCH_BASE=next.out make benchstat | tee build/next.stat
BENCH_BASE=next.out mage test:benchmark
BENCH_BASE=next.out mage test:benchstat | tee build/next.stat
BENCH=$(cat build/next.out)
buildkite-agent annotate --style 'info' --context "gobench_pr" --append << _EOF_
#### Benchmark for pull request
Expand All @@ -34,8 +34,8 @@ fi
if [[ ${TYPE} == "base" ]]; then
echo "Starting the go benchmark for the pull request"
git checkout ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
BENCH_BASE=base.out make benchmark
BENCH_BASE=base.out make benchstat | tee build/base.stat
BENCH_BASE=base.out mage test:benchmark
BENCH_BASE=base.out mage test:benchstat | tee build/base.stat
BENCH=$(cat build/base.out)
buildkite-agent annotate --style 'info' --context "gobench_base" --append << _EOF_
#### Benchmark for the ${BUILDKITE_PULL_REQUEST_BASE_BRANCH}
Expand Down Expand Up @@ -93,5 +93,3 @@ Download <a href="artifact://build/full_report.json">full_report.json</a>
_EOF_
fi
fi


Loading
Loading