Skip to content

Ensure directory is made within zip artifacts#4985

Merged
ebeahan merged 2 commits intoelastic:mainfrom
michel-laterman:fix-windows-archive
May 29, 2025
Merged

Ensure directory is made within zip artifacts#4985
ebeahan merged 2 commits intoelastic:mainfrom
michel-laterman:fix-windows-archive

Conversation

@michel-laterman
Copy link
Copy Markdown
Contributor

What is the problem this PR solves?

.zip artifacts are incorrectly created so not all tools are able to extract them.

How does this PR solve the problem?

Ensure that the distribution folder is created within the artifact

How to test this PR locally

SNAPSHOT=true PLATFORMS=windows/amd64 mage build:release

unzip build/distributions/fleet-server-9.1.0-SNAPSHOT-windows-x86_64.zip

@michel-laterman michel-laterman requested a review from ebeahan May 28, 2025 22:23
@michel-laterman michel-laterman requested a review from a team as a code owner May 28, 2025 22:23
@michel-laterman michel-laterman added bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team backport-8.19 Automated backport to the 8.19 branch labels May 28, 2025
@prodsecmachine
Copy link
Copy Markdown

prodsecmachine commented May 28, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@elastic-sonarqube
Copy link
Copy Markdown

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

@ebeahan ebeahan enabled auto-merge (squash) May 29, 2025 00:40
@ebeahan ebeahan merged commit 813f39f into elastic:main May 29, 2025
9 checks passed
mergify bot pushed a commit that referenced this pull request May 29, 2025
* Ensure directory is made within zip artifacts

* Make test:release extraction stricter

(cherry picked from commit 813f39f)
ebeahan pushed a commit that referenced this pull request May 29, 2025
* Ensure directory is made within zip artifacts

* Make test:release extraction stricter

(cherry picked from commit 813f39f)

Co-authored-by: Michel Laterman <82832767+michel-laterman@users.noreply.github.com>
@michel-laterman michel-laterman deleted the fix-windows-archive branch May 29, 2025 02:31
michel-laterman added a commit that referenced this pull request Sep 3, 2025
* Ensure directory is made within zip artifacts

* Make test:release extraction stricter
michel-laterman added a commit to michel-laterman/fleet-server that referenced this pull request Sep 3, 2025
* Ensure directory is made within zip artifacts

* Make test:release extraction stricter
michel-laterman added a commit to michel-laterman/fleet-server that referenced this pull request Sep 4, 2025
* Ensure directory is made within zip artifacts

* Make test:release extraction stricter
michel-laterman added a commit to michel-laterman/fleet-server that referenced this pull request Sep 4, 2025
* Ensure directory is made within zip artifacts

