Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

feat: run E2E tests for Fleet Server #1628

Merged
merged 7 commits into from
Oct 1, 2021

Conversation

mdelapenya
Copy link
Contributor

What does this PR do?

This PR adds a regular pipeline listening for Fleet Server repository's webhook, extracting from that payload the information to build the code.

It will detect a GH comment with /run-fleet-e2e-tests, triggering a build right after the comment is submitted. Besides that, it's possible to manually run this job using the PR ID as input parameter.

Once the FS PR is extracted it:

  • fetches Fleet Server code for that PR, building the binaries, copying the binaries to the AGENT_DROP_PATH, a special folder used to build the agent with anything on it.
  • in parallel with the above, fetches Beats repo and builds Elastic Agent's dependencies (building the agent, basically). It will copy Heartbeat, Filebeat and Metricbeat binaries from x-pack dirs to the AGENT_DROP_PATH.
  • after the above parallel branch, we build the agent again, passing the path to the AGENT_DROP_PATH, which will build the agent including Fleet Server code.

Finally we are running all E2E tests using a shell script (no parallel execution)

Why is it important?

We want to run E2E tests for Fleet Server PRs (shift left)

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have run the Unit tests (make unit-test), and they are passing locally
  • I have run the End-2-End tests for the suite I'm working on, and they are passing locally
  • I have noticed new Go dependencies (run make notice in the proper directory)

Author's Checklist

  • [ ]

Related issues

@mdelapenya mdelapenya self-assigned this Oct 1, 2021
@mdelapenya mdelapenya requested a review from a team October 1, 2021 06:31
@elasticmachine
Copy link
Contributor

elasticmachine commented Oct 1, 2021

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-10-01T11:35:57.808+0000

  • Duration: 27 min 9 sec

  • Commit: 6a78476

Test stats 🧪

Test Results
Failed 0
Passed 233
Skipped 0
Total 233

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

Copy link
Contributor

@cachedout cachedout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏆 Nice one

.ci/e2eFleetServer.groovy Outdated Show resolved Hide resolved
.ci/e2eFleetServer.groovy Outdated Show resolved Hide resolved
@mdelapenya mdelapenya marked this pull request as ready for review October 1, 2021 11:37
dir("${E2E_BASE_DIR}") {
withGoEnv(){
withEnv(["BEATS_LOCAL_PATH='${env.BEATS_BASE_DIR}"]) {
sh(label: 'Run E2E Tests', script: './.ci/scripts/fleet-tests.sh ')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should trigger here a build in the right branch for the e2e project, instead of running all tests in serie, but we would need a way to pass the generated binaries to the downstream job. But how?

The most feasible manner that I can think of is uploading the binaries to a GCP bucket, then we might need a new namespaced dir for fleet-server binaries, finally adapting the code to calculate the download path in consequence (we currently rely on Beats repo's SHA1 to get the bucket path). cc/ @elastic/observablt-robots

@mdelapenya mdelapenya merged commit f935fb6 into elastic:master Oct 1, 2021
@mdelapenya mdelapenya deleted the build-fleet-server branch October 1, 2021 13:30
@mdelapenya mdelapenya mentioned this pull request Oct 18, 2021
8 tasks
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Feb 28, 2022
* chore: define variable for BeatsLocalPath

* fix: update path initialisation in unit tests

* chore: pass inline env vars to commands

Co-authored-by: Victor Martinez <[email protected]>

Co-authored-by: Victor Martinez <[email protected]>
@mdelapenya mdelapenya mentioned this pull request Feb 28, 2022
8 tasks
mdelapenya added a commit that referenced this pull request Feb 28, 2022
* ci: use withAPMEnv (#1917)

* feat: partial backport for (#1628)

* chore: define variable for BeatsLocalPath

* fix: update path initialisation in unit tests

* chore: pass inline env vars to commands

Co-authored-by: Victor Martinez <[email protected]>

Co-authored-by: Victor Martinez <[email protected]>

* feat: export Fetch&Download methods in the /pkg directory (#1943)

* chore: copy internal's version files into the exported pkg public package

* chore: run unit tests from top-level goal

* chore: use public package instead of the internal one

* chore: remove old internal files for habdling downloads

* fix: update missing references

* Update `fetchBeatsBinary` to be reused in elastic-agent-poc (#1984)

* update func

* fix path

* work on download

* small fix

* remove test

* add sha to google

* fix typo

* add comment

* ci: increase log rotation (#2138)

* chore: increase build timeout to 90 minutes (#2139)

* feat: support downloading project artifacts for the new bucket layout (#2172)

* feat: support for the new bucket structure

* feat: calculate bucket URLs using resolvers

* chore: support for legacy Beats

Old PRs needs to be tested and the binaries could not exist in the new layout

* chore: support looking up the bucket in up-to 3 locations

1. new project layout
2. new beats layout
3. legacy beats layout

* chore: simplify boolean logic

* fix: pass worker environment for versions to the VMs

* fix: predefine kibana version

* fix: remove extra char

* fix: remove extra char

* chore: log resolvers

* chore: use new project method when fetching artifacts

* fix: pass stack version to stack deployment

* fix: use artifact to check for ubi8 variant

* chore: improve logs in resolvers

* fix: apply variants to project resolver

Ubi8 is a valid variant for elastic-agent

* chore: use Stack version for the dependant beats

In the running-on-top-of-beats feature file, the code installs some Beats
and we do not want to use the given SHA, because elastic-agent now lives
in a separate repo, therefore they do not share commit SHAs

* fix: use fleet-ci bucket for elastic-agent and fleet-server

* chore: look up both CI buckets

* chore: make useCISnapshots configurable on downloads

* chore: background processes should not use CI snapshots

* feat: separate elastic-agent version from beats version

* chore: extract useCISnapshots to a function

* chore: use Github_Check_Repo to identify where the Git commit lives

* fix: k8s-autodiscover lives in both worlds

* fix: missing package

* fix: use snapshot version in k8s-autodiscover

* fix: missing import

Co-authored-by: Victor Martinez <[email protected]>
Co-authored-by: Mariana Dima <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants