Git Product home page Git Product logo

feature-starter's People

Contributors

bamurtaugh avatar chrmarti avatar chuxel avatar eitsupi avatar github-actions[bot] avatar jarrodcolburn avatar jcbhmr avatar joshspicer avatar joshuanianji avatar ljtill avatar markphip avatar mrhappyma avatar nmemoto avatar parroty avatar samruddhikhandale avatar sdankel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

feature-starter's Issues

Run tests on pushes to all branches, not just main

I think it would be useful to have the tests run on pushes to all branches, as that provides quicker feedback. Would then mean that anyone creating a new repo from this template repo would also have the tests run on all branches, out of the box. If the maintainers agree then I'm happy to submit a PR, thanks.

[question] How can configure a feature to start after the devcontainers is created?

The feature I have in mind depends on a secret which is provided when Codespaces is initialized. I have tried using entrypoint, postStartCommand and postAttachCommand without success. I can see the agent is downloaded and can be initialized manually once Codespaces starts but what I'm looking for is to make it start automatically.

Add example feature that uses `curl`

Writing a feature that uses curl is not exactly straight forward.

I copied some snippets from the aws-cli feature. However, a well documented example in this repository would be awesome.

Specifically, some documentation explaining why installing ca-certificates manually is necessary. Forgetting to do so results in an error that is not so obvious.

Build issue when testing the feature-starter

Docker Version: Docker version 20.10.25, build v20.10.25
OS: NixOS 23

Steps:

  1. Create new template from https://github.com/devcontainers/feature-starter
  2. Clone the project
  3. Go to project and run devcontainer features test

Output:

 devcontainer features test

โ”Œ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”
|    Dev Container Features   |
โ”‚           v0.51.3           โ”‚
โ”” โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”€ โ”˜

>  baseImage:         ubuntu:focal
>  Target Folder:     /home/s1n7ax/Workspace/ttt
>  features:          color, hello
>  workspaceFolder:   /tmp/devcontainercli/container-features-test/1696523352369

โณ Building test container...

[0 ms] @devcontainers/cli 0.51.3. Node.js v20.5.1. linux 6.1.44 x64.
[781 ms] Resolving Feature dependencies for './color'...
[2907 ms] Resolving Feature dependencies for './hello'...
[3645 ms] Soft-dependency 'ghcr.io/devcontainers/features/common-utils' is not required.  Removing from installation order...
[3645 ms] Soft-dependency 'ghcr.io/devcontainers/features/common-utils' is not required.  Removing from installation order...
[3650 ms] Start: Run: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-s1n7ax/container-features/0.51.3-1696523353204 --build-arg _DEV_CONTAINERS_BASE_IMAGE=ubuntu:focal --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-1696523352369-033018f53a99096e4a22cae44aa8eed6cbf64b5c797b8676c14ce1669c67b8d4-features -f /tmp/devcontainercli-s1n7ax/container-features/0.51.3-1696523353204/Dockerfile.extended /tmp/devcontainercli-s1n7ax/empty-folder
[+] Building 0.0s (0/0)
ERROR: http: invalid Host header
[-] Failed to launch container:

Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-s1n7ax/container-features/0.51.3-1696523353204 --build-arg _DEV_CONTAINERS_BASE_IMAGE=ubuntu:focal --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-1696523352369-033018f53a99096e4a22cae44aa8eed6cbf64b5c797b8676c14ce1669c67b8d4-features -f /tmp/devcontainercli-s1n7ax/container-features/0.51.3-1696523353204/Dockerfile.extended /tmp/devcontainercli-s1n7ax/empty-folder

Running the exact command directly throws this

docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-s1n7ax/container-features/0.51.3-1696523353204 --build-arg _DEV_CONTAINERS_BASE_IMAGE=ubuntu:focal --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-1696523352369-033018f53a99096e4a22cae44aa8eed6cbf64b5c797b8676c14ce1669c67b8d4-features -f /tmp/devcontainercli-s1n7ax/container-features/0.51.3-1696523353204/Dockerfile.extended /tmp/devcontainercli-s1n7ax/empty-folder
[+] Building 0.0s (0/0)
ERROR: http: invalid Host header

