Skip to content

Commit

Permalink
Merge branch 'main' into fix-bottom-bar-serverless
Browse files Browse the repository at this point in the history
  • Loading branch information
jlind23 authored Oct 2, 2023
2 parents 316a3c0 + 3bff7fb commit 11a0e2b
Show file tree
Hide file tree
Showing 1,859 changed files with 135,773 additions and 16,175 deletions.
92 changes: 49 additions & 43 deletions .buildkite/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .buildkite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@types/minimatch": "^3.0.5",
"@types/mocha": "^10.0.1",
"@types/node": "^15.12.2",
"chai": "^4.3.6",
"chai": "^4.3.10",
"mocha": "^10.2.0",
"nock": "^12.0.2",
"ts-node": "^10.7.0",
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipelines/code_coverage/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ steps:
label: 'Pick Test Group Run Order'
agents:
queue: kibana-default
timeout_in_minutes: 10
env:
FTR_CONFIGS_DEPS: ''
LIMIT_CONFIG_TYPE: 'unit,integration'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ steps:
command: .buildkite/scripts/steps/test/pick_test_group_run_order.sh
agents:
queue: kibana-default
timeout_in_minutes: 10
env:
FTR_CONFIGS_SCRIPT: 'TEST_ES_SERVERLESS_IMAGE=$ES_SERVERLESS_IMAGE .buildkite/scripts/steps/test/ftr_configs.sh'
FTR_CONFIG_PATTERNS: '**/test_serverless/**'
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipelines/es_snapshots/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ steps:
label: 'Pick Test Group Run Order'
agents:
queue: kibana-default
timeout_in_minutes: 10
env:
JEST_UNIT_SCRIPT: '.buildkite/scripts/steps/test/jest.sh'
JEST_INTEGRATION_SCRIPT: '.buildkite/scripts/steps/test/jest_integration.sh'
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipelines/on_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ steps:
label: 'Pick Test Group Run Order'
agents:
queue: kibana-default
timeout_in_minutes: 10
env:
JEST_UNIT_SCRIPT: '.buildkite/scripts/steps/test/jest.sh'
JEST_INTEGRATION_SCRIPT: '.buildkite/scripts/steps/test/jest_integration.sh'
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipelines/pull_request/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ steps:
label: 'Pick Test Group Run Order'
agents:
queue: kibana-default
timeout_in_minutes: 10
env:
JEST_UNIT_SCRIPT: '.buildkite/scripts/steps/test/jest.sh'
JEST_INTEGRATION_SCRIPT: '.buildkite/scripts/steps/test/jest_integration.sh'
Expand Down
6 changes: 3 additions & 3 deletions .buildkite/pipelines/pull_request/security_solution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ steps:
agents:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
parallelism: 6
timeout_in_minutes: 60
parallelism: 8
retry:
automatic:
- exit_status: '*'
Expand All @@ -40,7 +40,7 @@ steps:
agents:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
timeout_in_minutes: 60
parallelism: 1
retry:
automatic: false
Expand Down
104 changes: 76 additions & 28 deletions .buildkite/scripts/steps/check_types_commits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,92 @@

set -euo pipefail

# This script will collect typescript projects and run typecheck on projects between the given 2 parameters
# Could be used for selective typechecking on projects that might be affected for a given PR.
# This script detects the files changed in a given set of commits, finds the related tsconfig.json files, and scope the TypeScript type check to those.
# In CI, this script can be used for selective type-checking on projects that might be affected for a given PR.
# (The accuracy for finding related projects is not a 100%)

if [[ "${CI-}" == "true" ]]; then
.buildkite/scripts/bootstrap.sh
argv=( "$@" )
diffArgs=("--name-only")
uniq_dirs=()
uniq_tsconfigs=()