* Make test:release extraction stricter
michel-laterman added a commit that referenced this pull request Sep 24, 2025
Backport PRs #4912 #4985 #5000 #5075 to 9.0 so that mage is used instead of Make.
Do additional cleanup so FIPS references have been removed.
Chane Buildkite to use plugins.
michel-laterman added a commit that referenced this pull request Sep 24, 2025
* Convert Makefile to magefile.go (#4912)

Reimplement Makefile targets in mage.
Change buildkite pipeline to use mage.
Change Dockerfile* to use mage.

(cherry picked from commit db5f46b)

# Conflicts:
#	.buildkite/pipeline.yml
#	.buildkite/scripts/common.sh
#	.buildkite/scripts/local_build.sh
#	.buildkite/scripts/test-release.sh
#	Dockerfile.build
#	Dockerfile.fips
#	Makefile
#	NOTICE.txt
#	README.md
#	dev-tools/cloud/Makefile
#	dev-tools/cloud/terraform/main.tf
#	dev-tools/e2e/Dockerfile
#	dev-tools/e2e/build.sh
#	dev-tools/e2e/validatecerts.go
#	dev-tools/go.mod
#	dev-tools/go.sum
#	docs/developers-guide.md
#	docs/docker-images.md
#	docs/fips.md
#	testing/e2e/fips_test.go

* Ensure directory is made within zip artifacts (#4985)

* Ensure directory is made within zip artifacts

* Make test:release extraction stricter

* Fail cloude2e step if tests can't run, fix image publication (#5000)

Fail the pipeline if cloude2e tests can't run.
mage docker:image now uses the DOCKER_IMAGE env var.

* Add multiplatform images (#5075)

Fixes issue where change from make to mage, result in the loss of creating multiple platform images.

* Fix cherry-picks

* change to serialdeps

* Use magefile from main

* Remove FIPS references, use docker plugin

* Use bk plugins

* cleanup go.mod in dev-tools and pkg/api

* Add missing EC secret to cloud e2e step

* Review feedback
ycombinator added a commit to ycombinator/fleet-server that referenced this pull request Mar 24, 2026
…ractZip

Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks
so that missing directory entries in archives surface as test failures
rather than being silently papered over (ref: PR elastic#4985).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ycombinator added a commit to ycombinator/fleet-server that referenced this pull request Mar 25, 2026
…ry entries

The Linux elastic-agent snapshot tar omits explicit directory entries
for some paths (e.g. components/certs/), unlike the macOS archive.
Restore MkdirAll for regular files and symlinks in extractTar only;
extractZip intentionally omits it per PR elastic#4985 review feedback to
catch missing directory entries in zip archives we produce ourselves.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ycombinator added a commit to ycombinator/fleet-server that referenced this pull request Mar 25, 2026
…ractZip

Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks
so that missing directory entries in archives surface as test failures
rather than being silently papered over (ref: PR elastic#4985).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ycombinator added a commit to ycombinator/fleet-server that referenced this pull request Mar 25, 2026
…ry entries

The Linux elastic-agent snapshot tar omits explicit directory entries
for some paths (e.g. components/certs/), unlike the macOS archive.
Restore MkdirAll for regular files and symlinks in extractTar only;
extractZip intentionally omits it per PR elastic#4985 review feedback to
catch missing directory entries in zip archives we produce ourselves.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ycombinator added a commit that referenced this pull request Mar 25, 2026
* test(e2e): add EDOT Collector OpAMP E2E test

- Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the
  Elastic Agent package can connect to Fleet Server over OpAMP and enroll
  in .fleet-agents
- Extract shared agent download/extract helpers (downloadElasticAgent,
  extractAgentArchive) into agent_download.go, refactoring the duplicated
  code from AgentInstallSuite
- Fix TestOpAMP: pre-create the bin/ directory before running make
  otelcontribcol, which requires it to exist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup

- Extract shared download/extract helpers into agent_download.go with
  caching (sha512 comparison), FileReplacer, ExtractFilter, and correct
  chmod after extraction
- Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers
  shared by both OpAMP tests
- Rename TestOpAMP → TestOpAMPWithUpstreamCollector
- Add TestOpAMPWithEDOTCollector: downloads elastic-agent package,
  runs elastic-agent otel subcommand, verifies EDOT Collector enrolls
  in Fleet Server over OpAMP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig

Update inline comments, simplify writeOpAMPCollectorConfig to take a
single configFilePath parameter, and add newlines after Require()
statements for readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): improve EDOT test readability

Elaborate on the processExited comment and move the Cleanup block below
the early-exit check so the flow reads top-to-bottom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): fix stale comments in EDOT test

Rename "immediate exit" to "early exit" for consistency and update
the Cleanup comment now that it is registered after the early-exit check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): extract standalone extractTar/extractZip into agent_download.go

Move archive extraction out of AgentInstallSuite into standalone
functions so both AgentInstallSuite and StandAloneSuite can reuse them.
AgentInstallSuite now overwrites the fleet-server binary after extraction
instead of during.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(e2e): remove implicit parent directory creation in extractTar/extractZip

Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks
so that missing directory entries in archives surface as test failures
rather than being silently papered over (ref: PR #4985).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): replace static instance UIDs with generated UUIDv7s

Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test
instance UIDs, as suggested in review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
mergify bot pushed a commit that referenced this pull request Mar 25, 2026
* test(e2e): add EDOT Collector OpAMP E2E test

- Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the
  Elastic Agent package can connect to Fleet Server over OpAMP and enroll
  in .fleet-agents
- Extract shared agent download/extract helpers (downloadElasticAgent,
  extractAgentArchive) into agent_download.go, refactoring the duplicated
  code from AgentInstallSuite
- Fix TestOpAMP: pre-create the bin/ directory before running make
  otelcontribcol, which requires it to exist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup

- Extract shared download/extract helpers into agent_download.go with
  caching (sha512 comparison), FileReplacer, ExtractFilter, and correct
  chmod after extraction
- Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers
  shared by both OpAMP tests
- Rename TestOpAMP → TestOpAMPWithUpstreamCollector
- Add TestOpAMPWithEDOTCollector: downloads elastic-agent package,
  runs elastic-agent otel subcommand, verifies EDOT Collector enrolls
  in Fleet Server over OpAMP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig

Update inline comments, simplify writeOpAMPCollectorConfig to take a
single configFilePath parameter, and add newlines after Require()
statements for readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): improve EDOT test readability

Elaborate on the processExited comment and move the Cleanup block below
the early-exit check so the flow reads top-to-bottom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): fix stale comments in EDOT test

Rename "immediate exit" to "early exit" for consistency and update
the Cleanup comment now that it is registered after the early-exit check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): extract standalone extractTar/extractZip into agent_download.go

