This repository was archived by the owner on Sep 17, 2024. It is now read-only.
feat: support downloading project artifacts for the new bucket layout#2172
Merged
mdelapenya merged 28 commits intoelastic:mainfrom Feb 28, 2022
Merged
feat: support downloading project artifacts for the new bucket layout#2172mdelapenya merged 28 commits intoelastic:mainfrom
mdelapenya merged 28 commits intoelastic:mainfrom
Conversation
Old PRs needs to be tested and the binaries could not exist in the new layout
1. new project layout 2. new beats layout 3. legacy beats layout
v1v
approved these changes
Feb 23, 2022
Contributor
adam-stokes
reviewed
Feb 23, 2022
| // look up the bucket in this particular order: | ||
| // 1. the project layout (elastic-agent, fleet-server) | ||
| // 2. the new beats layout (beats) | ||
| // 3. the legacy Beats layout (commits/snapshots) |
Contributor
Author
|
Need to run it for a commit Sha, will try later on |
mdelapenya
commented
Feb 23, 2022
adam-stokes
reviewed
Feb 23, 2022
Contributor
Author
|
@adam-stokes I think this is ready to merge. Please do a final review 👀 with latest changes 🙏 The 13 errors are related to k8s-autodiscover for a SHA commit: because the last build used a SHA on elastic-agent repo, the binaries used for the k8s feature are not found by any resolver, as the SHA commit does not exist in the Beats repository (and its bucket). In #2175 I explain the need to refactor the layout of the test suites. |
Contributor
Author
Tests for a commit on Beats
Tests for a commit on Elastic Agent
|
adam-stokes
approved these changes
Feb 28, 2022
mdelapenya
commented
Feb 28, 2022
Comment on lines
+105
to
+107
| if strings.EqualFold(r.Variant, "ubi8") { | ||
| artifact = strings.ReplaceAll(artifact, "-ubi8", "") | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Candidate to be extracted, as it's used across all resolvers
mdelapenya
commented
Feb 28, 2022
Comment on lines
+112
to
+115
| ciSnapshotsFn := UseBeatsCISnapshots | ||
| if strings.EqualFold(artifact, "elastic-agent") { | ||
| ciSnapshotsFn = UseElasticAgentCISnapshots | ||
| } |
Contributor
Author
There was a problem hiding this comment.
Candidate to be extracted, as it's used across all resolvers
mergify bot
pushed a commit
that referenced
this pull request
Feb 28, 2022
…#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 (cherry picked from commit 044dedf) # Conflicts: # .ci/Jenkinsfile
mergify bot
pushed a commit
that referenced
this pull request
Feb 28, 2022
…#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 (cherry picked from commit 044dedf) # Conflicts: # .ci/Jenkinsfile
mergify bot
pushed a commit
that referenced
this pull request
Feb 28, 2022
…#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 (cherry picked from commit 044dedf) # Conflicts: # .ci/Jenkinsfile # e2e/_suites/fleet/fleet.go # e2e/_suites/fleet/stand-alone.go # e2e/_suites/kubernetes-autodiscover/autodiscover_test.go # internal/buckets.go # internal/buckets_test.go # internal/deploy/docker.go # internal/installer/elasticagent_deb.go # internal/installer/elasticagent_docker.go # internal/installer/elasticagent_rpm.go # internal/installer/elasticagent_tar.go # internal/installer/elasticagent_tar_macos.go # internal/installer/elasticagent_zip.go # internal/versions.go
mdelapenya
added a commit
that referenced
this pull request
Feb 28, 2022
… the new bucket layout (#2182) * 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 (cherry picked from commit 044dedf) # Conflicts: # .ci/Jenkinsfile * fix: resolve conflicts Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
mdelapenya
added a commit
that referenced
this pull request
Feb 28, 2022
… the new bucket layout (#2181) * 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 (cherry picked from commit 044dedf) # Conflicts: # .ci/Jenkinsfile * fix: resolve conflicts Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
mdelapenya
added a commit
to mdelapenya/e2e-testing
that referenced
this pull request
Feb 28, 2022
…elastic#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
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 <victormartinezrubio@gmail.com> Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com> * 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 <victormartinezrubio@gmail.com> Co-authored-by: Mariana Dima <mariana@elastic.co>
mdelapenya
added a commit
that referenced
this pull request
Mar 17, 2022
* main: (268 commits) bump stack version 8.2.0-ff67d7b8 (#2242) ci: periodic builds for the last two minor versions (#2241) bump stack version 8.2.0-9bac538c (#2240) fix: add end-of-file line in templates (#2237) chore: add Christos to SSH users bump stack version 8.2.0-fee3b8d2 (#2234) Separate ES workload from Agent spec and make it req for the scenarios (#2203) bump stack version 8.2.0-d02c907a (#2228) bump stack version 8.2.0-63265ec9 (#2225) fix: wrong link (#2220) chore: define provider for each test suite (#2213) ci: provision e2-small workers (#2212) bump stack version 8.2.0-a12f7069 (#2209) chore: support for Oracle Linux 8 (#2208) bump stack version 8.2.0-190af159 (#2206) bump stack version 8.2.0-fdde08ec (#2200) bump stack version 8.2.0-43df679f (#2193) chore: use trace level in logs (#2130) bump stack version 8.2.0-bdf2ad74 (#2188) feat: support downloading project artifacts for the new bucket layout (#2172) ...
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
What does this PR do?
It exposes a new method:
FetchProjectBinaryso that the existingFetchBeatsBinarycalls the new one with the required arguments.This method will use the new bucket layout:
And it will look up the artifacts in the three possible locations:
beatsparent dir)This PR is decoupling the bucket resolution into the concept of URL Resolvers, so that the logic is narrowed to the scope of that struct. We are building three resolvers, one for each layout. We have refactored the existing code that calculated the bucket URL using the new resolvers abstraction, checking that the existing unit tests covered the changes. Finally, we moved those tests to the right Go file, so that it's easier to maintain them.
It's important to mention that we did not change the API contracts in the pkg package: we are aware of they are consumed (by elastic-agent i.e.) and we are keeping old functionality using defaults. The framework is using new methods that support the new expected behaviors:
Apart from that, we realised that the VM support did not migrate the ability to consume a Git SHA from Beats. In this PR we are adding back that support, simply passing the env vars defined at the Jenkinsfile to the Ansible playbook to generate the right provisioning script.
Why is it important?
Both fleet-server and elastic-agent projects will follow this structure, and because we want to consume the artifacts for PRs, then we need to update the method to look up the bucket.
Checklist
make unit-test), and they are passing locallymake noticein the proper directory)Related issues
Other concerns
We are aware that passing the GIT_SHA of the elastic-agent could cause errors in the k8s-autodiscover test suite, because they download the binaries for metricbeat and filebeat in that commit. Because the SHA for the elastic-agent comes from separate repository, the binaries for MB and FB don't exist for that commit. In #2175 we explain it more in depth