Skip to content

Commit

Permalink
updated packaging group steps
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed Feb 6, 2024
1 parent 65b35cf commit c8ef8ce
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 57 deletions.
37 changes: 3 additions & 34 deletions .buildkite/auditbeat/auditbeat-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ env:
IMAGE_WIN_2019: "family/core-windows-2019"
IMAGE_WIN_2022: "family/core-windows-2022"
IMAGE_RHEL9: "family/core-rhel-9"
IMAGE_MACOS_X86_64: "generic-13-ventura-x64"

steps:
- group: "Auditbeat Mandatory Testing"
Expand Down Expand Up @@ -74,7 +75,7 @@ steps:

- group: "Extended Testing"
key: "extended-tests"
if: build.env("BUILDKITE_PULL_REQUEST") != "false" || build.env("GITHUB_PR_TRIGGER_COMMENT") == "auditbeat extended tests"
if: build.env("BUILDKITE_PULL_REQUEST") != "false" || build.env("GITHUB_PR_TRIGGER_COMMENT") == "auditbeat for extended support"

steps:
- label: ":linux: ARM64 Unit Tests"
Expand All @@ -101,7 +102,7 @@ steps:
context: "auditbeat/Extended: MacOS Unit Tests"
agents:
provider: "orka"
imagePrefix: "generic-13-ventura-x64"
imagePrefix: "${IMAGE_MACOS_X86_64}"
artifact_paths: "auditbeat/build/*.xml"

- group: "Windows Extended Testing"
Expand Down Expand Up @@ -130,39 +131,7 @@ steps:
if: build.env("BUILDKITE_PULL_REQUEST") != "false"
depends_on:
- "mandatory-tests"
- "extended-tests"
- "extended-tests-win"

steps:
- label: Package pipeline
commands: ".buildkite/auditbeat/scripts/package-step.sh | buildkite-agent pipeline upload"

- label: ":ubuntu: Packaging Linux X86"
key: "package-linux-x86"
env:
PLATFORMS: "+all linux/amd64 linux/arm64 windows/amd64 darwin/amd64 darwin/arm64"
command:
- ".buildkite/auditbeat/scripts/package.sh"
notify:
- github_commit_status:
context: "auditbeat/Packaging: Linux X86"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"

- label: ":linux: Packaging Linux ARM"
key: "package-linux-arm"
env:
PLATFORMS: "linux/arm64"
PACKAGES: "docker"
command:
- ".buildkite/auditbeat/scripts/package.sh"
notify:
- github_commit_status:
context: "auditbeat/Packaging: Linux ARM"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.large"
artifact_paths:
- "auditbeat/build/distributions/*.tar.gz"
2 changes: 1 addition & 1 deletion .buildkite/auditbeat/scripts/crosscompile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ set -euo pipefail

source .buildkite/env-scripts/linux-env.sh

echo ":: Executing Crosscompile ::"
echo "--- Executing Crosscompile"
make -C auditbeat crosscompile
5 changes: 2 additions & 3 deletions .buildkite/auditbeat/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ set -euo pipefail

source .buildkite/env-scripts/linux-env.sh

echo ":: Docker Version ::"
docker --version
echo "--- Docker Version: $(docker --version)"

echo ":: Start Packaging ::"
echo "--- Start Packaging"
cd auditbeat
umask 0022
mage package
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/auditbeat/scripts/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

source .buildkite/env-scripts/linux-env.sh

echo ":: Running Unit Tests ::"
echo "--- Running Unit Tests"
sudo chmod -R go-w auditbeat/

cd auditbeat
Expand Down
12 changes: 6 additions & 6 deletions .buildkite/env-scripts/linux-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ DEBIAN_FRONTEND="noninteractive"
sudo mkdir -p /etc/needrestart
echo "\$nrconf{restart} = 'a';" | sudo tee -a /etc/needrestart/needrestart.conf > /dev/null

echo ":: PLATFORM TYPE $PLATFORM_TYPE ::"
echo "--- PLATFORM TYPE $PLATFORM_TYPE"

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