I get a similar error when building the devcontainer in vscode-remote-try-node project

devcontainer build --workspace-folder .
[6 ms] @devcontainers/cli 0.51.3. Node.js v20.5.1. linux 6.1.44 x64.
[805 ms] Start: Run: docker buildx build --load --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/javascript-node:0-18-bullseye --target dev_containers_target_stage -t vsc-vscode-remote-try-node-706bf7468b84f151090b25e6199bc4b7f6e0dd6a51974ba52575e11a41d9c536-features -f /tmp/devcontainercli-s1n7ax/container-features/0.51.3-1696524238759/Dockerfile.extended /tmp/devcontainercli-s1n7ax/empty-folder
[+] Building 0.0s (0/0)
ERROR: http: invalid Host header
{"outcome":"error","message":"Command failed: docker buildx build --load --build-arg _DEV_CONTAINERS_BASE_IMAGE=mcr.microsoft.com/devcontainers/javascript-node:0-18-bullseye --target dev_containers_target_stage -t vsc-vscode-remote-try-node-706bf7468b84f151090b25e6199bc4b7f6e0dd6a51974ba52575e11a41d9c536-features -f /tmp/devcontainercli-s1n7ax/container-features/0.51.3-1696524238759/Dockerfile.extended /tmp/devcontainercli-s1n7ax/empty-folder","description":"An error occurred building the container."}

However, in the same project, devcontainer up works fine

devcontainer up --workspace-folder .
[2 ms] @devcontainers/cli 0.51.3. Node.js v20.5.1. linux 6.1.44 x64.
Sending build context to Docker daemon  2.607kB
Step 1/10 : ARG BASE_IMAGE
Step 2/10 : FROM $BASE_IMAGE
 ---> c5e428df0d17
Step 3/10 : USER root
 ---> Using cache
 ---> e74968de8636
Step 4/10 : ARG REMOTE_USER
 ---> Using cache
 ---> 70cb4a32a66b
Step 5/10 : ARG NEW_UID
 ---> Using cache
 ---> 0dfa4b818d9b
Step 6/10 : ARG NEW_GID
 ---> Using cache
 ---> c15edbe43129
Step 7/10 : SHELL ["/bin/sh", "-c"]
 ---> Using cache
 ---> 47d499e8c35a
Step 8/10 : RUN eval $(sed -n "s/${REMOTE_USER}:[^:]*:\([^:]*\):\([^:]*\):[^:]*:\([^:]*\).*/OLD_UID=\1;OLD_GID=\2;HOME_FOLDER=\3/p" /etc/passwd); 	eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_UID}:.*/EXISTING_USER=\1/p" /etc/passwd); 	eval $(sed -n "s/\([^:]*\):[^:]*:${NEW_GID}:.*/EXISTING_GROUP=\1/p" /etc/group); 	if [ -z "$OLD_UID" ]; then 		echo "Remote user not found in /etc/passwd ($REMOTE_USER)."; 	elif [ "$OLD_UID" = "$NEW_UID" -a "$OLD_GID" = "$NEW_GID" ]; then 		echo "UIDs and GIDs are the same ($NEW_UID:$NEW_GID)."; 	elif [ "$OLD_UID" != "$NEW_UID" -a -n "$EXISTING_USER" ]; then 		echo "User with UID exists ($EXISTING_USER=$NEW_UID)."; 	else 		if [ "$OLD_GID" != "$NEW_GID" -a -n "$EXISTING_GROUP" ]; then 			echo "Group with GID exists ($EXISTING_GROUP=$NEW_GID)."; 			NEW_GID="$OLD_GID"; 		fi; 		echo "Updating UID:GID from $OLD_UID:$OLD_GID to $NEW_UID:$NEW_GID."; 		sed -i -e "s/\(${REMOTE_USER}:[^:]*:\)[^:]*:[^:]*/\1${NEW_UID}:${NEW_GID}/" /etc/passwd; 		if [ "$OLD_GID" != "$NEW_GID" ]; then 			sed -i -e "s/\([^:]*:[^:]*:\)${OLD_GID}:/\1${NEW_GID}:/" /etc/group; 		fi; 		chown -R $NEW_UID:$NEW_GID $HOME_FOLDER; 	fi;
 ---> Using cache
 ---> 22419ce9f42b
Step 9/10 : ARG IMAGE_USER
 ---> Using cache
 ---> e9bc471825cf
Step 10/10 : USER $IMAGE_USER
 ---> Using cache
 ---> 0e942adabc96
Successfully built 0e942adabc96
Successfully tagged vsc-vscode-remote-try-node-706bf7468b84f151090b25e6199bc4b7f6e0dd6a51974ba52575e11a41d9c536-uid:latest
[232 ms] Start: Run: docker run --sig-proxy=false -a STDOUT -a STDERR --mount type=bind,source=/home/s1n7ax/Workspace/vscode-remote-try-node,target=/workspaces/vscode-remote-try-node -l devcontainer.local_folder=/home/s1n7ax/Workspace/vscode-remote-try-node -l devcontainer.config_file=/home/s1n7ax/Workspace/vscode-remote-try-node/.devcontainer/devcontainer.json --entrypoint /bin/sh -l devcontainer.metadata=[{"id":"ghcr.io/devcontainers/features/common-utils:2"},{"id":"ghcr.io/devcontainers/features/git:1"},{"id":"ghcr.io/devcontainers/features/node:1","customizations":{"vscode":{"extensions":["dbaeumer.vscode-eslint"]}}},{"customizations":{"vscode":{"extensions":["dbaeumer.vscode-eslint"]}},"remoteUser":"node"},{"postCreateCommand":"yarn install","customizations":{"vscode":{"settings":{},"extensions":["streetsidesoftware.code-spell-checker"]}},"portsAttributes":{"3000":{"label":"Hello Remote World","onAutoForward":"notify"}},"forwardPorts":[3000]}] vsc-vscode-remote-try-node-706bf7468b84f151090b25e6199bc4b7f6e0dd6a51974ba52575e11a41d9c536-uid -c echo Container started
Container started
Running the postCreateCommand from devcontainer.json...

yarn install v1.22.19
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.09s.
{"outcome":"success","containerId":"cceb422258443ea52b4b9971ab24f1bd6c7924288627c2bd28854388a2b1fe5a","remoteUser":"node","remoteWorkspaceFolder":"/workspaces/vscode-remote-try-node"}

Updating base image

Hello! Now that javascript-node v1 is released, I'm just wondering if you had plans to update the base image.

For about 99% of my use cases the current image is fine, but I just encountered an issue that required using a newer version of libc for one of my projects so I guess it'll be nice to update the libraries for everyone.

Fails running feature tests

Cannot run test suite of hello and color from a devcontainer created from devcontainer.json.

Received Error:

 => ERROR resolve image config for docker.io/docker/dockerfile:1.4         0.9s
------
 > resolve image config for docker.io/docker/dockerfile:1.4:
------
ERROR: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = error getting credentials - err: exit status 255, out: ``
[-] Failed to launch container:

Command failed: docker buildx build --load --build-context dev_containers_feature_content_source=/tmp/devcontainercli-node/container-features/0.29.0-1675932924566 --build-arg _DEV_CONTAINERS_BASE_IMAGE=ubuntu:focal --build-arg _DEV_CONTAINERS_IMAGE_USER=root --build-arg _DEV_CONTAINERS_FEATURE_CONTENT_SOURCE=dev_container_feature_content_temp --target dev_containers_target_stage -t vsc-1675932924443-2c0a8fb2f33fe2c0baa7b34dfd6cec19-features -f /tmp/devcontainercli-node/container-features/0.29.0-1675932924566/Dockerfile.extended /tmp/devcontainercli-node/empty-folder

