-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote upstream/main into add_validation_object_type_metric_type
- Loading branch information
Showing
133 changed files
with
3,065 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
checkout_merge() { | ||
local target_branch=$1 | ||
local pr_commit=$2 | ||
local merge_branch=$3 | ||
|
||
if [[ -z "${target_branch}" ]]; then | ||
echo "No pull request target branch" | ||
exit 1 | ||
fi | ||
|
||
git fetch -v origin "${target_branch}" | ||
git checkout FETCH_HEAD | ||
echo "Current branch: $(git rev-parse --abbrev-ref HEAD)" | ||
|
||
# create temporal branch to merge the PR with the target branch | ||
git checkout -b ${merge_branch} | ||
echo "New branch created: $(git rev-parse --abbrev-ref HEAD)" | ||
|
||
# set author identity so it can be run git merge | ||
git config user.name "github-merged-pr-post-checkout" | ||
git config user.email "auto-merge@buildkite" | ||
|
||
git merge --no-edit "${BUILDKITE_COMMIT}" || { | ||
local merge_result=$? | ||
echo "Merge failed: ${merge_result}" | ||
git merge --abort | ||
exit ${merge_result} | ||
} | ||
} | ||
|
||
export GO_VERSION="$(< .go-version)" | ||
pull_request="${BUILDKITE_PULL_REQUEST:-false}" | ||
|
||
if [[ "${pull_request}" == "false" ]]; then | ||
echo "Not a pull request, skipping" | ||
exit 0 | ||
fi | ||
|
||
TARGET_BRANCH="${BUILDKITE_PULL_REQUEST_BASE_BRANCH:-master}" | ||
PR_COMMIT="${BUILDKITE_COMMIT}" | ||
PR_ID=${BUILDKITE_PULL_REQUEST} | ||
MERGE_BRANCH="pr_merge_${PR_ID}" | ||
|
||
checkout_merge "${TARGET_BRANCH}" "${PR_COMMIT}" "${MERGE_BRANCH}" | ||
|
||
echo "Commit information" | ||
git log --format=%B -n 1 | ||
|
||
# Ensure buildkite groups are rendered | ||
echo "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
source .buildkite/scripts/tooling.sh | ||
|
||
GITHUB_TOKEN_VAULT_PATH=kv/ci-shared/platform-ingest/github_token | ||
|
||
# Secrets must be redacted | ||
# https://buildkite.com/docs/pipelines/managing-log-output#redacted-environment-variables | ||
|
||
if [[ "$BUILDKITE_PIPELINE_SLUG" == "package-spec-test-with-integrations" && "$BUILDKITE_STEP_KEY" == "pr-integrations" ]]; then | ||
export GITHUB_USERNAME_SECRET=$(retry 5 vault kv get -field username ${GITHUB_TOKEN_VAULT_PATH}) | ||
export GITHUB_EMAIL_SECRET=$(retry 5 vault kv get -field email ${GITHUB_TOKEN_VAULT_PATH}) | ||
export GITHUB_TOKEN=$(retry 5 vault kv get -field token ${GITHUB_TOKEN_VAULT_PATH}) | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
env: | ||
SETUP_GVM_VERSION: 'v0.5.0' # https://github.com/andrewkroh/gvm/issues/44#issuecomment-1013231151 | ||
GOLANG_VERSION: "1.20.3" | ||
GH_CLI_VERSION: "2.29.0" | ||
JQ_VERSION: "1.6" | ||
|
||
steps: | ||
- label: ":go: Run check-static" | ||
key: check | ||
command: "make check" | ||
agents: | ||
image: "golang:${GOLANG_VERSION}" | ||
cpu: "8" | ||
memory: "4G" | ||
- label: ":linux: Tests on Linux" | ||
key: test | ||
command: "make test-ci" | ||
agents: | ||
image: "golang:${GOLANG_VERSION}" | ||
cpu: "8" | ||
memory: "4G" | ||
|
||
- label: ":hammer: Create PR in integrations" | ||
key: pr-integrations | ||
command: ".buildkite/scripts/test-with-integrations.sh" | ||
agents: | ||
provider: "gcp" | ||
depends_on: | ||
- check | ||
- test | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# yaml-language-server: $schema=https://github.com/buildkite/pipeline-schema/main/schema.json | ||
|
||
env: | ||
SETUP_GVM_VERSION: 'v0.5.0' # https://github.com/andrewkroh/gvm/issues/44#issuecomment-1013231151 | ||
SETUP_MAGE_VERSION: "latest" | ||
GO_VERSION: "1.20.3" | ||
GO_LINUX_AGENT_IMAGE: "golang:${GO_VERSION}" | ||
GO_WINDOWS_AGENT_IMAGE: "family/ci-windows-2022" | ||
|
||
steps: | ||
- label: ":go: Run check-static" | ||
key: check | ||
command: "make check" | ||
agents: | ||
image: "${GO_LINUX_AGENT_IMAGE}" | ||
cpu: "8" | ||
memory: "4G" | ||
|
||
- group: "Run tests" | ||
key: "tests" | ||
steps: | ||
- label: ":linux: Tests on Linux" | ||
key: linux-test | ||
command: ".buildkite/scripts/run-linux-tests.sh" | ||
agents: | ||
image: "${GO_LINUX_AGENT_IMAGE}" | ||
cpu: "8" | ||
memory: "4G" | ||
artifact_paths: | ||
- build/test-results/*.xml | ||
|
||
- label: ":windows: Tests on Windows" | ||
key: windows-test | ||
command: ".buildkite/scripts/run-win-tests.ps1" | ||
agents: | ||
provider: "gcp" | ||
image: "${GO_WINDOWS_AGENT_IMAGE}" | ||
artifact_paths: | ||
- "*.xml" | ||
|
||
- label: ":junit: Junit annotate" | ||
plugins: | ||
- junit-annotate#v2.4.1: | ||
artifacts: "*.xml" | ||
fail-build-on-error: true | ||
agents: | ||
provider: "gcp" | ||
depends_on: | ||
- step: "linux-test" | ||
allow_failure: true | ||
- step: "windows-test" | ||
allow_failure: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"jobs": [ | ||
{ | ||
"enabled": true, | ||
"pipelineSlug": "package-spec-test-with-integrations", | ||
"allow_org_users": true, | ||
"allowed_repo_permissions": ["admin", "write"], | ||
"allowed_list": [ ], | ||
"set_commit_status": false, | ||
"build_on_commit": false, | ||
"build_on_comment": true, | ||
"trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:test)\\W+(?:integrations))$", | ||
"always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:test)\\W+(?:integrations))$", | ||
"skip_ci_labels": [ ], | ||
"skip_target_branches": [ ], | ||
"skip_ci_on_only_changed": [ ], | ||
"always_require_ci_on_changed": [ ] | ||
}, | ||
{ | ||
"enabled": true, | ||
"pipelineSlug": "package-spec", | ||
"allow_org_users": true, | ||
"allowed_repo_permissions": ["admin", "write"], | ||
"allowed_list": [ ], | ||
"set_commit_status": true, | ||
"build_on_commit": true, | ||
"build_on_comment": true, | ||
"trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))|^/test$", | ||
"always_trigger_comment_regex": "^(?:(?:buildkite\\W+)?(?:build|test)\\W+(?:this|it))|^/test$", | ||
"skip_ci_labels": [ ], | ||
"skip_target_branches": [ ], | ||
"skip_ci_on_only_changed": [ ], | ||
"always_require_ci_on_changed": [ ] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
source .buildkite/scripts/tooling.sh | ||
|
||
add_bin_path(){ | ||
mkdir -p ${WORKSPACE}/bin | ||
export PATH="${WORKSPACE}/bin:${PATH}" | ||
} | ||
|
||
with_go() { | ||
mkdir -p ${WORKSPACE}/bin | ||
retry 5 curl -sL -o ${WORKSPACE}/bin/gvm "https://github.com/andrewkroh/gvm/releases/download/${SETUP_GVM_VERSION}/gvm-linux-amd64" | ||
chmod +x ${WORKSPACE}/bin/gvm | ||
eval "$(gvm $(cat .go-version))" | ||
go version | ||
which go | ||
export PATH="$(go env GOPATH)/bin:${PATH}" | ||
} | ||
|
||
with_github_cli() { | ||
mkdir -p ${WORKSPACE}/bin | ||
mkdir -p ${WORKSPACE}/tmp | ||
|
||
local gh_filename="gh_${GH_CLI_VERSION}_linux_amd64" | ||
local gh_tar_file="${gh_filename}.tar.gz" | ||
local gh_tar_full_path="${WORKSPACE}/tmp/${gh_tar_file}" | ||
|
||
retry 5 curl -sL -o ${gh_tar_full_path} "https://github.com/cli/cli/releases/download/v${GH_CLI_VERSION}/${gh_tar_file}" | ||
|
||
# just extract the binary file from the tar.gz | ||
tar -C ${WORKSPACE}/bin -xpf ${gh_tar_full_path} ${gh_filename}/bin/gh --strip-components=2 | ||
|
||
chmod +x ${WORKSPACE}/bin/gh | ||
rm -rf ${WORKSPACE}/tmp | ||
|
||
gh version | ||
} | ||
|
||
with_jq() { | ||
mkdir -p ${WORKSPACE}/bin | ||
retry 5 curl -sL -o ${WORKSPACE}/bin/jq "https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64" | ||
|
||
chmod +x ${WORKSPACE}/bin/jq | ||
jq --version | ||
} | ||
|
||
install_go_dependencies() { | ||
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" | ||
) | ||
for pkg in "${install_packages[@]}"; do | ||
go install "${pkg}@latest" | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
source .buildkite/scripts/install_deps.sh | ||
|
||
install_go_dependencies | ||
|
||
make test-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
$ErrorActionPreference = "Stop" # set -e | ||
# Forcing to checkout again all the files with a correct autocrlf. | ||
# Doing this here because we cannot set git clone options before. | ||
function fixCRLF { | ||
Write-Host "-- Fixing CRLF in git checkout --" | ||
git config core.autocrlf input | ||
git rm --quiet --cached -r . | ||
git reset --quiet --hard | ||
} | ||
function withGolang($version) { | ||
Write-Host "-- Install golang --" | ||
choco install -y golang --version $version | ||
$env:ChocolateyInstall = Convert-Path "$((Get-Command choco).Path)\..\.." | ||
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" | ||
refreshenv | ||
go version | ||
go env | ||
} | ||
function installGoDependencies { | ||
$installPackages = @( | ||
"github.com/magefile/mage" | ||
"github.com/elastic/go-licenser" | ||
"golang.org/x/tools/cmd/goimports" | ||
"github.com/jstemmer/go-junit-report/v2" | ||
"gotest.tools/gotestsum" | ||
) | ||
foreach ($pkg in $installPackages) { | ||
go install "$pkg@latest" | ||
} | ||
} | ||
|
||
fixCRLF | ||
withGolang $env:GO_VERSION | ||
installGoDependencies | ||
|
||
$ErrorActionPreference = "Continue" # set +e | ||
|
||
gotestsum --format testname --junitfile junit-win-report.xml -- -v ./code/go/... | ||
|
||
$EXITCODE=$LASTEXITCODE | ||
$ErrorActionPreference = "Stop" | ||
|
||
Exit $EXITCODE |
Oops, something went wrong.