Skip to content
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

automate the ironbank generation #8537

Merged
merged 18 commits into from
Jul 20, 2022
Merged

Conversation

v1v
Copy link
Member

@v1v v1v commented Jul 5, 2022

Motivation/summary

Automate the docker context generation for the IronBank releases, this will allow us to move away from creating those docker context manually in a different repository, since the Platform Release team already provide the automation.

Implementation details

A similar approach was done for Kibana and Elasticsearch

I initially enabled to build and save the docker image but it failed with some auth issues:

mage ironbank
>> Building docker images for IronBank
[+] Building 3.0s (3/3) FINISHED                                         
 => [internal] load build definition from Dockerfile                0.0s
 => => transferring dockerfile: 3.30kB                              0.0s
 => [internal] load .dockerignore                                   0.0s
 => => transferring context: 2B                                     0.0s
 => ERROR [internal] load metadata for registry1.dsop.io/ironbank/  2.9s
------
 > [internal] load metadata for registry1.dsop.io/ironbank/redhat/ubi/ubi8:8.6:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests 8.6]: 401 Unauthorized
Error: running "docker build -t docker.elastic.co/apm/apm-server-ironbank:8.4.0 build/ironbank" failed with exit code 1
failed to build docker

I don't know if other teams are actually building those docker.

DoD build context content

As required the build context contains the following files:

  • Dockerfile with specific requirements for DoD (registry args, no internet dependencies, healthcheck, ...)
  • hardening_manifest.yaml with all required dependencies
  • LICENSE specific for DoD
  • README.md with specific content for DoD
  • config/ (optional) directory containing all config files to include into the Docker image
  • scripts/ directory containing all scripts to include into the Docker image (example: entrypoint...)

Tasks

  • Exclude if not running for x86_64.
  • Enable configuration in the DRA so it can be automated.
  • Gather feedback from the teams.

Test

image

This job produces the artifacts.

Further details

This could be potentially added to the Beats project, but I don't know what's the plan for the project and what's the priorities for the Platform Productivity team, but for now I think we could try to use this in the apm-server repo

@mergify
Copy link
Contributor

mergify bot commented Jul 5, 2022

This pull request does not have a backport label. Could you fix it @v1v? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-7.x is the label to automatically backport to the 7.x branch.
  • backport-7./d is the label to automatically backport to the 7./d branch. /d is the digit

NOTE: backport-skip has been added to this pull request.

@mergify mergify bot added the backport-skip Skip notification from the automated backport with mergify label Jul 5, 2022
@v1v
Copy link
Member Author

v1v commented Jul 5, 2022

/package

@apmmachine
Copy link
Contributor

apmmachine commented Jul 5, 2022

💚 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: 2022-07-20T08:39:38.670+0000

  • Duration: 26 min 37 sec

Test stats 🧪

Test Results
Failed 0
Passed 4108
Skipped 13
Total 4121

🤖 GitHub comments

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

  • /test : Re-trigger the build.

  • /hey-apm : Run the hey-apm benchmark.

  • /package : Generate and publish the docker images.

  • /test windows : Build & tests on Windows.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@apmmachine
Copy link
Contributor

apmmachine commented Jul 5, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (42/42) 💚
Files 91.96% (183/199) 👍
Classes 93.435% (427/457) 👍
Methods 89.163% (1086/1218) 👍
Lines 76.822% (13321/17340) 👎 -0.006
Conditionals 100.0% (0/0) 💚

@cachedout
Copy link
Contributor

cachedout commented Jul 5, 2022

@v1v The implementation looks pretty sane.

EDIT: I am curious about this: Enable configuration in DRA so it can be automated. Does DRA have the capability to pick up an artifact and perform the rest of the needed automation? (I see that there is a separate PR to handle this.)

Comment on lines +42 to +46
- filename: "apm-server-{{ beat_version }}-linux-x86_64.tar.gz"
url: "<artifact_path>/apm-server-{{ beat_version }}-linux-x86_64.tar.gz"
validation:
type: "sha512"
value: "<insert SHA 512 here>"
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the agreement with the Unified Release automation.