echo ":: Ubuntu - Installing libs ::"
echo "--- Ubuntu - Installing libs"
sudo apt-get update
sudo apt-get install -y libsystemd-dev
sudo apt install -y python3-pip
Expand All @@ -25,7 +25,7 @@ if [[ $PLATFORM_TYPE == "Linux" ]]; then

# Remove this code once beats specific agent is set up
if grep -q 'Red Hat' /etc/*release; then
echo ":: RHL - Installing libs ::"
echo "--- RHL - Installing libs"
sudo yum update -y
sudo yum install -y systemd-devel
sudo yum install -y python3-pip
Expand All @@ -35,13 +35,13 @@ if [[ $PLATFORM_TYPE == "Linux" ]]; then
fi

if [[ $PLATFORM_TYPE == Darwin* ]]; then
echo ":: Setting larger ulimit on MacOS ::"
echo "--- Setting larger ulimit on MacOS"
# To bypass file descriptor errors like "Too many open files error" on MacOS
ulimit -Sn 50000
echo ":: ULIMIT :: $(ulimit -n)"
echo "--- ULIMIT: $(ulimit -n)"
fi

echo ":: Setting up environment ::"
echo "--- Setting up environment"
add_bin_path
with_go
with_mage
4 changes: 4 additions & 0 deletions .buildkite/env-scripts/win-env.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/usr/bin/env bash

install_python_win() {
echo "PLATFORM TYPE: ${PLATFORM_TYPE}"
if [[ ${PLATFORM_TYPE} = MINGW* ]]; then
echo "Installing Python on Win"
choco install mingw -y
choco install python --version=3.11.0 -y
fi
}

install_python_win
2 changes: 1 addition & 1 deletion .buildkite/filebeat/scripts/integration-gotests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

source .buildkite/env-scripts/linux-env.sh

echo ":: Execute Integration Tests ::"
echo "--- Executing Integration Tests"
sudo chmod -R go-w filebeat/

cd filebeat
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/filebeat/scripts/integration-pytests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

source .buildkite/env-scripts/linux-env.sh

echo ":: Execute Integration Tests ::"
echo "--- Executing Integration Tests"
sudo chmod -R go-w filebeat/

cd filebeat
Expand Down
4 changes: 1 addition & 3 deletions .buildkite/filebeat/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ set -euo pipefail

source .buildkite/env-scripts/linux-env.sh

echo ":: Evaluate Filebeat Changes ::"

echo ":: Start Packaging ::"
echo "--- Start Packaging"
cd filebeat
umask 0022
mage package
2 changes: 1 addition & 1 deletion .buildkite/filebeat/scripts/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -euo pipefail

source .buildkite/env-scripts/linux-env.sh

echo ":: Execute Unit Tests ::"
echo "--- Executing Unit Tests"
sudo chmod -R go-w filebeat/

umask 0022
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/pull-requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
"set_commit_status": true,
"build_on_commit": true,
"build_on_comment": true,
"trigger_comment_regex": "^/test auditbeat$",
"always_trigger_comment_regex": "^/test auditbeat$",
"trigger_comment_regex": "^/test auditbeat(for (arm|macos|windows|extended support))?$",
"always_trigger_comment_regex": "^/test auditbeat(for (arm|macos|windows|extended support))?$",
"skip_ci_labels": [ ],
"skip_target_branches": [ ],
"skip_ci_on_only_changed": [ ],
Expand Down
4 changes: 0 additions & 4 deletions auditbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ package main

import (
"fmt"
"log"
"os"
"time"

"github.com/magefile/mage/mg"
Expand Down Expand Up @@ -97,8 +95,6 @@ func Package() {
start := time.Now()
defer func() { fmt.Println("package ran for", time.Since(start)) }()

log.SetOutput(os.Stdout)

devtools.UseElasticBeatOSSPackaging()
devtools.PackageKibanaDashboardsFromBuildDir()
auditbeat.CustomizePackaging(auditbeat.OSSPackaging)
Expand Down

0 comments on commit c8ef8ce

Please sign in to comment.