Testing with a baseImage without bash?

Testing script with i.e. Alpine would fa il because missing bash, can you document how to install it before running the test?

node โžœ /workspaces/feature-starter (main) $ devcontainer features test --skip-scenarios -f color -i alpine:latest

Result:

OCI runtime exec failed: exec failed: unable to start container process: exec ./test.sh: no such file or directory: unknown

Devcontainer fails to start in VSCode on my M1 Macbook Pro

This default devcontainer template in this repo fails to load the devcontainer in VSCode on my M1 Macbook Pro. It seems to get into some kind of cycle where it knows that a devcontainer is available but it can't use it. The fix that I ran across on StackOverflow was to add an initializeCommand to the devcontainer.json file. This resolved the issue for me. Should this fix be incorporated into this template?

Fix

"initializeCommand": "echo 'Initializing devcontainer'",

Local feature path parse error

Hi, flowing Locally referenced Features instructions I get what seems to be a path parse error:

[3811 ms] * Processing feature: ./localFeatureA
[3811 ms] Local disk feature.
[3811 ms] Local file path parse error. Resolved path must be a child of the .devcontainer/ folder. Parsed: \e:\workspaces\ju.devcontainer\localFeatureA
[3812 ms] Error: Failed to process feature ./localFeatureA

devcontainer-feature.json is in e:\workspaces\ju\.devcontainer\localFeatureA

Error occurs when building with vscode on Windows 10. It builds In Linux.

Adding dependencies

I'm trying to write a custom feature that installs Terraspace (see my repository here).
Terraspace runs on/with ruby and the installation process is pretty straightforward with gem. So to install it I would like to have my feature depend on ruby, meaning the ruby feature gets installed as well even if it is not mentioned in the original .devcontainer file. Is that possible?
If I define the feature dependency manually in a test everything works fine.

No compile instructions

I tried to make a feature via this starter.

  1. Download the template
  2. Make a new feature or change the ID of color or hello feature
  3. Error Blob /tmp/features-output-1699945273175/devcontainer-feature-.......tgz does not exist.

Via this comment devcontainers/features#752 (comment) it seems I should also have compiled something but I don't see those instructions in this feature-starter readme. So please can we make it clearer?

Unable to open devcontainer in VSCode on local machine behind Cloudflare Zero Trust proxy

My local network is behind a Cloudflare Zero Trust proxy. Typically, I would need to install the Cloudflare CA certificate on any container running on my local M1 Macbook Pro that needs external internet access.

However, I am unsure how to do this for devcontainers that install "features" such as the devcontainer in this template repository. I have attempted to define my own Dockerfile that installs the necessary cert but the feature installation still fails. When I attempt to start the devcontainer, I receive the following error.

[2024-01-07T23:37:20.400Z] Resolving Feature dependencies for 'ghcr.io/devcontainers/features/docker-in-docker:2'...
[2024-01-07T23:37:20.400Z] * Processing feature: ghcr.io/devcontainers/features/docker-in-docker:2
[2024-01-07T23:37:20.474Z] Error: unable to get local issuer certificate
[2024-01-07T23:37:20.474Z]     at TLSSocket.onConnectSecure (node:_tls_wrap:1543:34)
[2024-01-07T23:37:20.475Z]     at TLSSocket.emit (node:events:513:28)
[2024-01-07T23:37:20.475Z]     at TLSSocket._finishInit (node:_tls_wrap:962:8)
[2024-01-07T23:37:20.475Z]     at ssl.onhandshakedone (node:_tls_wrap:746:12)

Would you happen to have a recommendation for resolving this issue? I can't seem to get past this on my own.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.