@v1v v1v marked this pull request as ready for review July 6, 2022 16:35
@v1v v1v added backport-8.3 Automated backport with mergify backport-7.17 Automated backport with mergify to the 7.17 branch automation labels Jul 6, 2022
@v1v v1v requested review from a team July 6, 2022 16:36
@mergify mergify bot removed the backport-skip Skip notification from the automated backport with mergify label Jul 6, 2022
@apmmachine
Copy link
Contributor

apmmachine commented Jul 6, 2022

📚 Go benchmark report

Diff with the main branch

name                                                                                            old time/op    new time/op     delta
pkg:github.com/elastic/apm-server/agentcfg goos:linux goarch:amd64
FetchAndAdd/FetchAndAddToCache-12                                                                 97.7ns ± 2%     94.7ns ± 1%   -3.05%  (p=0.008 n=5+5)
pkg:github.com/elastic/apm-server/decoder goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/model/modelindexer goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/processor/stream goos:linux goarch:amd64
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/events.ndjson-12                      15.5µs ± 2%     15.2µs ± 1%   -1.79%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/invalid-event-type.ndjson-12           814ns ± 2%      795ns ± 1%   -2.28%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/transactions-huge_traces.ndjson-12    4.75µs ± 1%     4.66µs ± 1%   -1.95%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/unknown-span-type.ndjson-12           6.68µs ± 1%     6.59µs ± 0%   -1.49%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/metadata-null-values.ndjson-12        3.04µs ± 2%     3.24µs ±10%   +6.34%  (p=0.016 n=4+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/metricsets.ndjson-12                  20.3µs ± 8%     26.6µs ±41%  +30.73%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/ratelimit.ndjson-12                   37.3µs ± 3%     40.0µs ± 5%   +7.26%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/errors_rum.ndjson-12                  2.76µs ± 1%     2.69µs ± 3%   -2.71%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/unknown-span-type.ndjson-12           8.51µs ± 1%     8.38µs ± 0%   -1.56%  (p=0.032 n=5+5)
pkg:github.com/elastic/apm-server/publish goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64
ShardedWriteTransactionUncontended-12                                                              761ns ± 5%      817ns ± 1%   +7.45%  (p=0.029 n=4+4)
WriteTransaction/json_codec_big_tx-12                                                             4.54µs ± 1%     4.80µs ± 3%   +5.53%  (p=0.016 n=4+5)
ReadEvents/json_codec/100_events-12                                                                690µs ± 6%      666µs ± 1%   -3.36%  (p=0.008 n=5+5)
ReadEvents/json_codec/199_events-12                                                               1.36ms ± 3%     1.31ms ± 1%   -3.25%  (p=0.008 n=5+5)
ReadEvents/json_codec/1000_events-12                                                              6.64ms ± 3%     6.43ms ± 2%   -3.20%  (p=0.032 n=5+5)
ReadEvents/json_codec_big_tx/199_events-12                                                        1.64ms ± 1%     1.62ms ± 1%   -1.02%  (p=0.032 n=5+5)
IsTraceSampled/unsampled-12                                                                       78.4ns ± 2%     77.3ns ± 1%   -1.48%  (p=0.032 n=5+5)

name                                                                                            old alloc/op   new alloc/op    delta
pkg:github.com/elastic/apm-server/agentcfg goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/decoder goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/model/modelindexer goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/processor/stream goos:linux goarch:amd64
BackendProcessor/errors_2.ndjson-12                                                               39.6kB ± 1%     39.1kB ± 1%   -1.13%  (p=0.032 n=5+5)
BackendProcessor/transactions.ndjson-12                                                           60.2kB ± 2%     58.7kB ± 2%   -2.40%  (p=0.016 n=5+5)
BackendProcessor/unknown-span-type.ndjson-12                                                      26.7kB ± 2%     26.0kB ± 1%   -2.57%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/errors.ndjson-12                      54.5kB ± 0%     54.1kB ± 0%   -0.71%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/errors_rum.ndjson-12                  10.3kB ± 0%     10.3kB ± 1%   +0.62%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/events.ndjson-12                      60.2kB ± 1%     59.4kB ± 1%   -1.33%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/invalid-event-type.ndjson-12          4.39kB ± 1%     4.32kB ± 1%   -1.66%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/transactions-huge_traces.ndjson-12    18.0kB ± 1%     17.6kB ± 1%   -1.90%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/transactions.ndjson-12                59.1kB ± 0%     58.3kB ± 0%   -1.31%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/transactions_spans.ndjson-12          57.7kB ± 0%     57.4kB ± 0%   -0.63%  (p=0.016 n=5+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/unknown-span-type.ndjson-12           25.3kB ± 1%     24.9kB ± 0%   -1.29%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/errors_2.ndjson-12                    39.1kB ± 1%     38.7kB ± 1%   -1.24%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/transactions-huge_traces.ndjson-12    18.3kB ± 1%     17.8kB ± 0%   -2.65%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/unknown-span-type.ndjson-12           26.0kB ± 1%     25.4kB ± 0%   -2.19%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/errors_2.ndjson-12                    39.6kB ± 1%     39.0kB ± 1%   -1.55%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/metadata.ndjson-12                    5.29kB ± 0%     5.25kB ± 0%   -0.81%  (p=0.016 n=4+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/transactions-huge_traces.ndjson-12    18.3kB ± 1%     17.9kB ± 1%   -2.19%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/transactions_spans.ndjson-12          58.0kB ± 1%     57.6kB ± 0%   -0.68%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/unknown-span-type.ndjson-12           26.0kB ± 1%     25.6kB ± 1%   -1.69%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/errors.ndjson-12                      54.4kB ± 1%     54.0kB ± 0%   -0.63%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/errors_2.ndjson-12                    38.9kB ± 1%     38.4kB ± 0%   -1.15%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/events.ndjson-12                      61.6kB ± 1%     60.7kB ± 1%   -1.40%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions-huge_traces.ndjson-12    18.1kB ± 1%     17.8kB ± 1%   -1.92%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/unknown-span-type.ndjson-12           25.7kB ± 1%     25.4kB ± 1%   -1.13%  (p=0.032 n=5+5)
pkg:github.com/elastic/apm-server/publish goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64
ShardedWriteTransactionUncontended-12                                                             3.23kB ± 1%     3.30kB ± 1%   +2.17%  (p=0.008 n=5+5)
ReadEvents/json_codec/100_events-12                                                                750kB ± 0%      750kB ± 0%   -0.03%  (p=0.016 n=5+4)
ReadEvents/json_codec_big_tx/100_events-12                                                         942kB ± 0%      942kB ± 0%   -0.02%  (p=0.032 n=5+5)
ReadEvents/json_codec_big_tx/1000_events-12                                                       4.50MB ± 0%     4.48MB ± 0%   -0.57%  (p=0.029 n=4+4)

name                                                                                            old allocs/op  new allocs/op   delta
pkg:github.com/elastic/apm-server/agentcfg goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/decoder goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/model/modelindexer goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/processor/stream goos:linux goarch:amd64
BackendProcessor/errors.ndjson-12                                                                    460 ± 0%        458 ± 0%   -0.43%  (p=0.029 n=4+4)
BackendProcessor/errors_2.ndjson-12                                                                  420 ± 0%        418 ± 0%   -0.48%  (p=0.008 n=5+5)
BackendProcessor/events.ndjson-12                                                                    736 ± 0%        732 ± 0%   -0.54%  (p=0.008 n=5+5)
BackendProcessor/transactions-huge_traces.ndjson-12                                                  314 ± 0%        312 ± 0%   -0.64%  (p=0.008 n=5+5)
BackendProcessor/transactions.ndjson-12                                                              540 ± 0%        538 ± 0%   -0.37%  (p=0.008 n=5+5)
BackendProcessor/transactions_spans.ndjson-12                                                        576 ± 0%        574 ± 0%   -0.35%  (p=0.008 n=5+5)
BackendProcessor/unknown-span-type.ndjson-12                                                         391 ± 0%        389 ± 0%   -0.51%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/errors.ndjson-12                         461 ± 0%        459 ± 0%   -0.43%  (p=0.029 n=4+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/errors_2.ndjson-12                       421 ± 0%        419 ± 0%   -0.48%  (p=0.029 n=4+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/transactions-huge_traces.ndjson-12       314 ± 0%        312 ± 0%   -0.64%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/transactions.ndjson-12                   540 ± 0%        538 ± 0%   -0.37%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/transactions_spans.ndjson-12             577 ± 0%        575 ± 0%   -0.35%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/unknown-span-type.ndjson-12              391 ± 0%        389 ± 0%   -0.51%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/errors.ndjson-12                         461 ± 0%        459 ± 0%   -0.43%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/errors_2.ndjson-12                       421 ± 0%        419 ± 0%   -0.48%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/events.ndjson-12                         739 ± 0%        735 ± 0%   -0.54%  (p=0.000 n=5+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/transactions-huge_traces.ndjson-12       314 ± 0%        312 ± 0%   -0.64%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/transactions.ndjson-12                   541 ± 0%        539 ± 0%   -0.37%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/transactions_spans.ndjson-12             577 ± 0%        575 ± 0%   -0.35%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/unknown-span-type.ndjson-12              391 ± 0%        389 ± 0%   -0.51%  (p=0.000 n=5+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/errors.ndjson-12                         462 ± 0%        459 ± 0%   -0.56%  (p=0.000 n=4+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/errors_2.ndjson-12                       421 ± 0%        419 ± 0%   -0.57%  (p=0.000 n=5+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/events.ndjson-12                         743 ± 0%        740 ± 0%   -0.40%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/transactions-huge_traces.ndjson-12       314 ± 0%        312 ± 0%   -0.64%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/transactions.ndjson-12                   541 ± 0%        539 ± 0%   -0.37%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/transactions_spans.ndjson-12             578 ± 0%        576 ± 0%   -0.35%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/unknown-span-type.ndjson-12              392 ± 0%        390 ± 0%   -0.51%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/errors.ndjson-12                         461 ± 0%        459 ± 0%   -0.43%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/errors_2.ndjson-12                       421 ± 0%        419 ± 0%   -0.48%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/events.ndjson-12                         743 ± 0%        739 ± 0%   -0.54%  (p=0.000 n=5+4)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions-huge_traces.ndjson-12       314 ± 0%        312 ± 0%   -0.64%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions.ndjson-12                   541 ± 0%        539 ± 0%   -0.37%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/transactions_spans.ndjson-12             577 ± 0%        575 ± 0%   -0.35%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/unknown-span-type.ndjson-12              392 ± 0%        390 ± 0%   -0.51%  (p=0.008 n=5+5)
pkg:github.com/elastic/apm-server/publish goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/spanmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/aggregation/txmetrics goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling goos:linux goarch:amd64
pkg:github.com/elastic/apm-server/x-pack/apm-server/sampling/eventstorage goos:linux goarch:amd64

name                                                                                            old speed      new speed       delta
pkg:github.com/elastic/apm-server/processor/stream goos:linux goarch:amd64
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/events.ndjson-12                     479MB/s ± 2%    488MB/s ± 1%   +1.81%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/invalid-event-type.ndjson-12         481MB/s ± 2%    492MB/s ± 1%   +2.32%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/transactions-huge_traces.ndjson-12   668MB/s ± 1%    681MB/s ± 1%   +1.98%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel0/unknown-span-type.ndjson-12          495MB/s ± 1%    502MB/s ± 0%   +1.50%  (p=0.008 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/metadata-null-values.ndjson-12       173MB/s ± 2%    163MB/s ±10%   -5.71%  (p=0.016 n=4+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel2/metricsets.ndjson-12                 126MB/s ± 8%    100MB/s ±32%  -20.81%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel4/ratelimit.ndjson-12                  113MB/s ± 3%    105MB/s ± 5%   -6.70%  (p=0.016 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/errors_rum.ndjson-12                 686MB/s ± 1%    706MB/s ± 3%   +2.81%  (p=0.032 n=5+5)
BackendProcessorParallel/BenchmarkBackendProcessorParallel8/unknown-span-type.ndjson-12          388MB/s ± 1%    395MB/s ± 0%   +1.58%  (p=0.032 n=5+5)

report generated with https://pkg.go.dev/golang.org/x/perf/cmd/benchstat

.gitignore Outdated
@@ -53,3 +53,6 @@ terraform.tfstate.backup
terraform.tfvars
testing/benchmark/.envrc
testing/benchmark/benchmark-result.txt

# Ironbank
apm-server-ironbank*
Copy link
Member Author

Choose a reason for hiding this comment

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

As long as the Tar compress the given folder and nested folders, then it's required to run tar within the top-level folder so the folder name contains the docker context, otherwise it will be not compliance with the Ironbank automation

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, having trouble understanding this. What is the requirement? I'm not keen on build files being created in the top level directory. Why can't the apm-server-ironbank-<version>-docker-build-context directory be created under build/?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried initially that approach but the generated apm-server-ironbank-<version>-docker-build-context.tar.gz included the build/... folders. Unfortunately I could not find the way to chdir to build so the tar command could be created from that context instead.

image

I might need to look for how to solve this, though if you have some suggestions please let me know.

Copy link
Member Author

Choose a reason for hiding this comment

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

diff --git a/magefile.go b/magefile.go
index e314dfb5b..7cd8d9d4d 100644
--- a/magefile.go
+++ b/magefile.go
@@ -261,7 +261,8 @@ func saveIronbank() error {
 	fmt.Println(">> saveIronbank: save the IronBank container context.")
 
 	ironbank := getIronbankContextName()
-	if _, err := os.Stat(ironbank); os.IsNotExist(err) {
+	buildDir := filepath.Join("build", ironbank)
+	if _, err := os.Stat(buildDir); os.IsNotExist(err) {
 		return fmt.Errorf("cannot find the folder with the ironbank context")
 	}
 
@@ -276,7 +277,7 @@ func saveIronbank() error {
 	tarGzFile := filepath.Join(distributionsDir, ironbank+".tar.gz")
 
 	// Save the build context as tar.gz artifact
-	err := mage.Tar(ironbank, tarGzFile)
+	err := mage.Tar(buildDir, tarGzFile)
 	if err != nil {
 		return fmt.Errorf("cannot compress the tar.gz file")
 	}
@@ -297,6 +298,7 @@ func getIronbankContextName() string {
 func prepareIronbankBuild() error {
 	fmt.Println(">> prepareIronbankBuild: prepare the IronBank container context.")
 	ironbank := getIronbankContextName()
+	buildDir := filepath.Join("build", ironbank)
 	templatesDir := filepath.Join("packaging", "ironbank")
 
 	data := map[string]interface{}{
@@ -306,7 +308,7 @@ func prepareIronbankBuild() error {
 	err := filepath.Walk(templatesDir, func(path string, info os.FileInfo, _ error) error {
 		if !info.IsDir() {
 			target := strings.TrimSuffix(
-				filepath.Join(ironbank, filepath.Base(path)),
+				filepath.Join(buildDir, filepath.Base(path)),
 				".tmpl",
 			)

but it produces:

$ ls -ltra build 
total 0
drwxr-xr-x  6 vmartinez staff  192 Jul 18 14:08 apm-server-ironbank-8.4.0-docker-build-context
drwxr-xr-x 72 vmartinez staff 2304 Jul 18 19:04 ..
drwxr-x---  5 vmartinez staff  160 Jul 18 19:04 distributions
drwxr-x---  4 vmartinez staff  128 Jul 18 19:04 .
$ ls -ltra build/distributions 
total 24
-rw-r--r-- 1 vmartinez staff 8872 Jul 18 14:08 apm-server-ironbank-8.4.0-docker-build-context.tar.gz
-rw-r--r-- 1 vmartinez staff  183 Jul 18 14:08 apm-server-ironbank-8.4.0-docker-build-context.tar.gz.sha512
$ cd build/distributions 
$ tar xvzf apm-server-ironbank-8.4.0-docker-build-context.tar.gz
x build/apm-server-ironbank-8.4.0-docker-build-context
x build/apm-server-ironbank-8.4.0-docker-build-context/Dockerfile
x build/apm-server-ironbank-8.4.0-docker-build-context/LICENSE
x build/apm-server-ironbank-8.4.0-docker-build-context/README.md
x build/apm-server-ironbank-8.4.0-docker-build-context/hardening_manifest.yaml

But I'd expect:

$ tar xvzf apm-server-ironbank-8.4.0-docker-build-context.tar.gz
x apm-server-ironbank-8.4.0-docker-build-context
x apm-server-ironbank-8.4.0-docker-build-context/Dockerfile
x apm-server-ironbank-8.4.0-docker-build-context/LICENSE
x apm-server-ironbank-8.4.0-docker-build-context/README.md
x apm-server-ironbank-8.4.0-docker-build-context/hardening_manifest.yaml

Copy link
Member

Choose a reason for hiding this comment

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

@v1v should it even have apm-server-ironbank-8.4.0-docker-build-context/ in the contents? This is what the 8.3.2 Elasticsearch IronBank build context tarball looks like:

$ tar tf elasticsearch-ironbank-8.3.2-docker-build-context.tar.gz
scripts/
scripts/docker-openjdk
scripts/docker-entrypoint.sh
scripts/elasticsearch.yml
README.md
LICENSE
hardening_manifest.yaml
Dockerfile
scripts/log4j2.properties

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I thought I did review the folder layout for some other projects and it seems I messed up with the extra folder :/

tar -xvf kibana-ironbank-8.3.3-SNAPSHOT-docker-build-context.tar.gz
x Dockerfile
x LICENSE
x README.md
x bin/
x bin/kibana-docker
x config/
x config/kibana.yml
x hardening_manifest.yaml

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd say mage.Tar cannot be used as is, I'll transition this PR to draft so I'll make the changes to support the tar.gz without any nested folders

Copy link
Member Author

Choose a reason for hiding this comment

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

I think I managed to solve the issue with os.Chdir so the tar.gz contains now the right files without any nested folders :)

image

@cachedout
Copy link
Contributor

@v1v I am not sure if apm-server needs to review this or not. I'm not sure if they're even aware of how the Ironbank stuff works. Perhaps @simitt knows?

Copy link
Contributor

@marclop marclop left a comment

Choose a reason for hiding this comment

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

I don't know much about the ironbark generation, just a generic review on the errors returned

magefile.go Outdated Show resolved Hide resolved
magefile.go Outdated Show resolved Hide resolved
@v1v v1v requested a review from marclop July 8, 2022 08:35
@cachedout
Copy link
Contributor

@marclop Could you please give this one last look? Thanks.

@v1v v1v marked this pull request as draft July 19, 2022 08:09
@v1v v1v requested a review from axw July 19, 2022 09:56
@v1v v1v marked this pull request as ready for review July 19, 2022 09:56
@v1v
Copy link
Member Author

v1v commented Jul 19, 2022

/test

Copy link
Member

@axw axw left a comment

Choose a reason for hiding this comment

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

LGTM. As mentioned on Slack, I'm thinking about introducing our own Dockerfile, so I might end up making some changes. If we do, I'll ping you to find out how we can verify the changes.

.gitignore Outdated Show resolved Hide resolved
Co-authored-by: Andrew Wilkins <[email protected]>
@v1v v1v merged commit 682a0e5 into elastic:main Jul 20, 2022
mergify bot pushed a commit that referenced this pull request Jul 20, 2022
(cherry picked from commit 682a0e5)

# Conflicts:
#	Makefile
#	magefile.go
mergify bot pushed a commit that referenced this pull request Jul 20, 2022
(cherry picked from commit 682a0e5)

# Conflicts:
#	Makefile
#	magefile.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation backport-7.17 Automated backport with mergify to the 7.17 branch backport-8.3 Automated backport with mergify
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants