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

feat: use Docker copy to transfer binaries to containers#1136

Merged
mdelapenya merged 4 commits intoelastic:masterfrom
mdelapenya:docker-copy-artifacts
May 5, 2021
Merged

feat: use Docker copy to transfer binaries to containers#1136
mdelapenya merged 4 commits intoelastic:masterfrom
mdelapenya:docker-copy-artifacts

Conversation

@mdelapenya
Copy link
Copy Markdown
Contributor

@mdelapenya mdelapenya commented May 5, 2021

What does this PR do?

Instead of mounting volumes for the binaries, which made it more complex to setup a single agent, we are copying the downloaded file into the container.

How docker CLI works for copying TAR files is that it automatically extracts the TAR file, and for that reason we are removing the PreInstall step we had to perform exactly that operation.

To verify the new implementation, we have added unit tests that runs a busybox container, copying regular and tar files into the container.

Finally, we added a few exceptions in precommit to avoid the hooks to modify the test TAR file with EOFs

Why is it important?

This abstraction will help with the deployment refactors we are taking into the framework

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 for the CLI, 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)

How to test this PR locally

make unit-test

Related issues

Follow-ups

Once we are happy with this implementation, we should replace the existing volumes we have for configuration files that apply only on test time, making it possible to use the CLI part to run services without any coupling to the previous mounted files.

@mdelapenya mdelapenya self-assigned this May 5, 2021
@mdelapenya mdelapenya requested a review from a team May 5, 2021 14:56
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented May 5, 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

Expand to view the summary

Build stats

  • Build Cause: Pull request #1136 updated

  • Start Time: 2021-05-05T19:49:46.194+0000

  • Duration: 19 min 6 sec

  • Commit: 92e8973

Test stats 🧪

Test Results
Failed 0
Passed 159
Skipped 0
Total 159

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 159
Skipped 0
Total 159

@mdelapenya mdelapenya marked this pull request as ready for review May 5, 2021 20:09
@mdelapenya mdelapenya merged commit f39aba5 into elastic:master May 5, 2021
mergify bot pushed a commit that referenced this pull request May 5, 2021
* feat: do not mount volumes for agent installer, copying it into the running container

* chore: skip TAR files from pre-commit

* fix: use different temp dirs per download

* fix: add TAR header for non-TAR installers (RPM, DEB)

(cherry picked from commit f39aba5)

# Conflicts:
#	internal/docker/docker.go
mergify bot pushed a commit that referenced this pull request May 5, 2021
* feat: do not mount volumes for agent installer, copying it into the running container

* chore: skip TAR files from pre-commit

* fix: use different temp dirs per download

* fix: add TAR header for non-TAR installers (RPM, DEB)

(cherry picked from commit f39aba5)

# Conflicts:
#	cli/config/compose/services/fleet-server-centos/docker-compose.yml
#	cli/config/compose/services/fleet-server-debian/docker-compose.yml
#	internal/docker/docker.go
@mdelapenya mdelapenya deleted the docker-copy-artifacts branch May 6, 2021 06:24
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request May 6, 2021
* master:
  chore: update mergify's titles (elastic#1142)
  chore: remove unused pipelines (elastic#1143)
  feat: use Docker copy to transfer binaries to containers (elastic#1136)
  chore: abstract image pulling (elastic#1137)
  Support multiple deployment backends (elastic#1130)
  chore: remove unused code (elastic#1119)
  Unify fleet and stand-alone suites (elastic#1112)
  Pull fresh docker images before suite (elastic#1123)
  chore: initialise timeout factor next to the declaration (elastic#1118)
  chore: match Go version with Beats (elastic#1120)
  feat: support running k8s autodiscover suite for Beats PRs and local repositories (elastic#1115)
  Auto bootstrap fleet during initialize scenario (elastic#1116)
  Kubernetes Deployment (elastic#1110)
mdelapenya added a commit that referenced this pull request May 6, 2021
* feat: do not mount volumes for agent installer, copying it into the running container

* chore: skip TAR files from pre-commit

* fix: use different temp dirs per download

* fix: add TAR header for non-TAR installers (RPM, DEB)

(cherry picked from commit f39aba5)

# Conflicts:
#	internal/docker/docker.go

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
mdelapenya added a commit that referenced this pull request May 6, 2021
* feat: do not mount volumes for agent installer, copying it into the running container

* chore: skip TAR files from pre-commit

* fix: use different temp dirs per download

* fix: add TAR header for non-TAR installers (RPM, DEB)

(cherry picked from commit f39aba5)

# Conflicts:
#	cli/config/compose/services/fleet-server-centos/docker-compose.yml
#	cli/config/compose/services/fleet-server-debian/docker-compose.yml
#	internal/docker/docker.go

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fleet] instead of using volumes to transfer Agent file, can we maybe copy it after the container is in place?

4 participants