From 5c3a100ebb266a8f9a8371517ec6b07c13dcffa4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:24:18 +0000 Subject: [PATCH 1/3] Initial plan From 73f6f8e9c0fc81a62d064e6f23e3523977a2b16e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:26:59 +0000 Subject: [PATCH 2/3] Add devcontainer configuration for GitHub Codespaces Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com> --- .devcontainer/Dockerfile | 64 +++++++++++++++++++++++++++ .devcontainer/README.md | 78 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 37 ++++++++++++++++ 3 files changed, 179 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/README.md create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..d056a0d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,64 @@ +# Use latest Ubuntu as base +FROM ubuntu:latest + +# Avoid warnings by switching to noninteractive +ENV DEBIAN_FRONTEND=noninteractive + +# Configure apt and install packages +RUN apt-get update \ + && apt-get -y install --no-install-recommends \ + # Build essentials and tools + build-essential \ + cmake \ + ninja-build \ + pkg-config \ + git \ + # Required dependencies from GitHub Actions workflow + libssl-dev \ + sqlite3 \ + libsqlite3-dev \ + libcurl4 \ + libcurl4-openssl-dev \ + uuid-dev \ + libgtest-dev \ + # C++ development and debugging tools + gdb \ + gdbserver \ + valgrind \ + clang \ + clang-format \ + clang-tidy \ + lldb \ + # Additional utilities + curl \ + wget \ + vim \ + nano \ + htop \ + tree \ + zip \ + unzip \ + ca-certificates \ + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# Create a non-root user to use +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +RUN groupadd --gid $USER_GID $USERNAME \ + && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + && apt-get update \ + && apt-get install -y sudo \ + && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ + && chmod 0440 /etc/sudoers.d/$USERNAME \ + && rm -rf /var/lib/apt/lists/* + +# Switch back to dialog for any ad-hoc use of apt-get +ENV DEBIAN_FRONTEND=dialog + +# Set the default user +USER $USERNAME diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..9e3db85 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,78 @@ +# SciTokens C++ Development Container + +This devcontainer configuration enables GitHub Codespaces and local development container support for the scitokens-cpp project. + +## Features + +### Base Environment +- **OS**: Latest Ubuntu +- **User**: Non-root `vscode` user with sudo access + +### Build Dependencies +All dependencies from the GitHub Actions workflow are included: +- `libssl-dev` - OpenSSL development files +- `sqlite3` and `libsqlite3-dev` - SQLite database +- `cmake` - Build system +- `libcurl4` and `libcurl4-openssl-dev` - HTTP client library +- `uuid-dev` - UUID generation library +- `libgtest-dev` - Google Test framework + +### Development Tools +- **Build Tools**: build-essential, cmake, ninja-build, pkg-config +- **Debuggers**: gdb, gdbserver, lldb +- **Analysis Tools**: valgrind, clang-tidy +- **Compilers**: gcc/g++ (via build-essential), clang +- **Formatters**: clang-format +- **Utilities**: git, curl, wget, vim, nano, htop, tree + +### VSCode Extensions +- C/C++ Extension Pack +- CMake Tools +- CMake Language Support +- GitHub Copilot (if available) + +## Usage + +### GitHub Codespaces +1. Navigate to the repository on GitHub +2. Click the "Code" button +3. Select "Codespaces" tab +4. Click "Create codespace on [branch]" + +### Local Development with VSCode +1. Install [Docker](https://www.docker.com/products/docker-desktop) +2. Install [VSCode](https://code.visualstudio.com/) +3. Install the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) +4. Open the repository in VSCode +5. Click "Reopen in Container" when prompted (or use Command Palette: "Dev Containers: Reopen in Container") + +## Building the Project + +After the container is created, submodules are automatically initialized. To build: + +```bash +# Create build directory +mkdir -p build +cd build + +# Configure with CMake +cmake .. -DCMAKE_BUILD_TYPE=Release -DSCITOKENS_BUILD_UNITTESTS=ON + +# Build +cmake --build . + +# Run tests +ctest --verbose +``` + +## Debugging + +The container includes both GDB and LLDB debuggers. You can: +- Use VSCode's integrated debugging features +- Run debuggers from the terminal +- Use valgrind for memory analysis + +Example using GDB: +```bash +gdb ./scitokens-test +``` diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..c3b4cda --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,37 @@ +{ + "name": "SciTokens C++ Development", + "build": { + "dockerfile": "Dockerfile" + }, + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.defaultProfile.linux": "bash", + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" + }, + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.cmake-tools", + "twxs.cmake", + "github.copilot", + "github.copilot-chat" + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "git submodule update --init --recursive", + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + "remoteUser": "vscode", + + "features": { + "ghcr.io/devcontainers/features/git:1": {} + } +} From 6a9b48e19fa5bc9208c1b9587d101d757ad9e463 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:28:28 +0000 Subject: [PATCH 3/3] Optimize Dockerfile by removing duplicate apt-get update Co-authored-by: bbockelm <1093447+bbockelm@users.noreply.github.com> --- .devcontainer/Dockerfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d056a0d..cea633d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -39,6 +39,7 @@ RUN apt-get update \ zip \ unzip \ ca-certificates \ + sudo \ # Clean up && apt-get autoremove -y \ && apt-get clean -y \ @@ -51,11 +52,8 @@ ARG USER_GID=$USER_UID RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ - && apt-get update \ - && apt-get install -y sudo \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ - && chmod 0440 /etc/sudoers.d/$USERNAME \ - && rm -rf /var/lib/apt/lists/* + && chmod 0440 /etc/sudoers.d/$USERNAME # Switch back to dialog for any ad-hoc use of apt-get ENV DEBIAN_FRONTEND=dialog