Move archive extraction out of AgentInstallSuite into standalone
functions so both AgentInstallSuite and StandAloneSuite can reuse them.
AgentInstallSuite now overwrites the fleet-server binary after extraction
instead of during.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(e2e): remove implicit parent directory creation in extractTar/extractZip

Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks
so that missing directory entries in archives surface as test failures
rather than being silently papered over (ref: PR #4985).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): replace static instance UIDs with generated UUIDv7s

Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test
instance UIDs, as suggested in review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 5ece964)

# Conflicts:
#	testing/e2e/stand_alone_test.go
mergify bot pushed a commit that referenced this pull request Mar 25, 2026
* test(e2e): add EDOT Collector OpAMP E2E test

- Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the
  Elastic Agent package can connect to Fleet Server over OpAMP and enroll
  in .fleet-agents
- Extract shared agent download/extract helpers (downloadElasticAgent,
  extractAgentArchive) into agent_download.go, refactoring the duplicated
  code from AgentInstallSuite
- Fix TestOpAMP: pre-create the bin/ directory before running make
  otelcontribcol, which requires it to exist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup

- Extract shared download/extract helpers into agent_download.go with
  caching (sha512 comparison), FileReplacer, ExtractFilter, and correct
  chmod after extraction
- Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers
  shared by both OpAMP tests
- Rename TestOpAMP → TestOpAMPWithUpstreamCollector
- Add TestOpAMPWithEDOTCollector: downloads elastic-agent package,
  runs elastic-agent otel subcommand, verifies EDOT Collector enrolls
  in Fleet Server over OpAMP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig

Update inline comments, simplify writeOpAMPCollectorConfig to take a
single configFilePath parameter, and add newlines after Require()
statements for readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): improve EDOT test readability

Elaborate on the processExited comment and move the Cleanup block below
the early-exit check so the flow reads top-to-bottom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): fix stale comments in EDOT test

Rename "immediate exit" to "early exit" for consistency and update
the Cleanup comment now that it is registered after the early-exit check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): extract standalone extractTar/extractZip into agent_download.go

Move archive extraction out of AgentInstallSuite into standalone
functions so both AgentInstallSuite and StandAloneSuite can reuse them.
AgentInstallSuite now overwrites the fleet-server binary after extraction
instead of during.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(e2e): remove implicit parent directory creation in extractTar/extractZip

Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks
so that missing directory entries in archives surface as test failures
rather than being silently papered over (ref: PR #4985).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): replace static instance UIDs with generated UUIDv7s

Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test
instance UIDs, as suggested in review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 5ece964)

