Skip to content

Commit

Permalink
moved env setup to separate script
Browse files Browse the repository at this point in the history
  • Loading branch information
oakrizan committed Jan 17, 2024
1 parent f3e74b9 commit d1ca7df
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 46 deletions.
38 changes: 20 additions & 18 deletions .buildkite/filebeat/filebeat-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,35 @@ steps:
steps:
- label: ":ubuntu: Unit Tests"
command:
- "sudo apt-get update"
- "sudo apt-get install -y libsystemd-dev"
- "sudo apt install -y python3-pip"
- "sudo apt-get install -y python3-venv"
- ".buildkite/filebeat/scripts/unit-tests.sh"
notify:
- github_commit_status:
context: "Filebeat/Mandatory: Unit Tests"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
artifact_paths:
- "filebeat/build/TEST-go-unit.xml"
- "filebeat/build/TEST-go-unit.out.json"

- label: ":ubuntu: Go Integration Tests"
command:
- "sudo apt-get update"
- "sudo apt-get install -y libsystemd-dev"
- ".buildkite/filebeat/scripts/integration-gotests.sh"
notify:
- github_commit_status:
context: "Filebeat/Mandatory: Integration Tests"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
artifact_paths:
- "filebeat/build/TEST-go-integration.xml"
- "filebeat/build/TEST-go-integration.out.json"

- label: ":ubuntu: Python Integration Tests"
command:
- "sudo apt-get update"
- "sudo apt-get install -y libsystemd-dev"
- "sudo apt-get install -y python3-venv"
# - "sudo apt-get update"
# - "sudo apt-get install -y libsystemd-dev"
# - "sudo apt-get install -y python3-venv"
- ".buildkite/filebeat/scripts/integration-pytests.sh"
notify:
- github_commit_status:
Expand All @@ -70,6 +70,9 @@ steps:
image:
- "${IMAGE_WIN_2016}"
- "${IMAGE_WIN_2022}"
artifact_paths:
- "filebeat/build/TEST-go-unit.xml"
- "filebeat/build/TEST-go-unit.out.json"

- group: "Extended Testing"
key: "extended-tests"
Expand All @@ -80,10 +83,10 @@ steps:
key: "arm-extended"
if: build.env("GITHUB_PR_TRIGGER_COMMENT") == "filebeat for arm" || build.env("GITHUB_PR_LABELS") =~ /.*arm.*/
command:
- "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 apt-get update"
# - "sudo apt-get install -y libsystemd-dev"
# - "sudo apt install -y python3-pip"
# - "sudo apt-get install -y python3-venv"
- ".buildkite/filebeat/scripts/unit-tests.sh"
notify:
- github_commit_status:
Expand All @@ -97,7 +100,6 @@ steps:
key: "macos-extended"
# if: build.env("GITHUB_PR_TRIGGER_COMMENT") == "filebeat for macos" || build.env("GITHUB_PR_LABELS") =~ /.*macOS.*/
command:
# - "ulimit -Sn 10000"
- ".buildkite/filebeat/scripts/unit-tests.sh"
notify:
- github_commit_status:
Expand Down Expand Up @@ -137,8 +139,8 @@ steps:
- label: ":ubuntu: Packaging Linux X86"
key: "package-linux-x86"
command:
- "sudo apt-get update"
- "sudo apt-get install -y python3-venv"
# - "sudo apt-get update"
# - "sudo apt-get install -y python3-venv"
- ".buildkite/filebeat/scripts/package.sh"
notify:
- github_commit_status:
Expand All @@ -153,8 +155,8 @@ steps:
PLATFORMS: "linux/arm64"
PACKAGES: "docker"
command:
- "sudo apt-get update"
- "sudo apt-get install -y python3-venv"
# - "sudo apt-get update"
# - "sudo apt-get install -y python3-venv"
- ".buildkite/filebeat/scripts/package.sh"
notify:
- github_commit_status:
Expand Down
15 changes: 8 additions & 7 deletions .buildkite/filebeat/scripts/integration-gotests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
set -euo pipefail

source .buildkite/filebeat/scripts/common.sh

# ToDo - remove after Beats agent is created"
echo ":: Setup Env ::"
add_bin_path
with_go
with_mage
# ToDo - end
source .buildkite/util-scripts/linux-env.sh
#
## ToDo - remove after Beats agent is created"
#echo ":: Setup Env ::"
#add_bin_path
#with_go
#with_mage
## ToDo - end

echo ":: Execute Integration Tests ::"
sudo chmod -R go-w filebeat/
Expand Down
15 changes: 8 additions & 7 deletions .buildkite/filebeat/scripts/integration-pytests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
set -euo pipefail

source .buildkite/filebeat/scripts/common.sh

# ToDo - remove after Beats agent is created"
echo ":: Setup Env ::"
add_bin_path
with_go
with_mage
# ToDo - end
source .buildkite/util-scripts/linux-env.sh
#
## ToDo - remove after Beats agent is created"
#echo ":: Setup Env ::"
#add_bin_path
#with_go
#with_mage
## ToDo - end

echo ":: Execute Integration Tests ::"
sudo chmod -R go-w filebeat/
Expand Down
13 changes: 7 additions & 6 deletions .buildkite/filebeat/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

source .buildkite/filebeat/scripts/common.sh
source .buildkite/util-scripts/linux-env.sh

echo ":: Evaluate Filebeat Changes ::"

Expand All @@ -22,12 +23,12 @@ if ! are_files_changed "$changeset" ; then
exit 0
fi

# ToDo - remove after Beats agent is created"
echo ":: Setup Env ::"
add_bin_path
with_go
with_mage
# ToDo - end
## ToDo - remove after Beats agent is created"
#echo ":: Setup Env ::"
#add_bin_path
#with_go
#with_mage
## ToDo - end

echo ":: Start Packaging ::"
cd filebeat
Expand Down
11 changes: 4 additions & 7 deletions .buildkite/filebeat/scripts/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

set -euo pipefail

source .buildkite/filebeat/scripts/common.sh
source .buildkite/util-scripts/linux-env.sh

# ToDo - remove after Beats agent is created"
echo ":: Setup Env ::"
add_bin_path
with_go
with_mage
# ToDo - end
if [[ $PLATFORM_TYPE == Darwin* ]]; then
echo ":: ULIMIT :: $(ulimit -n)"
fi

echo ":: Execute Unit Tests ::"
sudo chmod -R go-w filebeat/
Expand Down
7 changes: 6 additions & 1 deletion .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ set -euo pipefail

source .buildkite/filebeat/scripts/common.sh

SETUP_GVM_VERSION="v0.5.1"

export SETUP_GVM_VERSION

if [[ "$BUILDKITE_PIPELINE_SLUG" == "filebeat" ]]; then
export WORKSPACE="$(pwd)"

Expand All @@ -14,6 +18,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "filebeat" ]]; then
fi

if [[ "$BUILDKITE_STEP_KEY" == macos* ]]; then
ulimit -Sn 30000
# To bypass file descriptor errors like "Too many open files error" on MacOS
ulimit -Sn 70000
fi
fi
21 changes: 21 additions & 0 deletions .buildkite/util-scripts/linux-env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

source .buildkite/filebeat/scripts/common.sh

DEBIAN_FRONTEND="noninteractive"

export DEBIAN_FRONTEND

# Remove this code once beats specific agent is set up
if [[ $PLATFORM_TYPE == "Linux" ]]; then
echo ":: 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
fi

echo ":: Setting up environment ::"
add_bin_path
with_go
with_mage

0 comments on commit d1ca7df

Please sign in to comment.