sha1=$(git merge-base $GITHUB_PR_TARGET_BRANCH $GITHUB_PR_TRIGGERED_SHA)
sha2="${GITHUB_PR_TRIGGERED_SHA-}"
else
if [[ "${1-}" == "--cached" ]]; then
# Only check staged files
sha1=$1
sha2=""
is_flag_set () {
flag=$1
if [ ${#argv[@]} -gt 0 ] && [[ ${argv[@]} =~ $flag ]]; then
true
else
# Script take between 0 and 2 arguments representing two commit SHA's:
# If 0, it will diff HEAD and HEAD^
# If 1 (SHA1), it will diff SHA1 and SHA1^
# If 2 (SHA1, SHA2), it will diff SHA1 and SHA2
sha1="${1-HEAD}"
sha2="${2-$sha1^}"
false
fi
}

get_args_for_flag_result=()
get_args_for_flag () {
flag=$1
found=false
get_args_for_flag_result=()
if [ ${#argv[@]} -gt 0 ]; then
for i in "${!argv[@]}"; do
arg="${argv[$i]}"
if [ "$found" == false ] && [[ "$arg" == "$flag" ]]; then
found=true
elif [ "$found" == true ]; then
if [[ "$arg" == -* ]]; then
return
else
get_args_for_flag_result+=("$arg")
fi
fi
done
fi
}

if is_flag_set "--help" || is_flag_set "-h"; then
echo "Detects the files changed in a given set of commits, finds the related"
echo "tsconfig.json files, and scope the TypeScript type check to those."
echo
echo "Usage:"
echo " $0 [options]"
echo " $0 [<ref1> [<ref2>]]"
echo
echo "Options:"
echo " --help, -h Show this help"
echo " --cached Check staged changes"
echo " --merge-base [<ref1> [<ref2>]]"
echo " Check changes between nearest common ansestor (merge-base) of"
echo " ref1 and ref2. Defaults: 'main' and 'HEAD'"
echo
echo "If no options are provided, the script takes between 0 and 2 arguments"
echo "representing two git refs:"
echo " If 0, it will diff HEAD and HEAD^"
echo " If 1 (REF1), it will diff REF1 and REF1^"
echo " If 2 (REF1, REF2), it will diff REF1 and REF2"
exit
fi

uniq_dirs=()
uniq_tsconfigs=()
if [[ "${CI-}" == "true" ]]; then
# Buildkite only
.buildkite/scripts/bootstrap.sh

if [[ "$sha1" == "--cached" ]]; then
echo "Detecting files changed in staging area..."
targetBranch="${GITHUB_PR_TARGET_BRANCH-}"
git fetch origin $targetBranch
sha=$(git merge-base "origin/$targetBranch" "${GITHUB_PR_TRIGGERED_SHA-}")
diffArgs+=("$sha" "${GITHUB_PR_TRIGGERED_SHA-}")
elif is_flag_set "--merge-base"; then
# Similar to when CI=true, but locally
get_args_for_flag "--merge-base"
diffArgs+=("--merge-base" "${get_args_for_flag_result[0]-main}" "${get_args_for_flag_result[1]-HEAD}")
elif is_flag_set "--cached"; then
# Only check staged files
diffArgs+=("--cached")
else
echo "Detecting files changed between $sha1 and $sha2..."
# Full manual mode!
ref1="${1-HEAD}"
diffArgs+=("$ref1" "${2-$ref1^}")
fi

files=($(git diff --name-only $sha1 $sha2))
echo "Detecting files changed..."
echo "DEBUG: git diff args: ${diffArgs[@]}"
files=($(git diff "${diffArgs[@]}"))

add_dir () {
new_dir=$1
Expand Down Expand Up @@ -117,11 +169,7 @@ if [ ${#uniq_dirs[@]} -gt 0 ]; then
fi

if [ ${#uniq_tsconfigs[@]} -eq 0 ]; then
if [[ "$sha1" == "--cached" ]]; then
echo "No tsconfig.json files found for staged changes"
else
echo "No tsconfig.json files found for changes between $sha1 and $sha2"
fi
echo "No tsconfig.json files found"
exit
fi

Expand Down
Loading

0 comments on commit 11a0e2b

Please sign in to comment.