Merge 2 from course/main#6
Merged
Merged
Conversation
- Add .devcontainer with Ubuntu noble Dockerfile installing gcc, clang, clangd, make, cmake, clang-format, cmake-format, and ninja-build from apt-packages.in, with UTF-8 locale and a non-root user matching the host user. - Configure devcontainer.json to bind-mount the workspace, host SSH keys, and a persistent bash history, and preload VS Code extensions plus clangd/cmake-format editor defaults. - Ship root-level .clang-format, .clangd, and .cmake-format.json into the image so editor integrations and SCA tooling pick up the intended configs by default. - Add scripts/initialize host hook that creates the persistent bash history file under ~/.devcontainers before container start so shell history survives rebuilds.
- Harden .devcontainer/scripts/initialize for macOS, Linux, and
WSL2 hosts by adding `set -euo pipefail`, quoting all variable
expansions, switching backticks to $(...), and using ${HOME}
instead of ~ inside assignments.
- Mark the script executable in the Git index (100755) so hosts
that don't carry POSIX mode bits still execute it in-container.
- Add .gitattributes to pin LF line endings for shell scripts
and the Dockerfile, preventing `bad interpreter: /usr/bin/env^M`
failures when the repo is checked out on a Windows-backed
filesystem (including the NTFS side of some WSL2 setups).
- Drop .vscode/ from .gitignore so the repo can ship shared
editor settings/launch configs that align with the dev
container's clangd and cmake-format defaults.
- Switch `mkdir` to `mkdir -p` in the final Dockerfile RUN so the container image build succeeds on macOS hosts, where WORKSPACE_FOLDER resolves to /Users/<user>/<project> and /Users does not exist in the Ubuntu base image. Plain `mkdir` cannot create nested parents, which broke step 8/8 of the image build. - Switch `chown` to `chown -R` so ownership on the workspace dir (and any parents just created) is set for the container user, keeping behavior correct before the host workspace bind-mount is applied at runtime.
- Add .vscode/extensions.json recommending the `ms-vscode-remote. remote-containers` extension, the minimum required on the host VS Code to expose the "Reopen in Container" command. - Extension identifier is identical on macOS, Linux, and WSL2 hosts, so a single recommendation covers all supported dev platforms without branching per-OS. - Container-internal extensions (clangd, cpptools, cmake-format, cmake-language-support) remain declared in devcontainer.json's customizations.vscode.extensions and are intentionally not duplicated here, since they are installed inside the container rather than on the host.
- Add preps/macos.sh that installs Colima, Docker CLI, and docker-buildx via Homebrew, links the buildx plugin into ~/.docker/cli-plugins so `docker buildx` is discoverable, and starts the Colima VM as the Docker runtime. - Scope kept to the minimum the Dockerfile-based dev container actually needs: no docker-compose (the devcontainer is not compose-based) and no preflight/smoke-test scaffolding.
- Add preps/linux.sh that installs Docker Engine via the official get.docker.com convenience script and adds the current user to the docker group, the minimum needed for the Dev Container CLI to talk to dockerd without sudo after a relogin. - Add preps/windows.ps1 that runs `wsl --install -d Ubuntu` to set up WSL2 with the default Ubuntu distro. Docker Desktop and winget are intentionally avoided; Docker itself is installed inside WSL2 by running preps/linux.sh from the Ubuntu distro, and the script's header comment spells out that chain so users aren't left guessing where the Docker engine install happens. - Keep both scripts at the same minimum scope as preps/macos.sh: host-only setup, nothing more than what's required for VS Code Dev Containers to reach a working dockerd.
- Remove preps/linux.sh, preps/macos.sh, and preps/windows.ps1. The per-platform host setup is short enough to follow as plain prose and doesn't justify shipping runnable scripts that have to be kept in sync with the prose anyway. - Add preps/linux.md, preps/macos.md, and preps/windows.md with copy-pasteable commands for installing Docker (Engine on Linux, Colima on macOS, WSL2+Engine on Windows 11), including the non-obvious bits (BIOS virtualization on Windows, systemd in WSL, docker-group relogin) that a plain script would hide. - Add preps/README.md as an index that routes users by OS and by editor (VS Code Dev Containers vs. any other editor via the devcontainers CLI), plus the final verification flow. - Add preps/devcontainers-cli.md covering the @devcontainers/cli workflow so users on Neovim, JetBrains, Helix, Sublime, and others can drive the same container without VS Code.
- Delete block2-lesson1/CMakeLists.txt and block2-lesson1/main.cpp introduced by commit 49d7702 ("lesson1"). The repo is already scoped to a single lesson (tracked on the block-2-lesson-1 branch), so nesting source files under a same-named subdir is redundant and puts the cmake build/ directory one level deeper than necessary for no gain.
- Add CMakeLists.txt configuring a C++20 build of an `app` executable from main.cpp, with -Wall -Wextra -pedantic and CXX_EXTENSIONS=OFF so portability issues surface early. - Add main.cpp as the lesson's hello-world entry point, printing "Hello, section 2!" to stdout. - Add README.md covering prerequisites (the dev container under .devcontainer/ plus host setup in preps/), the cmake -S . -B build / cmake --build build flow, and the expected runtime output.
- README.md: linear numbered steps (Docker -> clone -> code . -> extension -> Reopen in Container) - OS files: clone uses --branch block-2-lesson-1; linux/windows include apt update + git install - windows.md: systemd=true as default so docker auto-starts on WSL boot - windows.md: troubleshooting for common Windows-native open mistakes (error 193, out-of-space in docker-desktop VM, missing WSL prefix, empty localEnv vars) - Impersonal tone throughout (no 2nd-person addressing)
On fresh machines (students who never generated SSH keys) the bind-mount
source=${HOME}/.ssh failed with "bind source path does not exist",
blocking container start.
- scripts/initialize: create ~/.ssh with 700 perms if missing (idempotent,
does not touch existing .ssh)
- preps/README.md: add "Якщо вже клонували репо раніше" section with
git pull steps for students who cloned before this fix
Ubuntu 24.04 (Noble) base image ships with a pre-created 'ubuntu' user at UID 1000. Without this fix, useradd for the course user picked UID 1001 (next available), so bind-mounted workspace files (owned by host UID 1000) appeared as owned by 'ubuntu' inside the container. Dev Containers CLI updateUID step also could not realign the course user to 1000 because UID 1000 was already taken. - Dockerfile: userdel -r ubuntu + groupdel ubuntu before useradd, then useradd -u 1000 -U so the course user owns UID 1000 and bind-mount ownership maps to the right name inside the container. - preps/README.md: in "Якщо вже клонували" section, switch instruction from "Reopen in Container" to "Rebuild Container" so students pick up the new Dockerfile layer after git pull.
…ackages feat(devcontainer): add ssh and git packages
The :noble tag is mutable on Docker Hub, so the same Dockerfile can pull different images over time. Pin to a digest for reproducibility.
So `cmake --build build` at the repo root builds both the root app and the homework target in one pass.
Runs cmake configure+build inside the repo's devcontainer so CI matches the local VS Code environment.
Default push=filter tries to push the built image and fails with 'imageName is required' because no registry is configured. The image is only needed locally on the runner for the build step.
A push to a feature branch with an open PR used to trigger the workflow twice (once from push, once from pull_request synchronize). Restricting push to main keeps push runs for merges and leaves PR runs to the pull_request trigger.
…ctions Ci/devcontainer GitHub actions
…rUID useradd previously hardcoded -u 1000 to match a common host UID. That is what VS Code and devcontainers/ci already handle at container start via updateRemoteUserUID, which syncs the container user UID to the host's. All we need from the image is that UID 1000 be free so the default useradd slot and the runtime remap don't collide with the ubuntu user that noble ships on UID 1000. Remove ubuntu conditionally (guarded by `id ubuntu`) and let useradd pick the UID on its own.
…ify-user-setup chore(devcontainer): drop hardcoded UID 1000, rely on updateRemoteUse…
Root CMakeLists.txt used to build a small hello app from a top-level main.cpp. With homework_NN subdirectories in place (each with its own CMakeLists.txt and executable target), the root app is no longer useful. Remove main.cpp and the add_executable(app) line from the root CMakeLists.txt.
Replace the "Section 2 - стартовий код" stub with a course-level README covering clone + Reopen in Container + build, repo structure, how to add new homework_NN, and what CI does. Platform-specific setup stays in preps/.
Rewrite the quickstart to lead with GitHub's "Use this template" button instead of cloning the course repo directly, so each student gets their own independent repo with a clean git history and PRs that default to their own main (not upstream). Add an 'Оновлення з курс-репо' section with the remote add + fetch + merge/cherry-pick recipe for pulling later changes from the course repo without the fork-style upstream binding.
…-to-readme docs(readme): add farnblack as second lecturer contact
Cherry-pick / merge / remote add for syncing course-repo changes turn out brittle: template/manual-copy student repos have no shared history with course/main, so merge fails outright and cherry-pick can conflict on locally-modified files. Replace the section with a one-paragraph note that any meaningful course-repo change comes with a Slack announcement and explicit instructions on what to replace by hand. Keep the explanation of why git-sync doesn't work, since that question will keep coming up.
…-flow docs(readme): drop git-sync recipes, route updates through Slack
Block 2 / Lessons 2.1-2.2 Update setup instructions to use the GitHub template workflow instead of the old lesson branch. Adjust the verification step to build the current homework target.
Block 2 / Lesson 2.3 Export compile_commands.json from the root CMake project and point clangd at the generated build directory inside the devcontainer.
Block 2 / Lesson 2.6 Add the course clang-tidy configuration, install clang-tidy in the devcontainer, and copy the config into the container root alongside the existing clang-format setup.
Block 2 / Lesson 2.4 Install the GDB and Valgrind tools needed for diagnostics demos and homework. Also keep the devcontainer terminal settings inside VS Code settings and remove the trailing mount entry comma so the file is valid JSON.
Block 2 / Lessons 2.3-2.6 Add Ukrainian comments to CMake, devcontainer, formatter/linter configs, Git settings, VS Code host recommendation, and homework starter code so student-facing files explain why each block exists.
Block 2 / Lesson 2.4 Translate homework starter C++ comments to English while keeping student-facing configuration comments in Ukrainian.
chore: set up course tooling for block 2
Block 2 / Lessons 2.3-2.4 Add VS Code tasks for configuring/building the CMake project and cleaning the local build directory.
…tasks chore: add VS Code build tasks
Block 2 / Lessons 2.1-2.6 Document the clangd, clang-tidy, debug tooling, VS Code tasks, setup docs, and student-facing config updates from the latest repository changes.
Block: 2 Lesson: 2.4
Block: 2 Lesson: 2.4
Block: 2 Lesson: 2.4
Block: 2 Lesson: 2.4
Block: 2 Lesson: 2.4
Block: 2 Lesson: 2.4
…starter feat(block-2-lesson-2-4): add debug demo and homework 05 starter
Block: 2 Lesson: 2.4
Block: 2 Lesson: 2.4
…student-sync-issues fix(block-2-lesson-2-4): adjust devcontainer diagnostics setup
Block: 2 Lesson: 2.4
…ten-clang-tidy chore: relax clang-tidy rules for lesson 2.6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.