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

Improve feature installation logs #178

Merged
merged 7 commits into from
Sep 19, 2022
Merged

Improve feature installation logs #178

merged 7 commits into from
Sep 19, 2022

Conversation

jkeech
Copy link
Contributor

@jkeech jkeech commented Sep 17, 2022

Add a header to the output logs for each feature that is executed to provide info about the feature

Example:

#15 [dev_containers_target_stage 4/4] RUN cd /tmp/build-features/docker-in-docker_2 && chmod +x ./devcontainer-features-install.sh && ./devcontainer-features-install.sh
#15 0.521 ===========================================================================
#15 0.521 Feature       : Docker (Docker-in-Docker)
#15 0.521 Description   : Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.
#15 0.521 Id            : ghcr.io/devcontainers/features/docker-in-docker
#15 0.521 Version       : 1.0.4
#15 0.521 Documentation : https://github.com/devcontainers/features/tree/main/src/docker-in-docker
#15 0.521 Options       :
#15 0.521     VERSION=latest
#15 0.521     MOBY=true
#15 0.521     DOCKERDASHCOMPOSEVERSION=v1
#15 0.521 ===========================================================================
#15 0.669 DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES=buster bullseye bionic focal jammy
#15 0.669 Distro codename  'bullseye'  matched filter  'buster bullseye bionic focal jammy'
#15 0.675 Running apt-get update...
#15 0.714 Get:1 http://deb.debian.org/debian bullseye InRelease [116 kB]
...

In order to print out feature information in the middle of the docker build, we are now injecting a wrapper script as the command to RUN instead of directly invoking the feature's install.sh. The wrapper script prints the header, sources the devcontainer-features.env and then invokes the feature's install.sh. This simplifies the RUN command in the Dockerfile and gives us a nice spot to handle both before and after a feature executes.

If a feature fails to install, a clear error message is printed saying which feature failed with a pointer to the documentation for that feature. This is accomplished with trap on_exit EXIT that runs the on_exit() function before the script exits.

Added unit and e2e tests to cover the v2 feature install path.

Fixes: #170

@jkeech jkeech requested a review from a team as a code owner September 17, 2022 03:29
chrmarti
chrmarti previously approved these changes Sep 19, 2022
Copy link
Contributor

@chrmarti chrmarti left a comment

Choose a reason for hiding this comment

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

LGTM! Left a suggestion.

src/spec-configuration/containerFeaturesConfiguration.ts Outdated Show resolved Hide resolved
joshspicer
joshspicer previously approved these changes Sep 19, 2022
Copy link
Member

@joshspicer joshspicer left a comment

Choose a reason for hiding this comment

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

woo!

@jkeech jkeech dismissed stale reviews from joshspicer and chrmarti via 95550f2 September 19, 2022 18:42
@jkeech jkeech merged commit deeb19b into main Sep 19, 2022
@jkeech jkeech deleted the jkeech/feature-logs branch September 19, 2022 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature installation logs should clearly indicate when a feature starts/stops installing
3 participants