Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

# netplan dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
Comment thread
benhoyt marked this conversation as resolved.
bash-completion \
build-essential \
cmake \
gcovr \
libcmocka-dev \
libglib2.0-dev \
libsystemd-dev \
libyaml-dev \
meson \
network-manager \
pandoc \
pkg-config \
pycodestyle \
pyflakes3 \
python3-cffi \
python3-coverage \
python3-dev \
python3-pytest \
python3-pytest-cov \
python3-yaml \
systemd \
udev \
uuid-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# devcontainer dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
sudo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN echo "ubuntu ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/ubuntu \
&& chmod 0440 /etc/sudoers.d/ubuntu

WORKDIR /workspace

USER ubuntu
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Netplan Development",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"remoteUser": "ubuntu"
}
16 changes: 16 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Hacking Guide

## Container Usage

### VS Code Dev Container

A devcontainer is provided under `.devcontainer/`.

1. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers).
2. Open this repository in VS Code.
3. Run `Dev Containers: Reopen in Container` from the Command Palette.

## Notes

- The Docker image is useful for reproducible builds and many tests.
- Some system-level integration scenarios (for example, full network service lifecycle behavior) are better exercised VM-based environments.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ To contribute documentation, these steps should get you started:

If you face issues, refer to our [comprehensive contribution guide](https://netplan.readthedocs.io/en/stable/contribute-docs/).

For development workflows (including VS Code container usage), see [HACKING.md](HACKING.md).

# Build dependencies

Install the required build and test dependencies (Ubuntu/Debian):
For a manual setup without containers, install the required build and test dependencies:

```sh
sudo apt install \
Expand Down Expand Up @@ -98,30 +100,30 @@ Convenience targets are available via `make`:
- `make run ARGS='<command>'`
Run the locally built netplan CLI with the appropriate environment, for example, to run `netplan help`:
```sh
$ make run ARGS="help"
make run ARGS="help"
```

# Test local build

After running:

```sh
$ make
$ make install
make
make install
```

the locally built `netplan` can be tested without installing it system-wide:

```sh
$ make run ARGS="<command>"
make run ARGS="<command>"
```

This wrapper sets the required environment variables (such as `NETPLAN_GENERATE_PATH`) automatically. These are needed because the Python CLI resolves binary and library paths at runtime.

As an example, let's use `make run` to run `netplan info`:

```sh
$ make run ARGS="info"
make run ARGS="info"
# output:
netplan.io:
website: "https://netplan.io/"
Expand Down
Loading