# Conflicts:
#	testing/e2e/stand_alone_test.go
ycombinator added a commit that referenced this pull request Mar 26, 2026
…st (#6664)

* [OpAMP] Add `TestOpAMPWithEDOTCollector` E2E test (#6612)

* test(e2e): add EDOT Collector OpAMP E2E test

- Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the
  Elastic Agent package can connect to Fleet Server over OpAMP and enroll
  in .fleet-agents
- Extract shared agent download/extract helpers (downloadElasticAgent,
  extractAgentArchive) into agent_download.go, refactoring the duplicated
  code from AgentInstallSuite
- Fix TestOpAMP: pre-create the bin/ directory before running make
  otelcontribcol, which requires it to exist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup

- Extract shared download/extract helpers into agent_download.go with
  caching (sha512 comparison), FileReplacer, ExtractFilter, and correct
  chmod after extraction
- Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers
  shared by both OpAMP tests
- Rename TestOpAMP → TestOpAMPWithUpstreamCollector
- Add TestOpAMPWithEDOTCollector: downloads elastic-agent package,
  runs elastic-agent otel subcommand, verifies EDOT Collector enrolls
  in Fleet Server over OpAMP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig

Update inline comments, simplify writeOpAMPCollectorConfig to take a
single configFilePath parameter, and add newlines after Require()
statements for readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): improve EDOT test readability

Elaborate on the processExited comment and move the Cleanup block below
the early-exit check so the flow reads top-to-bottom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): fix stale comments in EDOT test

Rename "immediate exit" to "early exit" for consistency and update
the Cleanup comment now that it is registered after the early-exit check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): extract standalone extractTar/extractZip into agent_download.go

Move archive extraction out of AgentInstallSuite into standalone
functions so both AgentInstallSuite and StandAloneSuite can reuse them.
AgentInstallSuite now overwrites the fleet-server binary after extraction
instead of during.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(e2e): remove implicit parent directory creation in extractTar/extractZip

Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks
so that missing directory entries in archives surface as test failures
rather than being silently papered over (ref: PR #4985).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): replace static instance UIDs with generated UUIDv7s

Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test
instance UIDs, as suggested in review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 5ece964)

# Conflicts:
#	testing/e2e/stand_alone_test.go

* Fixing conflicts

---------

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
ycombinator added a commit that referenced this pull request Mar 26, 2026
…st (#6663)

* [OpAMP] Add `TestOpAMPWithEDOTCollector` E2E test (#6612)

* test(e2e): add EDOT Collector OpAMP E2E test

- Add TestEDOTOpAMP to verify that the EDOT Collector bundled inside the
  Elastic Agent package can connect to Fleet Server over OpAMP and enroll
  in .fleet-agents
- Extract shared agent download/extract helpers (downloadElasticAgent,
  extractAgentArchive) into agent_download.go, refactoring the duplicated
  code from AgentInstallSuite
- Fix TestOpAMP: pre-create the bin/ directory before running make
  otelcontribcol, which requires it to exist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* e2e: add TestOpAMPWithEDOTCollector and refactor shared OpAMP setup

- Extract shared download/extract helpers into agent_download.go with
  caching (sha512 comparison), FileReplacer, ExtractFilter, and correct
  chmod after extraction
- Extract startFleetServerForOpAMP and writeOpAMPCollectorConfig helpers
  shared by both OpAMP tests
- Rename TestOpAMP → TestOpAMPWithUpstreamCollector
- Add TestOpAMPWithEDOTCollector: downloads elastic-agent package,
  runs elastic-agent otel subcommand, verifies EDOT Collector enrolls
  in Fleet Server over OpAMP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore(e2e): clean up OpAMP test comments and simplify writeOpAMPCollectorConfig

Update inline comments, simplify writeOpAMPCollectorConfig to take a
single configFilePath parameter, and add newlines after Require()
statements for readability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): improve EDOT test readability

Elaborate on the processExited comment and move the Cleanup block below
the early-exit check so the flow reads top-to-bottom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore(e2e): fix stale comments in EDOT test

Rename "immediate exit" to "early exit" for consistency and update
the Cleanup comment now that it is registered after the early-exit check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): extract standalone extractTar/extractZip into agent_download.go

Move archive extraction out of AgentInstallSuite into standalone
functions so both AgentInstallSuite and StandAloneSuite can reuse them.
AgentInstallSuite now overwrites the fleet-server binary after extraction
instead of during.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(e2e): remove implicit parent directory creation in extractTar/extractZip

Remove MkdirAll(filepath.Dir(path)) calls for regular files and symlinks
so that missing directory entries in archives surface as test failures
rather than being silently papered over (ref: PR #4985).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(e2e): replace static instance UIDs with generated UUIDv7s

Use uuid.Must(uuid.NewV7()) instead of hardcoded UUIDs for OpAMP test
instance UIDs, as suggested in review.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 5ece964)

# Conflicts:
#	testing/e2e/stand_alone_test.go

* Fixing conflicts

---------

Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants