Skip to content

Commit

Permalink
do-not-merge: testing ubuntu agent
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed Feb 14, 2024
1 parent dfce233 commit 8e7735d
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 88 deletions.
15 changes: 6 additions & 9 deletions .buildkite/env-scripts/linux-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,16 @@ set_env() {
with_mage
}

sudo mkdir -p /etc/needrestart
echo "\$nrconf{restart} = 'a';" | sudo tee -a /etc/needrestart/needrestart.conf >/dev/null

if [[ $PLATFORM_TYPE == "Linux" ]]; then
check_platform_architecture
echo "--- ARCH $arch_type"

# Remove this code once beats specific agent is set up
if grep -q 'Ubuntu' /etc/*release; then
if grep -q 'Ubuntu' /etc/*release && [ "${arch_type}" == "arm64" ]; then
export DEBIAN_FRONTEND

echo "--- Ubuntu - Installing libs"
sudo apt-get update
sudo apt-get install -y libsystemd-dev
sudo apt install -y python3-pip
sudo apt-get install -y python3-venv
sudo mkdir -p /etc/needrestart
echo "\$nrconf{restart} = 'a';" | sudo tee -a /etc/needrestart/needrestart.conf >/dev/null

set_env
fi
Expand Down
83 changes: 41 additions & 42 deletions .buildkite/filebeat/filebeat-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,24 @@ env:
ASDF_MAGE_VERSION: "1.14.0"

steps:
# - group: "Filebeat Mandatory Testing"
# key: "mandatory-tests"
# if: build.env("GITHUB_PR_TRIGGER_COMMENT") == "filebeat" || build.env("BUILDKITE_PULL_REQUEST") != "false"
#
# steps:
# - label: ":ubuntu: Unit Tests"
# command:
# - ".buildkite/filebeat/scripts/unit-tests.sh"
# notify:
# - github_commit_status:
# context: "Filebeat: linux/Unit Tests"
# agents:
# provider: "gcp"
# image: "${IMAGE_UBUNTU_X86_64}"
# artifact_paths:
# - "filebeat/build/*.xml"
# - "filebeat/build/*.json"
#
- group: "Filebeat Mandatory Testing"
key: "mandatory-tests"
if: build.env("GITHUB_PR_TRIGGER_COMMENT") == "filebeat" || build.env("BUILDKITE_PULL_REQUEST") != "false"

steps:
- label: ":ubuntu: Unit Tests"
command:
- ".buildkite/filebeat/scripts/unit-tests.sh"
notify:
- github_commit_status:
context: "Filebeat: linux/Unit Tests"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
artifact_paths:
- "filebeat/build/*.xml"
- "filebeat/build/*.json"

# - label: ":ubuntu: Go Integration Tests"
# command:
# - ".buildkite/filebeat/scripts/integration-gotests.sh"
Expand Down Expand Up @@ -76,24 +76,24 @@ steps:
# - "filebeat/build/*.xml"
# - "filebeat/build/*.json"
#
# - group: "Extended Testing"
# key: "extended-tests"
- group: "Extended Testing"
key: "extended-tests"
# if: build.env("BUILDKITE_PULL_REQUEST") != "false" || build.env("GITHUB_PR_TRIGGER_COMMENT") == "filebeat for extended support"
#
# steps:
# - label: ":linux: ARM64 Unit Tests"
# key: "arm-extended"

steps:
- label: ":linux: ARM64 Unit Tests"
key: "arm-extended"
# if: build.env("GITHUB_PR_TRIGGER_COMMENT") == "filebeat for arm" || build.env("GITHUB_PR_LABELS") =~ /.*arm.*/
# command:
# - ".buildkite/filebeat/scripts/unit-tests.sh"
# notify:
# - github_commit_status:
# context: "Filebeat/Extended: Unit Tests ARM"
# agents:
# provider: "aws"
# imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
# instanceType: "t4g.large"
# artifact_paths: "filebeat/build/*.xml"
command:
- ".buildkite/filebeat/scripts/unit-tests.sh"
notify:
- github_commit_status:
context: "Filebeat/Extended: Unit Tests ARM"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.large"
artifact_paths: "filebeat/build/*.xml"
#
# - label: ":mac: MacOS Unit Tests"
# key: "macos-extended"
Expand Down Expand Up @@ -128,13 +128,12 @@ steps:
# artifact_paths:
# - "filebeat/build/*.xml"
# - "filebeat/build/*.json"

- group: "Packaging"
key: "packaging"
if: build.env("BUILDKITE_PULL_REQUEST") != "false"
#
# - group: "Packaging"
# key: "packaging"
# if: build.env("BUILDKITE_PULL_REQUEST") != "false"
# depends_on:
# - "mandatory-tests"

steps:
- label: Package pipeline
commands: ".buildkite/filebeat/scripts/packaging/package-step.sh"
# steps:
# - label: Package pipeline
# commands: ".buildkite/filebeat/scripts/packaging/package-step.sh"
64 changes: 32 additions & 32 deletions .buildkite/filebeat/scripts/packaging/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,35 @@ TARGET="observability-ci/${BEAT_NAME}"
echo "--- Creating package"
mage -d filebeat package

echo "--- Distribution list"
dir="filebeat/build/distributions"
buildkite-agent artifact upload "$dir/*.tar.gz;$dir/*.tar.gz.sha512"

echo "--- Docker image list"
docker images

define_tags
check_is_arm

echo "--- Tag & Push"
for variant in "${VARIANTS[@]}"; do
source="beats/${BEAT_NAME}${variant}"

for tag in "${tags[@]}"; do
targetTag=$tag${is_arm}

sourceName="${DOCKER_REGISTRY}/${source}:${SOURCE_TAG}"
targetName="${DOCKER_REGISTRY}/${TARGET}:${targetTag}"
# Remove following lines once beats fully migrated
targetName="${targetName}-buildkite"

if docker image inspect "${sourceName}" &>/dev/null; then
echo "Source name: $sourceName Target name: $targetName"
docker tag "$sourceName" "$targetName"
# docker push "$targetName"

else
echo "Docker image ${sourceName} does not exist"
fi
done
done
#echo "--- Distribution list"
#dir="filebeat/build/distributions"
#buildkite-agent artifact upload "$dir/*.tar.gz;$dir/*.tar.gz.sha512"
#
#echo "--- Docker image list"
#docker images
#
#define_tags
#check_is_arm
#
#echo "--- Tag & Push"
#for variant in "${VARIANTS[@]}"; do
# source="beats/${BEAT_NAME}${variant}"
#
# for tag in "${tags[@]}"; do
# targetTag=$tag${is_arm}
#
# sourceName="${DOCKER_REGISTRY}/${source}:${SOURCE_TAG}"
# targetName="${DOCKER_REGISTRY}/${TARGET}:${targetTag}"
# # Remove following lines once beats fully migrated
# targetName="${targetName}-buildkite"
#
# if docker image inspect "${sourceName}" &>/dev/null; then
# echo "Source name: $sourceName Target name: $targetName"
# docker tag "$sourceName" "$targetName"
## docker push "$targetName"
#
# else
# echo "Docker image ${sourceName} does not exist"
# fi
#done
#done
6 changes: 1 addition & 5 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -euo pipefail

DOCKER_REGISTRY_SECRET_PATH="kv/ci-shared/platform-ingest/docker_registry_prod"
PRIVATE_CI_GCS_CREDENTIALS_PATH="kv/ci-shared/platform-ingest/private_ci_artifacts_gcs_credentials"
GITHUB_TOKEN_VAULT_PATH="kv/ci-shared/platform-ingest/github_token"

# Secrets must be redacted
Expand All @@ -12,16 +11,13 @@ GITHUB_TOKEN_VAULT_PATH="kv/ci-shared/platform-ingest/github_token"
if [[ "$BUILDKITE_PIPELINE_SLUG" == "filebeat" || "$BUILDKITE_PIPELINE_SLUG" == "auditbeat" || "$BUILDKITE_PIPELINE_SLUG" == "heartbeat" || "$BUILDKITE_PIPELINE_SLUG" == "deploy-k8s" ]]; then
source .buildkite/env-scripts/env.sh
source .buildkite/env-scripts/win-env.sh
# source .buildkite/env-scripts/util.sh
source .buildkite/env-scripts/util.sh

if [[ -z "${GOLANG_VERSION-""}" ]]; then
export GOLANG_VERSION=$(cat "${WORKSPACE}/.go-version")
fi

if [[ "$BUILDKITE_STEP_KEY" == package* ]]; then
# source .buildkite/filebeat/scripts/packaging/packaging-env.sh

export PRIVATE_CI_GCS_CREDENTIALS_SECRET=$(retry 5 vault kv get -field=data -format=json ${PRIVATE_CI_GCS_CREDENTIALS_PATH})
export DOCKER_USERNAME_SECRET=$(retry 5 vault kv get -field user "${DOCKER_REGISTRY_SECRET_PATH}")
export DOCKER_PASSWORD_SECRET=$(retry 5 vault kv get -field password "${DOCKER_REGISTRY_SECRET_PATH}")
export GITHUB_TOKEN_SECRET=$(retry 5 vault kv get -field token ${GITHUB_TOKEN_VAULT_PATH})
Expand Down
Binary file removed filebeat/filebeat_windows_amd64.syso
Binary file not shown.

0 comments on commit 8e7735d

Please sign in to comment.