-
Couldn't load subscription status.
- Fork 128
[Buildkite] Add pipeline to test with Elastic serverless daily #1807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0df4f27
Add pipeline to test with serverless daily
mrodm 96cbd80
Fix errors
mrodm 54a8f12
Update labels
mrodm e2b9e9a
Move traps to pre-exit hook
mrodm 1fa152e
Fix unbound variable
mrodm 5586dad
Restore main pipeline
mrodm 1c4eaa9
Update label for each package
mrodm e2db838
Move just clean up files
mrodm e61efc9
Add comment in pull request
mrodm 799fa18
Add gh cli version
mrodm fe01122
Add gh cli version as env
mrodm 1e7458e
Add missing env. var
mrodm 6469336
Remove debug changes
mrodm 0abd723
Add email failure notification just for non pull requests builds
mrodm 28462ec
Add documentation about this new pipeline
mrodm 4a0f705
Move code
mrodm 4dd82be
Add comment about skipping some elastic-package commands
mrodm 1d2bde4
Remove unit tests step
mrodm 311164f
Remvoe check-static step
mrodm a05e4a9
Rephrased comment
mrodm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 @@ | ||
| env: | ||
| NOTIFY_TO: "ecosystem-team@elastic.co" | ||
| SETUP_GVM_VERSION: 'v0.5.2' # https://github.com/andrewkroh/gvm/issues/44#issuecomment-1013231151 | ||
| DOCKER_COMPOSE_VERSION: "v2.24.1" | ||
| DOCKER_VERSION: "26.1.0" | ||
| KIND_VERSION: 'v0.20.0' | ||
| K8S_VERSION: 'v1.29.0' | ||
| LINUX_AGENT_IMAGE: "golang:${GO_VERSION}" | ||
| GH_CLI_VERSION: "2.29.0" | ||
| # Elastic package settings | ||
| # Manage docker output/logs | ||
| ELASTIC_PACKAGE_COMPOSE_DISABLE_VERBOSE_OUTPUT: "true" | ||
| # Default license to use by `elastic-package build` | ||
| ELASTIC_PACKAGE_REPOSITORY_LICENSE: "licenses/Elastic-2.0.txt" | ||
| # Link definitions path (full path to be set in the corresponding step) | ||
| ELASTIC_PACKAGE_LINKS_FILE_PATH: "links_table.yml" | ||
| # Disable comparison of results in pipeline tests to avoid errors related to GeoIP fields | ||
| ELASTIC_PACKAGE_SERVERLESS_PIPELINE_TEST_DISABLE_COMPARE_RESULTS: "true" | ||
|
|
||
| steps: | ||
| - input: "Input values for the variables" | ||
| key: "input-variables" | ||
| fields: | ||
| - select: "SERVERLESS_PROJECT" | ||
| key: "SERVERLESS_PROJECT" | ||
| options: | ||
| - label: "observability" | ||
| value: "observability" | ||
| - label: "security" | ||
| value: "security" | ||
| default: "observability" | ||
| if: "build.source == 'ui'" | ||
|
|
||
| - wait: ~ | ||
| if: "build.source == 'ui'" | ||
| allow_dependency_failure: false | ||
|
|
||
| - label: ":elastic: Serverless Integration tests" | ||
| key: test-serverless | ||
| command: ".buildkite/scripts/test_packages_with_serverless.sh" | ||
| env: | ||
| SERVERLESS_PROJECT: "${SERVERLESS_PROJECT:-observability}" | ||
| UPLOAD_SAFE_LOGS: 1 | ||
| artifact_paths: | ||
| - build/test-results/*.xml | ||
| - build/test-coverage/coverage-*.xml | ||
|
|
||
| - wait: ~ | ||
| continue_on_failure: true | ||
|
|
||
| - label: ":junit: Junit annotate" | ||
| plugins: | ||
| - junit-annotate#v2.4.1: | ||
| artifacts: "build/test-results/*.xml" | ||
| agents: | ||
| provider: "gcp" # junit plugin requires docker | ||
|
|
||
| notify: | ||
| - email: "$NOTIFY_TO" | ||
| if: "build.state == 'failed' && build.env('BUILDKITE_PULL_REQUEST') == 'false'" |
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -5,10 +5,7 @@ source .buildkite/scripts/tooling.sh | |
|
|
||
| set -euo pipefail | ||
|
|
||
| WORKSPACE="$(pwd)" | ||
| TMP_FOLDER_TEMPLATE_BASE="tmp.elastic-package" | ||
|
|
||
| cleanup() { | ||
| ensure_logout() { | ||
| local error_code=$? | ||
|
|
||
| if [ $error_code != 0 ] ; then | ||
|
|
@@ -18,14 +15,9 @@ cleanup() { | |
| fi | ||
| fi | ||
|
|
||
| echo "Deleting temporal files..." | ||
| cd "${WORKSPACE}" | ||
| rm -rf "${TMP_FOLDER_TEMPLATE_BASE}.*" | ||
| echo "Done." | ||
|
|
||
| exit $error_code | ||
| } | ||
| trap cleanup EXIT | ||
| trap ensure_logout EXIT | ||
|
|
||
| usage() { | ||
| echo "$0 [-t <target>] [-h]" | ||
|
|
@@ -39,22 +31,25 @@ PARALLEL_TARGET="test-check-packages-parallel" | |
| FALSE_POSITIVES_TARGET="test-check-packages-false-positives" | ||
| KIND_TARGET="test-check-packages-with-kind" | ||
| SYSTEM_TEST_FLAGS_TARGET="test-system-test-flags" | ||
| TMP_FOLDER_TEMPLATE="${TMP_FOLDER_TEMPLATE_BASE}.XXXXXXXXX" | ||
| GOOGLE_CREDENTIALS_FILENAME="google-cloud-credentials.json" | ||
| ELASTIC_PACKAGE_TEST_ENABLE_INDEPENDENT_AGENT=${ELASTIC_PACKAGE_TEST_ENABLE_INDEPENDENT_AGENT:-"false"} | ||
|
|
||
| REPO_NAME=$(repo_name "${BUILDKITE_REPO}") | ||
| REPO_BUILD_TAG="${REPO_NAME}/$(buildkite_pr_branch_build_id)" | ||
| export REPO_BUILD_TAG="${REPO_NAME}/$(buildkite_pr_branch_build_id)" | ||
| TARGET="" | ||
| PACKAGE="" | ||
| while getopts ":t:p:h" o; do | ||
| SERVERLESS="false" | ||
| while getopts ":t:p:sh" o; do | ||
| case "${o}" in | ||
| t) | ||
| TARGET=${OPTARG} | ||
| ;; | ||
| p) | ||
| PACKAGE=${OPTARG} | ||
| ;; | ||
| s) | ||
| SERVERLESS="true" | ||
| ;; | ||
| h) | ||
| usage | ||
| exit 0 | ||
|
|
@@ -78,57 +73,37 @@ if [[ "${TARGET}" == "" ]]; then | |
| exit 1 | ||
| fi | ||
|
|
||
| google_cloud_auth_safe_logs() { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved these functions to |
||
| local gsUtilLocation="" | ||
| gsUtilLocation=$(mktemp -d -p "${WORKSPACE}" -t "${TMP_FOLDER_TEMPLATE}") | ||
|
|
||
| local secretFileLocation=${gsUtilLocation}/${GOOGLE_CREDENTIALS_FILENAME} | ||
|
|
||
| echo "${PRIVATE_CI_GCS_CREDENTIALS_SECRET}" > "${secretFileLocation}" | ||
|
|
||
| google_cloud_auth "${secretFileLocation}" | ||
| } | ||
|
|
||
| upload_safe_logs() { | ||
| local bucket="$1" | ||
| local source="$2" | ||
| local target="$3" | ||
|
|
||
| if ! ls ${source} 2>&1 > /dev/null ; then | ||
| echo "upload_safe_logs: artifacts files not found, nothing will be archived" | ||
| return | ||
| fi | ||
|
|
||
| google_cloud_auth_safe_logs | ||
|
|
||
| gsutil cp ${source} "gs://${bucket}/buildkite/${REPO_BUILD_TAG}/${target}" | ||
|
|
||
| google_cloud_logout_active_account | ||
| } | ||
|
|
||
| add_bin_path | ||
|
|
||
| echo "--- install go" | ||
| with_go | ||
| if [[ "$SERVERLESS" == "false" ]]; then | ||
| # If packages are tested with Serverless, these action are already performed | ||
| # here: .buildkite/scripts/test_packages_with_serverless.sh | ||
| echo "--- install go" | ||
| with_go | ||
|
|
||
| echo "--- install docker" | ||
| with_docker | ||
| echo "--- install docker" | ||
| with_docker | ||
|
|
||
| echo "--- install docker-compose plugin" | ||
| with_docker_compose_plugin | ||
| echo "--- install docker-compose plugin" | ||
| with_docker_compose_plugin | ||
| fi | ||
|
|
||
| if [[ "${TARGET}" == "${KIND_TARGET}" || "${TARGET}" == "${SYSTEM_TEST_FLAGS_TARGET}" ]]; then | ||
| echo "--- install kubectl & kind" | ||
| with_kubernetes | ||
| fi | ||
|
|
||
| echo "--- Run integration test ${TARGET}" | ||
| label="${TARGET}" | ||
| if [ -n "${PACKAGE}" ]; then | ||
| label="${label} - ${PACKAGE}" | ||
| fi | ||
| echo "--- Run integration test ${label}" | ||
| if [[ "${TARGET}" == "${PARALLEL_TARGET}" ]] || [[ "${TARGET}" == "${FALSE_POSITIVES_TARGET}" ]]; then | ||
| make install | ||
|
|
||
| # allow to fail this command, to be able to upload safe logs | ||
| set +e | ||
| make PACKAGE_UNDER_TEST="${PACKAGE}" "${TARGET}" | ||
| make SERVERLESS="${SERVERLESS}" PACKAGE_UNDER_TEST="${PACKAGE}" "${TARGET}" | ||
| testReturnCode=$? | ||
| set -e | ||
|
|
||
|
|
@@ -162,7 +137,7 @@ if [[ "${TARGET}" == "${PARALLEL_TARGET}" ]] || [[ "${TARGET}" == "${FALSE_POSIT | |
| fi | ||
|
|
||
| if [ $testReturnCode != 0 ]; then | ||
| echo "make PACKAGE_UDER_TEST=${PACKAGE} ${TARGET} failed with ${testReturnCode}" | ||
| echo "make SERVERLESS=${SERVERLESS} PACKAGE_UNDER_TEST=${PACKAGE} ${TARGET} failed with ${testReturnCode}" | ||
| exit ${testReturnCode} | ||
| fi | ||
|
|
||
|
|
||
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow to trigger this pipeline on demand by adding a comment in the Pull Request.