From d93ab8b8d7e57a445114c33661cf49c8df5016a9 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Mon, 30 Dec 2024 22:19:09 -0500 Subject: [PATCH 01/40] Create internal.windows-2025.json --- .devcontainer/internal.windows-2025.json | 591 +++++++++++++++++++++++ 1 file changed, 591 insertions(+) create mode 100644 .devcontainer/internal.windows-2025.json diff --git a/.devcontainer/internal.windows-2025.json b/.devcontainer/internal.windows-2025.json new file mode 100644 index 000000000000..59f46e88a6b9 --- /dev/null +++ b/.devcontainer/internal.windows-2025.json @@ -0,0 +1,591 @@ +{ + "NodeType": "HeaderNode", + "Title": "Windows Server 2025", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "OS Version:", + "Version": "10.0.26100 Build 2605" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Image Version:", + "Version": "20241215.1.0" + }, + { + "NodeType": "HeaderNode", + "Title": "Windows updates", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "Update Title", + "Version": "Some Update", + "TimeCreated": "2024-12-30T12:34:56Z" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Another Update", + "Version": "Another Update Version", + "TimeCreated": "2024-12-30T12:34:56Z" + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "Windows features", + "Children": { + "NodeType": "ToolVersionNode", + "ToolName": "Windows Subsystem for Linux (WSLv1):", + "Version": "Enabled" + } + }, + { + "NodeType": "HeaderNode", + "Title": "Installed Software", + "Children": [ + { + "NodeType": "HeaderNode", + "Title": "Language and Runtime", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "Bash", + "Version": "5.2.37(1)-release" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Go", + "Version": "1.23.4" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Julia", + "Version": "1.10.5" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Kotlin", + "Version": "2.1.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "LLVM", + "Version": "19.1.5" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Node", + "Version": "22.12.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Perl", + "Version": "5.40.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "PHP", + "Version": "8.3.14" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Python", + "Version": "3.9.13" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Ruby", + "Version": "3.3.6" + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "Package Management", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "Chocolatey", + "Version": "2.4.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Composer", + "Version": "2.8.4" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Helm", + "Version": "3.16.2" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Miniconda", + "Version": "24.9.2 (pre-installed on the image but not added to PATH)" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "NPM", + "Version": "10.9.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "NuGet", + "Version": "6.12.1.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "pip", + "Version": "24.3.1 (python 3.9)" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Pipx", + "Version": "1.7.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "RubyGems", + "Version": "3.5.22" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Vcpkg", + "Version": "(build from commit c26eabb23)" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Yarn", + "Version": "1.22.22" + }, + { + "NodeType": "HeaderNode", + "Title": "Environment variables", + "Children": { + "NodeType": "TableNode", + "Headers": "Name|Value", + "Rows": [ + "VCPKG_INSTALLATION_ROOT|C:\\vcpkg", + "CONDA|C:\\Miniconda" + ] + } + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "Project Management", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "Ant", + "Version": "1.10.14" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Gradle", + "Version": "8.11" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Maven", + "Version": "3.9.9" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "sbt", + "Version": "1.10.6" + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "Tools", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "7zip", + "Version": "24.09" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "aria2", + "Version": "1.37.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "azcopy", + "Version": "10.27.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Bazel", + "Version": "8.0.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Bazelisk", + "Version": "1.25.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Bicep", + "Version": "0.32.4" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Cabal", + "Version": "3.12.1.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "CMake", + "Version": "3.31.2" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "CodeQL Action Bundle", + "Version": "2.20.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Docker", + "Version": "26.1.3" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Docker Compose v2", + "Version": "2.27.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Docker-wincred", + "Version": "0.8.2" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "ghc", + "Version": "9.10.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Git", + "Version": "2.47.1.windows.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Git LFS", + "Version": "3.6.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "ImageMagick", + "Version": "7.1.1-41" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "jq", + "Version": "1.7.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Kind", + "Version": "0.25.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Kubectl", + "Version": "1.32.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "gcc", + "Version": "14.2.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "gdb", + "Version": "14.2" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "GNU Binutils", + "Version": "2.42" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Newman", + "Version": "6.2.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "OpenSSL", + "Version": "3.4.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Packer", + "Version": "1.11.2" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Pulumi", + "Version": "3.143.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "R", + "Version": "4.4.2" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Service Fabric SDK", + "Version": "10.1.2493.9590" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Stack", + "Version": "3.1.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Swig", + "Version": "4.1.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "VSWhere", + "Version": "3.1.7" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "WinAppDriver", + "Version": "1.2.2009.02003" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "WiX Toolset", + "Version": "3.14.1.8722" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "yamllint", + "Version": "1.35.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "zstd", + "Version": "1.5.6" + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "CLI Tools", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "AWS CLI", + "Version": "2.22.17" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "AWS SAM CLI", + "Version": "1.132.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "AWS Session Manager CLI", + "Version": "1.2.694.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Azure CLI", + "Version": "2.67.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Azure DevOps CLI extension", + "Version": "1.0.1" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "GitHub CLI", + "Version": "2.63.2" + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "Rust Tools", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "Cargo", + "Version": "1.83.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Rust", + "Version": "1.83.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Rustdoc", + "Version": "1.83.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Rustup", + "Version": "1.27.1" + }, + { + "NodeType": "HeaderNode", + "Title": "Packages", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "Clippy", + "Version": "0.1.83" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Rustfmt", + "Version": "1.8.0" + } + ] + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "Browsers and Drivers", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "Google Chrome", + "Version": "131.0.6778.140" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Chrome Driver", + "Version": "131.0.6778.108" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Microsoft Edge", + "Version": "131.0.2903.99" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Microsoft Edge Driver", + "Version": "131.0.2903.99" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Mozilla Firefox", + "Version": "133.0.3" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Gecko Driver", + "Version": "0.35.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "IE Driver", + "Version": "4.14.0.0" + }, + { + "NodeType": "ToolVersionNode", + "ToolName": "Selenium server", + "Version": "4.27.0" + }, + { + "NodeType": "HeaderNode", + "Title": "Environment variables", + "Children": { + "NodeType": "TableNode", + "Headers": "Name|Value", + "Rows": [ + "CHROMEWEBDRIVER|C:\\SeleniumWebDrivers\\ChromeDriver", + "EDGEWEBDRIVER|C:\\SeleniumWebDrivers\\EdgeDriver", + "GECKOWEBDRIVER|C:\\SeleniumWebDrivers\\GeckoDriver", + "SELENIUM_JAR_PATH|C:\\selenium\\selenium-server.jar" + ] + } + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "Java", + "Children": { + "NodeType": "TableNode", + "Headers": "Version|Environment Variable", + "Rows": [ + "8.0.432+6|JAVA_HOME_8_X64", + "11.0.25+9|JAVA_HOME_11_X64", + "17.0.13+11 (default)|JAVA_HOME_17_X64", + "21.0.5+11.0|JAVA_HOME_21_X64" + ] + } + }, + { + "NodeType": "HeaderNode", + "Title": "Shells", + "Children": { + "NodeType": "TableNode", + "Headers": "Name|Target", + "Rows": [ + "gitbash.exe|C:\\Program Files\\Git\\bin\\bash.exe", + "msys2bash.cmd|C:\\msys64\\usr\\bin\\bash.exe", + "wslbash.exe|C:\\Windows\\System32\\bash.exe" + ] + } + }, + { + "NodeType": "HeaderNode", + "Title": "MSYS2", + "Children": [ + { + "NodeType": "ToolVersionNode", + "ToolName": "Pacman", + "Version": "6.1.0" + }, + { + "NodeType": "HeaderNode", + "Title": "Notes", + "Children": { + "NodeType": "NoteNode", + "Content": "Location: C:\\msys64\n\nNote: MSYS2 is pre-installed on image but not added to PATH." + } + } + ] + }, + { + "NodeType": "HeaderNode", + "Title": "Cached Tools", + "Children": [ + { + "NodeType": "ToolVersionsListNode", + "ToolName": "Go", + "Versions": [ + "1.21.13", + "1.22.10", + "1.23.4" + ], + "MajorVersionRegex": "^\\d+\\.\\d+", + "ListType": "List" + }, + { + "NodeType": "ToolVersionsListNode", + "ToolName": "Node.js", + "Versions": [ + "18.20.5", + "20.18.1", + "22.12.0" + ], + "MajorVersionRegex": "^\\d+", + "ListType": "List" + }, From baa39a7b72b09463bba526c3d5350c1e3a69ed01 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Mon, 30 Dec 2024 22:24:00 -0500 Subject: [PATCH 02/40] Create devcontainer.json taking my prototype and adapting this to this environment's devcontainer --- .devcontainer/devcontainer.json | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000000..f233fdfa6f63 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,34 @@ +{ + "name": "Internal Windows Server 2025", + "build": { + "dockerfile": "Dockerfile", + "context": ".", + "args": { + "INSTALL_DEPENDENCIES": "true" + } + }, + "features": { + "ghcr.io/elanhasson/devcontainer-features/dotnet-aspire-daily:1": {}, + "ghcr.io/nikiforovall/devcontainer-features/dotnet-aspire:1": {}, + "ghcr.io/nikiforovall/devcontainer-features/dotnet-csharpier:1": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cmake-tools", + "ms-dotnettools.csharp", + "ms-vscode.cpptools", + "ms-python.python", + "ms-vscode.powershell" + ] + } + }, + "forwardPorts": [55787], + "postCreateCommand": "gcc --version && cmake . && make && ./run_tests", + "remoteUser": "root", + "mounts": [ + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" + ], + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", + "workspaceFolder": "/workspace/runner-images" +} From 1b085845eb3375a3f226cf3162bda7b50e4b62d1 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Mon, 30 Dec 2024 22:27:30 -0500 Subject: [PATCH 03/40] Create Dockerfile without exposing ports. you can add that in, but for the general case, it's omitted here. --- .devcontainer/Dockerfile | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000000..aa982ea34787 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,47 @@ +# Use the base image for C++ development +FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12 + +# Set the CMake version to reinstall if needed +ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="none" + +# Copy the script to reinstall CMake from source +COPY ./reinstall-cmake.sh /tmp/ + +# Reinstall CMake if a specific version is provided +RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \ + chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \ + fi \ + && rm -f /tmp/reinstall-cmake.sh + +# Install additional system packages for debugging +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + python3-pip \ + nodejs \ + npm \ + openjdk-17-jdk \ + gdb \ + valgrind \ + lsof \ + git \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Python setup +RUN python3 -m pip install --upgrade pip + +# Node.js setup +RUN npm install -g yarn + +# Install vcpkg if not already present +RUN git clone https://github.com/microsoft/vcpkg.git $VCPKG_INSTALLATION_ROOT \ + && cd $VCPKG_INSTALLATION_ROOT \ + && ./bootstrap-vcpkg.sh + +# Copy project files into the container +COPY . /workspace + +# Set the working directory in the container +WORKDIR /workspace + +# Default command to launch a debugging shell +CMD ["bash"] From b2d313d1b3954c262f687df2ca7347f05cf53b51 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Mon, 30 Dec 2024 22:29:13 -0500 Subject: [PATCH 04/40] Create run-runner-image.sh script for running the runner for windows 2025 using docker. --- .devcontainer/run-runner-image.sh | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .devcontainer/run-runner-image.sh diff --git a/.devcontainer/run-runner-image.sh b/.devcontainer/run-runner-image.sh new file mode 100644 index 000000000000..36f0388c5d92 --- /dev/null +++ b/.devcontainer/run-runner-image.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Script to build and run the Runner Image for Windows Server 2025 debugging + +# Variables +IMAGE_NAME="runner-images-windows-2025" +CONTAINER_NAME="runner-images-container" +DOCKERFILE_PATH="./Dockerfile" # Adjust if Dockerfile is in a different location +CONTEXT_DIR="." # Adjust if the context is a different directory +WORKSPACE_DIR="$(pwd)" # Current directory as the workspace + +# Functions +function build_image() { + echo "Building Docker image: ${IMAGE_NAME}..." + docker build -t ${IMAGE_NAME} -f ${DOCKERFILE_PATH} ${CONTEXT_DIR} +} + +function run_container() { + echo "Running Docker container: ${CONTAINER_NAME}..." + docker run -it --rm \ + --name ${CONTAINER_NAME} \ + --mount type=bind,source=${WORKSPACE_DIR},target=/workspace \ + --network none \ # Ensures no network access for isolation + ${IMAGE_NAME} +} + +function cleanup() { + echo "Cleaning up any existing container with the same name..." + docker rm -f ${CONTAINER_NAME} 2>/dev/null || true +} + +# Main execution +cleanup +build_image +run_container From a4c5e039d744f882c548cb52276f3ed5ff78e2ff Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 06:57:42 -0500 Subject: [PATCH 05/40] Update Dockerfile Robust Dockerfile for Ubunutu 24.04 and Windows 2025, updating before 1-25-2025 --- .devcontainer/Dockerfile | 53 ++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index aa982ea34787..114f53765549 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,20 +1,16 @@ -# Use the base image for C++ development -FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12 +# Use base images for C++ development +FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04 AS ubuntu-base +FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022 AS windows-base -# Set the CMake version to reinstall if needed +# Ubuntu Environment Setup +FROM ubuntu-base AS ubuntu-setup ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="none" - -# Copy the script to reinstall CMake from source COPY ./reinstall-cmake.sh /tmp/ - -# Reinstall CMake if a specific version is provided RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \ chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \ fi \ - && rm -f /tmp/reinstall-cmake.sh - -# Install additional system packages for debugging -RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && rm -f /tmp/reinstall-cmake.sh \ + && apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends \ python3-pip \ nodejs \ @@ -24,6 +20,9 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ valgrind \ lsof \ git \ + clang-18 \ + libstdc++-12-dev \ + glibc-source \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Python setup @@ -33,15 +32,39 @@ RUN python3 -m pip install --upgrade pip RUN npm install -g yarn # Install vcpkg if not already present +ENV VCPKG_INSTALLATION_ROOT=/vcpkg RUN git clone https://github.com/microsoft/vcpkg.git $VCPKG_INSTALLATION_ROOT \ && cd $VCPKG_INSTALLATION_ROOT \ && ./bootstrap-vcpkg.sh # Copy project files into the container COPY . /workspace - -# Set the working directory in the container WORKDIR /workspace - -# Default command to launch a debugging shell CMD ["bash"] + +# Windows Environment Setup +FROM windows-base AS windows-setup +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"] +RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')); \ + choco install -y \ + msys2 \ + cmake \ + clang \ + python \ + nodejs \ + git \ + jdk17 \ + visualstudio2022buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --includeRecommended" + +# Setup environment variables +ENV PATH="${PATH};C:\msys64\usr\bin;C:\Program Files\Git\cmd" + +# Install vcpkg for Windows +RUN git clone https://github.com/microsoft/vcpkg.git C:\vcpkg \ + && cd C:\vcpkg \ + && .\bootstrap-vcpkg.bat + +# Copy project files into the container +COPY . C:\workspace +WORKDIR C:\workspace +CMD ["powershell"] From bf9af96399de6c56d2cd65505e05a99703720b8c Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 06:59:16 -0500 Subject: [PATCH 06/40] Create Clangfile.json CLang CLang went the trolley --- .devcontainer/Clangfile.json | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .devcontainer/Clangfile.json diff --git a/.devcontainer/Clangfile.json b/.devcontainer/Clangfile.json new file mode 100644 index 000000000000..8ae87613cd18 --- /dev/null +++ b/.devcontainer/Clangfile.json @@ -0,0 +1,35 @@ +{ + "version": "2025", + "clang_versions": { + "default": "18.0.0", + "supported": ["14.0.0", "16.0.0", "18.0.0"] + }, + "toolchain": { + "compiler": "clang++", + "options": { + "optimization": "-O2", + "warnings": "-Wall", + "standard": "c++20" + } + }, + "tasks": [ + { + "name": "Build Project", + "command": "clang++ -O2 -Wall -std=c++20 main.cpp -o main" + }, + { + "name": "Run Tests", + "command": "./test_suite --run" + } + ], + "dependencies": [ + { + "name": "libstdc++", + "version": ">=12.0" + }, + { + "name": "glibc", + "version": ">=2.31" + } + ] +} From 332f9ed0cd360b40b3f4fac9c87851021f2d54a9 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 07:03:44 -0500 Subject: [PATCH 07/40] Update devcontainer.json CI/CL pipeline, engaged. --- .devcontainer/devcontainer.json | 64 ++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index f233fdfa6f63..a2ab8f942dbb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,32 +1,40 @@ { - "name": "Internal Windows Server 2025", - "build": { - "dockerfile": "Dockerfile", - "context": ".", - "args": { - "INSTALL_DEPENDENCIES": "true" - } - }, - "features": { - "ghcr.io/elanhasson/devcontainer-features/dotnet-aspire-daily:1": {}, - "ghcr.io/nikiforovall/devcontainer-features/dotnet-aspire:1": {}, - "ghcr.io/nikiforovall/devcontainer-features/dotnet-csharpier:1": {} - }, - "customizations": { - "vscode": { - "extensions": [ - "ms-vscode.cmake-tools", - "ms-dotnettools.csharp", - "ms-vscode.cpptools", - "ms-python.python", - "ms-vscode.powershell" - ] - } - }, - "forwardPorts": [55787], - "postCreateCommand": "gcc --version && cmake . && make && ./run_tests", - "remoteUser": "root", - "mounts": [ + "name": "Multi-Platform CI/CD Development", + "build": { + "dockerfile": "Dockerfile", + "context": ".", + "args": { + "INSTALL_DEPENDENCIES": "true", + "REINSTALL_CMAKE_VERSION_FROM_SOURCE": "none" + } + }, + "features": { + "ghcr.io/elanhasson/devcontainer-features/dotnet-aspire-daily:1": {}, + "ghcr.io/nikiforovall/devcontainer-features/dotnet-aspire:1": {}, + "ghcr.io/nikiforovall/devcontainer-features/dotnet-csharpier:1": {} + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cmake-tools", + "ms-dotnettools.csharp", + "ms-vscode.cpptools", + "ms-python.python", + "ms-vscode.powershell", + "github.vscode-github-actions" + ] + } + }, + "forwardPorts": [55787], + "postCreateCommand": "gcc --version && cmake . && make && ./run_tests", + "remoteUser": "root", + "mounts": [ + "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" + ], + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", + "workspaceFolder": "/workspace/runner-images", + "initializeCommand": "PORT=$(shuf -i 55000-55999 -n 1) && echo $PORT" +} "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ], "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", From cbf6635311a9fd2f408fdb93b6f3e7d94c1a21d5 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 07:10:15 -0500 Subject: [PATCH 08/40] Update internal.windows-2025.json --- .devcontainer/internal.windows-2025.json | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.devcontainer/internal.windows-2025.json b/.devcontainer/internal.windows-2025.json index 59f46e88a6b9..6b075fb5c5b6 100644 --- a/.devcontainer/internal.windows-2025.json +++ b/.devcontainer/internal.windows-2025.json @@ -573,6 +573,7 @@ "Versions": [ "1.21.13", "1.22.10", + "1.23.10", "1.23.4" ], "MajorVersionRegex": "^\\d+\\.\\d+", @@ -589,3 +590,22 @@ "MajorVersionRegex": "^\\d+", "ListType": "List" }, + + }, + { + "NodeType": "ToolVersionsListNode", + "ToolName": "Node.js", + "Versions": [ + "18.20.5", + "20.18.1", + "22.12.0" + ], + "MajorVersionRegex": "^\\d+", + "ListType": "List" + } + ] + } + ] + } + ] + From 73a39ad338f632ed5ac4a624da7af6d28f2811c2 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 07:13:36 -0500 Subject: [PATCH 09/40] Update devcontainer.json --- .devcontainer/devcontainer.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a2ab8f942dbb..da397c8e8a74 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -34,9 +34,4 @@ "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", "workspaceFolder": "/workspace/runner-images", "initializeCommand": "PORT=$(shuf -i 55000-55999 -n 1) && echo $PORT" -} - "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" - ], - "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,consistency=cached", - "workspaceFolder": "/workspace/runner-images" } From 2c9104ffb2fbb58f0cf357b330a97f6e67271902 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 07:16:09 -0500 Subject: [PATCH 10/40] internal.ubuntu.24.04.json --- .devcontainer/nternal.ubuntu.24.04.json | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .devcontainer/nternal.ubuntu.24.04.json diff --git a/.devcontainer/nternal.ubuntu.24.04.json b/.devcontainer/nternal.ubuntu.24.04.json new file mode 100644 index 000000000000..610f096fe7a5 --- /dev/null +++ b/.devcontainer/nternal.ubuntu.24.04.json @@ -0,0 +1,37 @@ +{ + "os": { + "name": "Ubuntu", + "version": "24.04", + "base_image": "ubuntu:24.04" + }, + "packages": { + "preinstalled": [ + "clang-18", + "python3.12", + "nodejs-20", + "libsdl2-dev", + "astyle", + "ccache" + ], + "removed": [ + "terraform", + "mono" + ] + }, + "toolchains": [ + { + "name": "clang", + "version": "18.0.0", + "path": "/usr/bin/clang" + }, + { + "name": "gcc", + "version": "14.0.0", + "path": "/usr/bin/gcc" + } + ], + "compatibility": { + "preferred_lts": "22.04", + "notes": "Transitioning to 24.04 image. Recommended to update dependencies." + } +} From 566fd1ff1008c3b68c1e381b875ad988407de23a Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 07:25:39 -0500 Subject: [PATCH 11/40] Update run-runner-image.sh Updates the ISO to create both WIndows 2025 toolkit devcontainer and also ISO for ubunutu 24.04 2025 toolkit, and makes .devcontainer the root file directory for the update. Sorry Mac users, you're on your own until Tim Cook decides to come in and help out. --- .devcontainer/run-runner-image.sh | 76 ++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 16 deletions(-) diff --git a/.devcontainer/run-runner-image.sh b/.devcontainer/run-runner-image.sh index 36f0388c5d92..989853c5218b 100644 --- a/.devcontainer/run-runner-image.sh +++ b/.devcontainer/run-runner-image.sh @@ -1,35 +1,79 @@ #!/bin/bash -# Script to build and run the Runner Image for Windows Server 2025 debugging +# Script to build and run Runner Images for Ubuntu 24.04 and Windows Server 2025 debugging +# with Clang setup # Variables -IMAGE_NAME="runner-images-windows-2025" +UBUNTU_IMAGE_NAME="runner-images-ubuntu-24.04" +WINDOWS_IMAGE_NAME="runner-images-windows-2025" CONTAINER_NAME="runner-images-container" -DOCKERFILE_PATH="./Dockerfile" # Adjust if Dockerfile is in a different location +UBUNTU_DOCKERFILE_PATH="./Dockerfile.ubuntu" # Adjust if Dockerfile for Ubuntu is in a different location +WINDOWS_DOCKERFILE_PATH="./Dockerfile.windows" # Adjust if Dockerfile for Windows is in a different location CONTEXT_DIR="." # Adjust if the context is a different directory WORKSPACE_DIR="$(pwd)" # Current directory as the workspace +UBUNTU_CLANGFILE_PATH="clangfile.ubuntu.json" +WINDOWS_CLANGFILE_PATH="clangfile.windows.json" +LOG_FILE="runner-images-build.log" # Functions -function build_image() { - echo "Building Docker image: ${IMAGE_NAME}..." - docker build -t ${IMAGE_NAME} -f ${DOCKERFILE_PATH} ${CONTEXT_DIR} + +# Cleanup Function +cleanup() { + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Cleaning up any existing container with the same name..." + if docker rm -f ${CONTAINER_NAME} 2>/dev/null; then + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Container ${CONTAINER_NAME} successfully removed." + else + echo "[$(date +'%Y-%m-%d %H:%M:%S')] No container named ${CONTAINER_NAME} found or removal failed." + fi +} + +# Build Image Function +build_image() { + local image_name="$1" + local dockerfile_path="$2" + local clangfile_path="$3" + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Building Docker image: ${image_name}..." + if docker build -t ${image_name} -f ${dockerfile_path} --build-arg CLANGFILE=${clangfile_path} ${CONTEXT_DIR} | tee -a ${LOG_FILE}; then + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Docker image ${image_name} built successfully." + else + echo "[$(date +'%Y-%m-%d %H:%M:%S')] ERROR: Docker image build for ${image_name} failed. Check ${LOG_FILE} for details." + exit 1 + fi } -function run_container() { - echo "Running Docker container: ${CONTAINER_NAME}..." +# Run Container Function +run_container() { + local image_name="$1" + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Running Docker container: ${CONTAINER_NAME} for ${image_name}..." docker run -it --rm \ --name ${CONTAINER_NAME} \ --mount type=bind,source=${WORKSPACE_DIR},target=/workspace \ --network none \ # Ensures no network access for isolation - ${IMAGE_NAME} + ${image_name} + if [ $? -eq 0 ]; then + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Container ${CONTAINER_NAME} for ${image_name} ran successfully." + else + echo "[$(date +'%Y-%m-%d %H:%M:%S')] ERROR: Failed to run container ${CONTAINER_NAME} for ${image_name}." + exit 1 + fi } -function cleanup() { - echo "Cleaning up any existing container with the same name..." - docker rm -f ${CONTAINER_NAME} 2>/dev/null || true -} +# Main Execution Workflow +echo "[$(date +'%Y-%m-%d %H:%M:%S')] Starting Runner Image Setup for Ubuntu 24.04 and Windows Server 2025 with Clang configurations..." -# Main execution +# Clean up any previous runs cleanup -build_image -run_container + +# Build the Ubuntu Docker image with Clang configuration +build_image ${UBUNTU_IMAGE_NAME} ${UBUNTU_DOCKERFILE_PATH} ${UBUNTU_CLANGFILE_PATH} + +# Run the Ubuntu container +run_container ${UBUNTU_IMAGE_NAME} + +# Build the Windows Docker image with Clang configuration +build_image ${WINDOWS_IMAGE_NAME} ${WINDOWS_DOCKERFILE_PATH} ${WINDOWS_CLANGFILE_PATH} + +# Run the Windows container +run_container ${WINDOWS_IMAGE_NAME} + +echo "[$(date +'%Y-%m-%d %H:%M:%S')] Runner Image Setup for both Ubuntu 24.04 and Windows Server 2025 with Clang configurations completed." From 09df9f84abf9aa079176165da9163cb464e4742b Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 14:24:11 -0500 Subject: [PATCH 12/40] indentation correction --- images/ubuntu/scripts/build/install-azure-devops-cli.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/ubuntu/scripts/build/install-azure-devops-cli.sh b/images/ubuntu/scripts/build/install-azure-devops-cli.sh index 81948ac95440..015bdba145e1 100644 --- a/images/ubuntu/scripts/build/install-azure-devops-cli.sh +++ b/images/ubuntu/scripts/build/install-azure-devops-cli.sh @@ -1,7 +1,8 @@ #!/bin/bash -e ################################################################################ ## File: install-azure-devops-cli.sh -## Desc: Install Azure DevOps CLI (az devops) +## Desc: + Install Azure DevOps CLI (az devops) ################################################################################ # Source the helpers for use with the script From 43c92983510cceab4db2d87d0bbcdb188e4fa2c1 Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 18:39:27 -0500 Subject: [PATCH 13/40] Update Dockerfile Fixed the pester test issue thanks to an actual collaborative person who was using copilot --- .devcontainer/Dockerfile | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 114f53765549..7c823fe53eef 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,3 +1,60 @@ +# Use the base image for C++ development +FROM mcr.microsoft.com/devcontainers/cpp:1-debian-12 + +# Set the CMake version to reinstall if needed +ARG REINSTALL_CMAKE_VERSION_FROM_SOURCE="none" + +# Copy the script to reinstall CMake from source +COPY ./reinstall-cmake.sh /tmp/ + +# Run the script to reinstall CMake if specified +RUN if [ "${REINSTALL_CMAKE_VERSION_FROM_SOURCE}" != "none" ]; then \ + chmod +x /tmp/reinstall-cmake.sh && /tmp/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE}; \ + fi \ + && rm -f /tmp/reinstall-cmake.sh + +# [Optional] Install additional vcpkg ports +# RUN su vscode -c "${VCPKG_ROOT}/vcpkg install " + +# [Optional] Install additional packages +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + +# Set environment variables for your project +ENV VCPKG_INSTALLATION_ROOT /usr/local/vcpkg +ENV JAVA_HOME_17_X64 /usr/lib/jvm/java-17-openjdk-amd64 +# Add more environment variables as needed + +# Install necessary software +# Note: Since this is a Debian-based image, we'll use apt for package management +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends \ + python3-pip \ + nodejs \ + npm \ + openjdk-17-jdk \ + git \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Python setup +RUN python3 -m pip install --upgrade pip + +# Node.js setup +RUN npm install -g yarn + +# Install vcpkg if not already present (assuming it's not in the base image) +RUN git clone https://github.com/microsoft/vcpkg.git $VCPKG_INSTALLATION_ROOT \ + && cd $VCPKG_INSTALLATION_ROOT \ + && ./bootstrap-vcpkg.sh + +# Copy project files into the container +COPY . /workspace + +# Set the working directory in the container +WORKDIR /workspace + +# Default command when container starts +CMD ["bash"] # Use base images for C++ development FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-24.04 AS ubuntu-base FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2022 AS windows-base @@ -68,3 +125,9 @@ RUN git clone https://github.com/microsoft/vcpkg.git C:\vcpkg \ COPY . C:\workspace WORKDIR C:\workspace CMD ["powershell"] + +Describe "WSL2" { + It "WSL status should return zero exit code" { + "wsl --status" | Should -ReturnZeroExitCode + } +} From b3b880504b894efeaf8199481d309240b37758de Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 18:42:38 -0500 Subject: [PATCH 14/40] Update run-runner-image.sh done --- .devcontainer/run-runner-image.sh | 62 ++++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/.devcontainer/run-runner-image.sh b/.devcontainer/run-runner-image.sh index 989853c5218b..ac9f47e4c080 100644 --- a/.devcontainer/run-runner-image.sh +++ b/.devcontainer/run-runner-image.sh @@ -1,3 +1,63 @@ +#!/usr/bin/env bash +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- +# +set -e + +CMAKE_VERSION=${1:-"none"} + +if [ "${CMAKE_VERSION}" = "none" ]; then + echo "No CMake version specified, skipping CMake reinstallation" + exit 0 +fi + +# Cleanup temporary directory and associated files when exiting the script. +cleanup() { + EXIT_CODE=$? + set +e + if [[ -n "${TMP_DIR}" ]]; then + echo "Executing cleanup of tmp files" + rm -Rf "${TMP_DIR}" + fi + exit $EXIT_CODE +} +trap cleanup EXIT + + +echo "Installing CMake..." +apt-get -y purge --auto-remove cmake +mkdir -p /opt/cmake + +architecture=$(dpkg --print-architecture) +case "${architecture}" in + arm64) + ARCH=aarch64 ;; + amd64) + ARCH=x86_64 ;; + *) + echo "Unsupported architecture ${architecture}." + exit 1 + ;; +esac + +CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh" +CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt" +TMP_DIR=$(mktemp -d -t cmake-XXXXXXXXXX) + +echo "${TMP_DIR}" +cd "${TMP_DIR}" + +curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O +curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O + +sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_NAME}" +sh "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license + +ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake +ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest + #!/bin/bash # Script to build and run Runner Images for Ubuntu 24.04 and Windows Server 2025 debugging @@ -76,4 +136,4 @@ build_image ${WINDOWS_IMAGE_NAME} ${WINDOWS_DOCKERFILE_PATH} ${WINDOWS_CLANGFILE # Run the Windows container run_container ${WINDOWS_IMAGE_NAME} -echo "[$(date +'%Y-%m-%d %H:%M:%S')] Runner Image Setup for both Ubuntu 24.04 and Windows Server 2025 with Clang configurations completed." +echo "[$(date +'%Y-%m-%d %H:%M:%S')] Runner Image Setup for both Ubuntu 24.04 and Windows Server 2025 with Clang configurations completed. From e9c6a6415f0217289b654f96a724ae0f1940380e Mon Sep 17 00:00:00 2001 From: Josef Kurk Edwards Date: Thu, 2 Jan 2025 19:01:31 -0500 Subject: [PATCH 15/40] Create e.sh --- e.sh | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 e.sh diff --git a/e.sh b/e.sh new file mode 100644 index 000000000000..8c15c110afb1 --- /dev/null +++ b/e.sh @@ -0,0 +1,139 @@ +#!/usr/bin/env bash +#------------------------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. +#------------------------------------------------------------------------------------------------------------- +# +set -e + +CMAKE_VERSION=${1:-"none"} + +if [ "${CMAKE_VERSION}" = "none" ]; then + echo "No CMake version specified, skipping CMake reinstallation" + exit 0 +fi + +# Cleanup temporary directory and associated files when exiting the script. +cleanup() { + EXIT_CODE=$? + set +e + if [[ -n "${TMP_DIR}" ]]; then + echo "Executing cleanup of tmp files" + rm -Rf "${TMP_DIR}" + fi + exit $EXIT_CODE +} +trap cleanup EXIT + + +echo "Installing CMake..." +apt-get -y purge --auto-remove cmake +mkdir -p /opt/cmake + +architecture=$(dpkg --print-architecture) +case "${architecture}" in + arm64) + ARCH=aarch64 ;; + amd64) + ARCH=x86_64 ;; + *) + echo "Unsupported architecture ${architecture}." + exit 1 + ;; +esac + +CMAKE_BINARY_NAME="cmake-${CMAKE_VERSION}-linux-${ARCH}.sh" +CMAKE_CHECKSUM_NAME="cmake-${CMAKE_VERSION}-SHA-256.txt" +TMP_DIR=$(mktemp -d -t cmake-XXXXXXXXXX) + +echo "${TMP_DIR}" +cd "${TMP_DIR}" + +curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_BINARY_NAME}" -O +curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_CHECKSUM_NAME}" -O + +sha256sum -c --ignore-missing "${CMAKE_CHECKSUM_NAME}" +sh "${TMP_DIR}/${CMAKE_BINARY_NAME}" --prefix=/opt/cmake --skip-license + +ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake +ln -s /opt/cmake/bin/ctest /usr/local/bin/ctest + +#!/bin/bash + +# Script to build and run Runner Images for Ubuntu 24.04 and Windows Server 2025 debugging +# with Clang setup + +# Variables +UBUNTU_IMAGE_NAME="runner-images-ubuntu-24.04" +WINDOWS_IMAGE_NAME="runner-images-windows-2025" +CONTAINER_NAME="runner-images-container" +UBUNTU_DOCKERFILE_PATH="./Dockerfile.ubuntu" # Adjust if Dockerfile for Ubuntu is in a different location +WINDOWS_DOCKERFILE_PATH="./Dockerfile.windows" # Adjust if Dockerfile for Windows is in a different location +CONTEXT_DIR="." # Adjust if the context is a different directory +WORKSPACE_DIR="$(pwd)" # Current directory as the workspace +UBUNTU_CLANGFILE_PATH="clangfile.ubuntu.json" +WINDOWS_CLANGFILE_PATH="clangfile.windows.json" +LOG_FILE="runner-images-build.log" + +# Functions + +# Cleanup Function +cleanup() { + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Cleaning up any existing container with the same name..." + if docker rm -f ${CONTAINER_NAME} 2>/dev/null; then + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Container ${CONTAINER_NAME} successfully removed." + else + echo "[$(date +'%Y-%m-%d %H:%M:%S')] No container named ${CONTAINER_NAME} found or removal failed." + fi +} + +# Build Image Function +build_image() { + local image_name="$1" + local dockerfile_path="$2" + local clangfile_path="$3" + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Building Docker image: ${image_name}..." + if docker build -t ${image_name} -f ${dockerfile_path} --build-arg CLANGFILE=${clangfile_path} ${CONTEXT_DIR} | tee -a ${LOG_FILE}; then + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Docker image ${image_name} built successfully." + else + echo "[$(date +'%Y-%m-%d %H:%M:%S')] ERROR: Docker image build for ${image_name} failed. Check ${LOG_FILE} for details." + exit 1 + fi +} + +# Run Container Function +run_container() { + local image_name="$1" + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Running Docker container: ${CONTAINER_NAME} for ${image_name}..." + docker run -it --rm \ + --name ${CONTAINER_NAME} \ + --mount type=bind,source=${WORKSPACE_DIR},target=/workspace \ + --network none \ # Ensures no network access for isolation + ${image_name} + if [ $? -eq 0 ]; then + echo "[$(date +'%Y-%m-%d %H:%M:%S')] Container ${CONTAINER_NAME} for ${image_name} ran successfully." + else + echo "[$(date +'%Y-%m-%d %H:%M:%S')] ERROR: Failed to run container ${CONTAINER_NAME} for ${image_name}." + exit 1 + fi +} + +# Main Execution Workflow +echo "[$(date +'%Y-%m-%d %H:%M:%S')] Starting Runner Image Setup for Ubuntu 24.04 and Windows Server 2025 with Clang configurations..." + +# Clean up any previous runs +cleanup + +# Build the Ubuntu Docker image with Clang configuration +build_image ${UBUNTU_IMAGE_NAME} ${UBUNTU_DOCKERFILE_PATH} ${UBUNTU_CLANGFILE_PATH} + +# Run the Ubuntu container +run_container ${UBUNTU_IMAGE_NAME} + +# Build the Windows Docker image with Clang configuration +build_image ${WINDOWS_IMAGE_NAME} ${WINDOWS_DOCKERFILE_PATH} ${WINDOWS_CLANGFILE_PATH} + +# Run the Windows container +run_container ${WINDOWS_IMAGE_NAME} + +echo "[$(date +'%Y-%m-%d %H:%M:%S')] Runner Image Setup for both Ubuntu 24.04 and Windows Server 2025 with Clang configurations completed." From eb108c2ac00b0d6f3eafe6d5fea252671fb38796 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 11:27:03 -0500 Subject: [PATCH 16/40] Create rabbit_emulation.py emulation of rabbit.yml --- .devcontainer/rabbit_emulation.py | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .devcontainer/rabbit_emulation.py diff --git a/.devcontainer/rabbit_emulation.py b/.devcontainer/rabbit_emulation.py new file mode 100644 index 000000000000..9efdb73b6253 --- /dev/null +++ b/.devcontainer/rabbit_emulation.py @@ -0,0 +1,71 @@ +import subprocess +import time +import os + +# Helper Functions +def run_command(command, description): + """Run a shell command and log the output.""" + print(f"\n=== {description} ===") + print(f"Running: {command}") + try: + result = subprocess.run(command, shell=True, capture_output=True, text=True, check=True) + print(result.stdout) + return result.stdout + except subprocess.CalledProcessError as e: + print(e.stderr) + raise + +def log_step(step): + """Log a step in the emulation.""" + print(f"\n--- Step: {step} ---") + +# Emulation Starts Here +try: + log_step("Initialize CI/CD Workflow") + + # Step 1: Clone Repository + repo_url = "https://github.com/bearycool11/RabbitProtocol.git" + run_command(f"git clone {repo_url} RabbitProtocol", "Clone Repository") + + os.chdir("RabbitProtocol") # Change to the repo directory + + # Step 2: Install Dependencies + run_command("go mod tidy && go mod vendor", "Install Dependencies for RabbitProtocol") + run_command("sudo apt-get install -y docker.io clang", "Install Docker and Clang") + + # Step 3: Build Components + run_command("clang ./cmd/main.go -o rabbit_protocol_clang", "Build Rabbit Protocol Components") + run_command("gcc brain.c -o modular_brain_executable", "Build Modular Brain Component") + run_command("gcc pml_logic_loop.c -o logic_module", "Build Logic Module") + + # Step 4: Run Tests + run_command("./modular_brain_executable --test", "Run Tests for Modular Brain") + run_command("./logic_module --run-tests", "Run Tests for Logic Module") + run_command("docker build -t rabbit_protocol ./docker_context", "Build Docker Image for RabbitProtocol") + + # Step 5: Scan for Rogue Code + run_command("grep -r 'pesterbot' ./cmd || echo 'No rogue code found'", "Scan for Rogue Code") + run_command("sed -i '/pesterbot/d' ./cmd/main.go", "Remove Rogue Code") + + # Step 6: Integrate Azure PMLL + run_command( + "az login --service-principal --username $AZURE_USER --password $AZURE_PASSWORD --tenant $AZURE_TENANT", + "Login to Azure" + ) + run_command( + "az cosmosdb create --name ModularBrainDB --resource-group ModularBrain --locations regionName=EastUS", + "Create Azure CosmosDB" + ) + + # Step 7: Package and Deploy + run_command("docker build -t modular_brain_toolbelt:latest .", "Build Docker Image for Toolbelt") + run_command("docker push modular_brain_toolbelt:latest", "Push Docker Image to Registry") + + # Step 8: Clean Up + run_command("docker image prune -f && docker container prune -f", "Clean Up Unused Docker Resources") + run_command("rm -rf ./builds", "Clean Up Build Artifacts") + + log_step("Workflow Emulation Complete!") + +except Exception as e: + print(f"An error occurred during the emulation: {e}") From 0d590df82b3c540cf0dec9c7f451c57802a395f0 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 11:31:48 -0500 Subject: [PATCH 17/40] Create Broadcastingrabbit.yml .echo rabbit --- .devcontainer/Broadcastingrabbit.yml | 288 +++++++++++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 .devcontainer/Broadcastingrabbit.yml diff --git a/.devcontainer/Broadcastingrabbit.yml b/.devcontainer/Broadcastingrabbit.yml new file mode 100644 index 000000000000..84811d4f863d --- /dev/null +++ b/.devcontainer/Broadcastingrabbit.yml @@ -0,0 +1,288 @@ +name: BroadcastingRabbitEmulation-CI/CD + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + setup-environment: + name: Setup Environment + runs-on: ubuntu-latest + + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + + - name: 🐇 Install Dependencies + run: | + sudo apt update + sudo apt install -y docker.io clang python3-pip + pip3 install blockcypher + + build-protocol: + name: Build Rabbit Protocol + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + + - name: 🐇 Setup Environment + run: | + if [[ $RUNNER_OS == "Windows" ]]; then + choco install golang docker + else + sudo apt install -y docker.io clang + go mod tidy + + - name: 🐇 Build Rabbit Protocol + run: clang ./cmd/main.go -o rabbit_protocol_${{ matrix.os }} + + - name: 🐇 Save Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: build-artifacts + path: rabbit_protocol_${{ matrix.os }} + + broadcast-emulation: + name: Simulate Broadcasting and Emulation + runs-on: ubuntu-latest + needs: [setup-environment, build-protocol] + + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + + - name: 🐇 Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifacts + + - name: 🐇 Emulate Broadcasting + run: | + echo "Starting Rabbit Protocol Emulation..." + python3 < pesterbot_scan.log + + - name: 🐇 Log Pesterbot Issues + run: | + echo "Logging pesterbot issues..." + if grep -q "pesterbot" pesterbot_scan.log; then + echo "Pesterbot code found!" >> pesterbot_scan.log + else + echo "No rogue code found." >> pesterbot_scan.log + + - name: 🐇 Upload Pesterbot Logs + uses: actions/upload-artifact@v3 + with: + name: pesterbot-scan-log + path: pesterbot_scan.log + + broadcast-emulation: + name: Simulate Broadcasting and Emulation + runs-on: ubuntu-latest + needs: [setup-environment, build-protocol, pesterbot-scan] + + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + + - name: 🐇 Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: build-artifacts + + - name: 🐇 Emulate Broadcasting + run: | + echo "Starting Rabbit Protocol Emulation..." + python3 <> bugzap.log + else + echo "No errors found in broadcast." >> bugzap.log + + - name: 🐇 Upload BugZap Logs + uses: actions/upload-artifact@v3 + with: + name: bugzap-log + path: bugzap.log + + validate-results: + name: Validate Emulation Results + runs-on: ubuntu-latest + needs: bugzap-validation + + steps: + - name: 🐇 Check Logs + run: | + echo "Checking broadcast logs..." + cat ./broadcast.log || echo "No logs found." + + - name: 🐇 Validate Results + run: | + echo "Validating results..." + if grep -q "Broadcast response" broadcast.log; then + echo "Broadcast successful!" + else + echo "Broadcast failed. Check logs." + From 6f482041c0a629cd5fef3ee3eedc38e487970ef9 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 11:34:15 -0500 Subject: [PATCH 18/40] Create Sequoiarabbit.yml --- .devcontainer/Sequoiarabbit.yml | 226 ++++++++++++++++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 .devcontainer/Sequoiarabbit.yml diff --git a/.devcontainer/Sequoiarabbit.yml b/.devcontainer/Sequoiarabbit.yml new file mode 100644 index 000000000000..2a05ede947b6 --- /dev/null +++ b/.devcontainer/Sequoiarabbit.yml @@ -0,0 +1,226 @@ +@@ -0,0 +1,251 @@ +name: RabbitProtocol-CI/CD +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + rabbit-build: + name: 🛠️ Build the Rabbit Protocol + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-2025, macos-15] + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + - name: 🐇 Setup Environment + run: | + if [[ "${{ matrix.os }}" == "windows-2025" ]]; then + choco install -y golang docker-desktop + powershell Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -OutFile install-docker-ce.ps1 + powershell .\install-docker-ce.ps1 + elif [[ "${{ matrix.os }}" == "macos-15" ]]; then + brew install go docker + else + sudo apt-get update + sudo apt-get install -y docker.io clang + - name: 🐇 Install Dependencies + run: | + go mod tidy + go mod vendor + - name: 🐇 Build Docker and Clang ISOs + if: ${{ matrix.os == 'ubuntu-latest' }} + run: | + mkdir -p iso_mount + dd if=/dev/zero of=docker_iso.img bs=1M count=1024 + mkfs.ext4 docker_iso.img + dd if=/dev/zero of=clang_iso.img bs=1M count=1024 + mkfs.ext4 clang_iso.img + - name: 🐇 Build the Rabbit Protocol + run: | + if [[ "${{ matrix.os }}" == "windows-2025" ]]; then + powershell clang ./cmd/main.go -o rabbit_protocol_clang.exe + else + clang ./cmd/main.go -o rabbit_protocol_clang + - name: 🐇 Save Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: rabbit_protocol_${{ matrix.os }} + path: | + rabbit_protocol_clang + docker_iso.img + clang_iso.img + rabbit-run: + name: 🚀 Run the Rabbit Protocol + runs-on: ${{ matrix.os }} + needs: rabbit-build + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + - name: 🐇 Run Docker and Clang Tests + run: | + if [[ "${{ matrix.os }}" == "windows-2025" ]]; then + powershell docker run --rm -v $(pwd):/usr/src/app -w /usr/src/app docker_iso_tool rabbit_protocol_clang.exe + else + docker run --rm -v $(pwd):/usr/src/app -w /usr/src/app docker_iso_tool ./rabbit_protocol_clang + bugzap-pesterbot: + name: 🐇 BugZap PesterBot + runs-on: ubuntu-latest + needs: rabbit-run + steps: + - name: 🐇 Scan for Rogue Code + run: | + echo "Scanning for pesterbot code..." + grep -r "pesterbot" ./cmd || echo "No pesterbot found!" + - name: 🐇 Fix and Remove Bugs + run: | + sed -i '/pesterbot/d' ./cmd/main.go + package-toolbelt: + name: 📦 Package Toolbelt/Kit + runs-on: ubuntu-latest + needs: bugzap-pesterbot + steps: + - name: 🐇 Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: rabbit_protocol_${{ matrix.os }} + path: ./builds + - name: 🐇 Create Container Image + run: | + mkdir -p container + mv ./builds/* ./container/ + docker build -t rabbit_toolbelt:latest ./container + - name: 🐇 Push Container to Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - run: | + docker tag rabbit_toolbelt:latest ghcr.io/${{ github.repository }}/rabbit_toolbelt:latest + docker push ghcr.io/${{ github.repository }}/rabbit_toolbelt:latest +name: RabbitProtocol-CI/CD +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + rabbit-build: + name: 🛠️ Build the Rabbit Protocol + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-24.04, windows-2025, macos-15, ios-latest, android-latest] + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + - name: 🐇 Setup Environment + run: | + if [[ "${{ matrix.os }}" == "windows-2025" ]]; then + choco install -y golang docker-desktop + powershell Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -OutFile install-docker-ce.ps1 + powershell .\install-docker-ce.ps1 + elif [[ "${{ matrix.os }}" == "macos-15" ]]; then + brew install go docker + elif [[ "${{ matrix.os }}" == "ios-latest" ]]; then + gem install cocoapods + brew install go + elif [[ "${{ matrix.os }}" == "android-latest" ]]; then + sudo apt-get install -y android-sdk-go + else + sudo apt-get update + sudo apt-get install -y docker.io clang + - name: 🐇 Install Dependencies + run: | + go mod tidy + go mod vendor + - name: 🐇 Build for Specific Platform + run: | + if [[ "${{ matrix.os }}" == "ios-latest" ]]; then + xcodebuild -scheme RabbitProtocol -sdk iphoneos + elif [[ "${{ matrix.os }}" == "android-latest" ]]; then + ./gradlew build + else + clang ./cmd/main.go -o rabbit_protocol_clang + - name: 🐇 Save Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: rabbit_protocol_${{ matrix.os }} + path: | + rabbit_protocol_clang + ios_build + android_build + rabbit-run: + name: 🚀 Run the Rabbit Protocol + runs-on: ${{ matrix.os }} + needs: rabbit-build + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + - name: 🐇 Run Tests on Specific Platforms + run: | + if [[ "${{ matrix.os }}" == "ios-latest" ]]; then + xcodebuild test -scheme RabbitProtocol -sdk iphoneos + elif [[ "${{ matrix.os }}" == "android-latest" ]]; then + ./gradlew test + else + docker run --rm -v $(pwd):/usr/src/app -w /usr/src/app docker_iso_tool ./rabbit_protocol_clang + bugzap-pesterbot: + name: 🐇 BugZap PesterBot + runs-on: ubuntu-latest + needs: rabbit-run + steps: + - name: 🐇 Scan for Rogue Code + run: | + echo "Scanning for pesterbot code..." + grep -r "pesterbot" ./cmd || echo "No pesterbot found!" + - name: 🐇 Fix and Remove Bugs + run: | + sed -i '/pesterbot/d' ./cmd/main.go + azure-pmll: + name: 🚀 Azure PMLL Integration + runs-on: ubuntu-latest + needs: bugzap-pesterbot + steps: + - name: 🐇 Set Up Azure PMLL + run: | + az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }} + az pmll create --name RabbitProtocolDB --tier Premium --size 15GB --region eastus + - name: 🐇 Run Azure PMLL Tests + run: | + az pmll test --name RabbitProtocolDB + package-toolbelt: + name: 📦 Package Toolbelt/Kit + runs-on: ubuntu-latest + needs: azure-pmll + steps: + - name: 🐇 Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: rabbit_protocol_${{ matrix.os }} + path: ./builds + - name: 🐇 Create Container Image + run: | + mkdir -p container + mv ./builds/* ./container/ + docker build -t rabbit_toolbelt:latest ./container + - name: 🐇 Push Container to Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - run: | + docker tag rabbit_toolbelt:latest ghcr.io/${{ github.repository }}/rabbit_toolbelt:latest + docker push ghcr.io/${{ github.repository }}/rabbit_toolbelt:latest +0 commit comments +Comments +0 + (0) From b32945d7404d07428fe3e6f8d00b8276c72f44e8 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 11:36:32 -0500 Subject: [PATCH 19/40] Create Rabbit.yml --- .devcontainer/Rabbit.yml | 121 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 .devcontainer/Rabbit.yml diff --git a/.devcontainer/Rabbit.yml b/.devcontainer/Rabbit.yml new file mode 100644 index 000000000000..5a6413283d71 --- /dev/null +++ b/.devcontainer/Rabbit.yml @@ -0,0 +1,121 @@ +name: RabbitProtocol-CI/CD + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + rabbit-build: + name: 🛠️ Build the Rabbit Protocol + runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-24.04, windows-2025, macos-2025] + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + + - name: 🐇 Setup Go Environment + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: 🐇 Install Dependencies + run: | + go mod tidy + go mod vendor + + - name: 🐇 Install Docker and Clang + run: | + sudo apt-get update + sudo apt-get install -y docker.io clang + + - name: 🐇 Build Docker and Clang ISOs + run: | + mkdir -p iso_mount + echo "Building Docker ISO..." + dd if=/dev/zero of=docker_iso.img bs=1M count=1024 + mkfs.ext4 docker_iso.img + echo "Building Clang ISO..." + dd if=/dev/zero of=clang_iso.img bs=1M count=1024 + mkfs.ext4 clang_iso.img + + - name: 🐇 Mount Docker ISO + run: | + sudo mount -o loop docker_iso.img iso_mount + docker build -t docker_iso_tool ./iso_mount + + - name: 🐇 Build with Clang + run: | + sudo mount -o loop clang_iso.img iso_mount + clang --version + clang ./cmd/main.go -o rabbit_protocol_clang + + - name: 🐇 Save Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: rabbit_protocol_${{ matrix.os }} + path: | + rabbit_protocol + rabbit_protocol_clang + docker_iso.img + clang_iso.img + + rabbit-run: + name: 🚀 Run the Rabbit Protocol + runs-on: ${{ matrix.os }} + needs: rabbit-build + steps: + - name: 🐇 Checkout Code + uses: actions/checkout@v3 + + - name: 🐇 Run Docker and Clang Tests + run: | + docker run --rm -v $(pwd):/usr/src/app -w /usr/src/app docker_iso_tool ./rabbit_protocol + ./rabbit_protocol_clang + + bugzap-pesterbot: + name: 🐇 BugZap PesterBot + runs-on: ubuntu-latest + needs: rabbit-run + steps: + - name: 🐇 Scan for Rogue Code + run: | + echo "Scanning for pesterbot code..." + grep -r "pesterbot" ./cmd || echo "No pesterbot found!" + + - name: 🐇 Fix and Remove Bugs + run: | + # Example remediation + sed -i '/pesterbot/d' ./cmd/main.go + + package-toolbelt: + name: 📦 Package Toolbelt/Kit + runs-on: ubuntu-latest + needs: bugzap-pesterbot + steps: + - name: 🐇 Download Build Artifacts + uses: actions/download-artifact@v3 + with: + name: rabbit_protocol_${{ matrix.os }} + path: ./builds + + - name: 🐇 Create Container Image + run: | + mkdir -p container + mv ./builds/* ./container/ + docker build -t rabbit_toolbelt:latest ./container + + - name: 🐇 Push Container to Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - run: | + docker tag rabbit_toolbelt:latest ghcr.io/${{ github.repository }}/rabbit_toolbelt:latest + docker push ghcr.io/${{ github.repository }}/rabbit_toolbelt:latest From cfe4950b2e09836318476825ffaa2f27b63fdd58 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 22:09:46 -0500 Subject: [PATCH 20/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards --- .mergify.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .mergify.yml diff --git a/.mergify.yml b/.mergify.yml new file mode 100644 index 000000000000..2c9fa3d3fdd7 --- /dev/null +++ b/.mergify.yml @@ -0,0 +1,6 @@ +commands_restrictions: + update: + conditions: + - or: + - sender-permission >= reader + - sender = {{author}} From b908ac35b8ecddfcb5715fee9c08e3c63ff4d3d4 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 22:13:36 -0500 Subject: [PATCH 21/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards --- .mergify.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.mergify.yml b/.mergify.yml index 2c9fa3d3fdd7..2d20587aeba0 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -4,3 +4,13 @@ commands_restrictions: - or: - sender-permission >= reader - sender = {{author}} + rebase: + conditions: + - or: + - sender-permission >= reader + - sender = {{author}} + squash: + conditions: + - or: + - sender-permission >= reader + - sender = {{author}} From cc70c7042abbc6ca3dc5065ff19eb5d61f4eb590 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 22:18:10 -0500 Subject: [PATCH 22/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards --- .mergify.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.mergify.yml b/.mergify.yml index 2d20587aeba0..c7c1dbf08189 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -14,3 +14,10 @@ commands_restrictions: - or: - sender-permission >= reader - sender = {{author}} + backport: + conditions: + - sender-permission >= reader + unqueue: + conditions: + - "" + - sender-permission >= reader From 5d9f235713ca88ac2f8e9473815f96b65f9fa2be Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 22:21:55 -0500 Subject: [PATCH 23/40] Create docker-publish.yml --- .github/workflows/docker-publish.yml | 98 ++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 000000000000..4842cfc292d1 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,98 @@ +name: Docker + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + schedule: + - cron: '36 7 * * *' + push: + branches: [ "main" ] + # Publish semver tags as releases. + tags: [ 'v*.*.*' ] + pull_request: + branches: [ "main" ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Install the cosign tool except on PR + # https://github.com/sigstore/cosign-installer + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0 + with: + cosign-release: 'v2.2.4' + + # Set up BuildKit Docker container builder to be able to build + # multi-platform images and export cache + # https://github.com/docker/setup-buildx-action + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build and push Docker image with Buildx (don't push on PR) + # https://github.com/docker/build-push-action + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + # Sign the resulting Docker image digest except on PRs. + # This will only write to the public Rekor transparency log when the Docker + # repository is public to avoid leaking data. If you would like to publish + # transparency data even for private images, pass --force to cosign below. + # https://github.com/sigstore/cosign + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.build-and-push.outputs.digest }} + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} From 0d422847e0042f8714cff8ddcc61c82a1ebcf64e Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 22:50:26 -0500 Subject: [PATCH 24/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards From a6ccc87ac9555e5bd30b99674299a70e50195e44 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 22:59:01 -0500 Subject: [PATCH 25/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards --- .mergify.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.mergify.yml b/.mergify.yml index c7c1dbf08189..af299248f326 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -21,3 +21,6 @@ commands_restrictions: conditions: - "" - sender-permission >= reader + queue: + conditions: + - sender-permission >= reader From bd5de909f64ae78dc72b517a983267c11e61eb97 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:00:19 -0500 Subject: [PATCH 26/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards From 9ca031432a9a3f735853e108a399d92795c1f567 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:01:26 -0500 Subject: [PATCH 27/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards From 9ea595369f460d85571a0a323e62860ab0f1c67e Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:02:15 -0500 Subject: [PATCH 28/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards --- .mergify.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.mergify.yml b/.mergify.yml index af299248f326..39e3ee350899 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -24,3 +24,6 @@ commands_restrictions: queue: conditions: - sender-permission >= reader + requeue: + conditions: + - sender-permission >= reader From 5580446c96fbdddbd9449c397489be4d9e4633b8 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:05:23 -0500 Subject: [PATCH 29/40] Create run_rule_off.yml --- run_rule_off.yml | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 run_rule_off.yml diff --git a/run_rule_off.yml b/run_rule_off.yml new file mode 100644 index 000000000000..91ca209bdb1a --- /dev/null +++ b/run_rule_off.yml @@ -0,0 +1,91 @@ +import yaml +import os +import subprocess + +# Path to your Mergify config file +MERGIFY_CONFIG_PATH = ".mergify.yml" +BACKUP_CONFIG_PATH = ".mergify.yml.bak" + +def backup_mergify_config(): + """Backup the Mergify config.""" + if not os.path.exists(MERGIFY_CONFIG_PATH): + print(f"Mergify config not found at {MERGIFY_CONFIG_PATH}") + return False + + # Create a backup + with open(MERGIFY_CONFIG_PATH, "r") as original, open(BACKUP_CONFIG_PATH, "w") as backup: + backup.write(original.read()) + print(f"Backup created: {BACKUP_CONFIG_PATH}") + return True + +def comment_out_rules(): + """Comment out all rules in the Mergify config.""" + with open(MERGIFY_CONFIG_PATH, "r") as file: + config = yaml.safe_load(file) + + if "pull_request_rules" in config: + for rule in config["pull_request_rules"]: + rule["disabled"] = True # Disable all rules + print("All pull request rules disabled.") + + # Save updated config + with open(MERGIFY_CONFIG_PATH, "w") as file: + yaml.dump(config, file, default_flow_style=False) + print(f"Updated config written to {MERGIFY_CONFIG_PATH}") + +def push_changes(): + """Push changes to the Git repository.""" + try: + subprocess.run(["git", "add", MERGIFY_CONFIG_PATH], check=True) + subprocess.run(["git", "commit", "-m", "Temporarily disable Mergify rules"], check=True) + subprocess.run(["git", "push"], check=True) + print("Changes pushed successfully.") + except subprocess.CalledProcessError as e: + print(f"Error during git operations: {e}") + restore_backup() + +def restore_backup(): + """Restore the original Mergify config.""" + if os.path.exists(BACKUP_CONFIG_PATH): + with open(BACKUP_CONFIG_PATH, "r") as backup, open(MERGIFY_CONFIG_PATH, "w") as original: + original.write(backup.read()) + print("Backup restored.") + else: + print("Backup not found. Cannot restore.") + +def main(): + """Main function to disable Mergify rules.""" + if not backup_mergify_config(): + return + + try: + comment_out_rules() + push_changes() + except Exception as e: + print(f"An error occurred: {e}") + restore_backup() + +if __name__ == "__main__": + main() +commands_restrictions: + update: + conditions: + - or: + - sender-permission: write # Adjusted permission level + - sender: "{{author}}" # Allowed if sender is the author + rebase: + conditions: + - or: + - sender-permission: write # Adjusted permission level + - sender: "{{author}}" # Allowed if sender is the author + squash: + conditions: + - or: + - sender-permission: write # Adjusted permission level + - sender: "{{author}}" # Allowed if sender is the author + backport: + conditions: + - sender-permission: write # Adjusted permission level + unqueue: + conditions: + - sender-permission: write # Adjusted permission level From 1d618c36bd5e7ef0a116e84c09e76d39d5406921 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:07:23 -0500 Subject: [PATCH 30/40] Revert "ci(Mergify): configuration update" From 4154b4b80e9a304df51b36f24eda83f00ae03551 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:09:49 -0500 Subject: [PATCH 31/40] Update install-azure-devops-cli.sh --- images/ubuntu/scripts/build/install-azure-devops-cli.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/ubuntu/scripts/build/install-azure-devops-cli.sh b/images/ubuntu/scripts/build/install-azure-devops-cli.sh index 015bdba145e1..dedda2b7bc83 100644 --- a/images/ubuntu/scripts/build/install-azure-devops-cli.sh +++ b/images/ubuntu/scripts/build/install-azure-devops-cli.sh @@ -1,7 +1,7 @@ #!/bin/bash -e ################################################################################ ## File: install-azure-devops-cli.sh -## Desc: +## Desc:# File: install-azure-devops-cli.sh Install Azure DevOps CLI (az devops) ################################################################################ From 5e66e23abb532a2679c732dfc524f45bc3821a3f Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:10:18 -0500 Subject: [PATCH 32/40] Update install-azure-devops-cli.sh --- images/ubuntu/scripts/build/install-azure-devops-cli.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/images/ubuntu/scripts/build/install-azure-devops-cli.sh b/images/ubuntu/scripts/build/install-azure-devops-cli.sh index dedda2b7bc83..4cff57912f8f 100644 --- a/images/ubuntu/scripts/build/install-azure-devops-cli.sh +++ b/images/ubuntu/scripts/build/install-azure-devops-cli.sh @@ -1,10 +1,12 @@ #!/bin/bash -e ################################################################################ ## File: install-azure-devops-cli.sh -## Desc:# File: install-azure-devops-cli.sh +## Desc: Install Azure DevOps CLI (az devops) +## Desc: Install Azure DevOps CLI (az devops) ################################################################################ +# Source the helpers for use with the script # Source the helpers for use with the script source $HELPER_SCRIPTS/etc-environment.sh From c5d5b371a9305ea6dac2dfcd1f612c1315a314e6 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:10:45 -0500 Subject: [PATCH 33/40] Update install-azure-devops-cli.sh --- images/ubuntu/scripts/build/install-azure-devops-cli.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/images/ubuntu/scripts/build/install-azure-devops-cli.sh b/images/ubuntu/scripts/build/install-azure-devops-cli.sh index 4cff57912f8f..b51b79fa0438 100644 --- a/images/ubuntu/scripts/build/install-azure-devops-cli.sh +++ b/images/ubuntu/scripts/build/install-azure-devops-cli.sh @@ -2,7 +2,6 @@ ################################################################################ ## File: install-azure-devops-cli.sh ## Desc: Install Azure DevOps CLI (az devops) -## Desc: Install Azure DevOps CLI (az devops) ################################################################################ From a4986f5e8ef3d126f73d873a75a482881179227d Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:14:36 -0500 Subject: [PATCH 34/40] Update install-azure-devops-cli.sh --- images/ubuntu/scripts/build/install-azure-devops-cli.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/images/ubuntu/scripts/build/install-azure-devops-cli.sh b/images/ubuntu/scripts/build/install-azure-devops-cli.sh index b51b79fa0438..f55e17cc9ab7 100644 --- a/images/ubuntu/scripts/build/install-azure-devops-cli.sh +++ b/images/ubuntu/scripts/build/install-azure-devops-cli.sh @@ -5,7 +5,6 @@ Install Azure DevOps CLI (az devops) ################################################################################ -# Source the helpers for use with the script # Source the helpers for use with the script source $HELPER_SCRIPTS/etc-environment.sh From 337462250395e95b6e3ebc5b49a92e450bb82b49 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:15:59 -0500 Subject: [PATCH 35/40] Update install-azure-devops-cli.sh --- images/ubuntu/scripts/build/install-azure-devops-cli.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/ubuntu/scripts/build/install-azure-devops-cli.sh b/images/ubuntu/scripts/build/install-azure-devops-cli.sh index f55e17cc9ab7..5a6deff769ed 100644 --- a/images/ubuntu/scripts/build/install-azure-devops-cli.sh +++ b/images/ubuntu/scripts/build/install-azure-devops-cli.sh @@ -2,7 +2,7 @@ ################################################################################ ## File: install-azure-devops-cli.sh ## Desc: Install Azure DevOps CLI (az devops) - Install Azure DevOps CLI (az devops) +# Install Azure DevOps CLI (az devops) ################################################################################ # Source the helpers for use with the script @@ -14,6 +14,7 @@ export AZURE_EXTENSION_DIR=/opt/az/azcliextensions set_etc_environment_variable "AZURE_EXTENSION_DIR" "${AZURE_EXTENSION_DIR}" # install azure devops Cli extension +Npm Install Azure DevOps CLI (az devops) az extension add -n azure-devops invoke_tests "CLI.Tools" "Azure DevOps CLI" From 3ee3b99d58df95c77f613fee14739ae406cb798b Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:18:34 -0500 Subject: [PATCH 36/40] Update install-azure-devops-cli.sh --- images/ubuntu/scripts/build/install-azure-devops-cli.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/images/ubuntu/scripts/build/install-azure-devops-cli.sh b/images/ubuntu/scripts/build/install-azure-devops-cli.sh index 5a6deff769ed..54652a49fbc8 100644 --- a/images/ubuntu/scripts/build/install-azure-devops-cli.sh +++ b/images/ubuntu/scripts/build/install-azure-devops-cli.sh @@ -2,7 +2,7 @@ ################################################################################ ## File: install-azure-devops-cli.sh ## Desc: Install Azure DevOps CLI (az devops) -# Install Azure DevOps CLI (az devops) +## Install Azure DevOps CLI (az devops) ################################################################################ # Source the helpers for use with the script @@ -14,7 +14,7 @@ export AZURE_EXTENSION_DIR=/opt/az/azcliextensions set_etc_environment_variable "AZURE_EXTENSION_DIR" "${AZURE_EXTENSION_DIR}" # install azure devops Cli extension -Npm Install Azure DevOps CLI (az devops) +sudo Install Azure DevOps CLI (az devops) az extension add -n azure-devops invoke_tests "CLI.Tools" "Azure DevOps CLI" From 9ce78fc20f23e80b9884c5fffd0879fcf7e1c0bd Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:20:54 -0500 Subject: [PATCH 37/40] Update .mergify.yml --- .mergify.yml | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/.mergify.yml b/.mergify.yml index 39e3ee350899..b4fa9e310866 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -27,3 +27,95 @@ commands_restrictions: requeue: conditions: - sender-permission >= reader + +import yaml +import os +import subprocess + +# Path to your Mergify config file +MERGIFY_CONFIG_PATH = ".mergify.yml" +BACKUP_CONFIG_PATH = ".mergify.yml.bak" + +def backup_mergify_config(): + """Backup the Mergify config.""" + if not os.path.exists(MERGIFY_CONFIG_PATH): + print(f"Mergify config not found at {MERGIFY_CONFIG_PATH}") + return False + + # Create a backup + with open(MERGIFY_CONFIG_PATH, "r") as original, open(BACKUP_CONFIG_PATH, "w") as backup: + backup.write(original.read()) + print(f"Backup created: {BACKUP_CONFIG_PATH}") + return True + +def comment_out_rules(): + """Comment out all rules in the Mergify config.""" + with open(MERGIFY_CONFIG_PATH, "r") as file: + config = yaml.safe_load(file) + + if "pull_request_rules" in config: + for rule in config["pull_request_rules"]: + rule["disabled"] = True # Disable all rules + print("All pull request rules disabled.") + + # Save updated config + with open(MERGIFY_CONFIG_PATH, "w") as file: + yaml.dump(config, file, default_flow_style=False) + print(f"Updated config written to {MERGIFY_CONFIG_PATH}") + +def push_changes(): + """Push changes to the Git repository.""" + try: + subprocess.run(["git", "add", MERGIFY_CONFIG_PATH], check=True) + subprocess.run(["git", "commit", "-m", "Temporarily disable Mergify rules"], check=True) + subprocess.run(["git", "push"], check=True) + print("Changes pushed successfully.") + except subprocess.CalledProcessError as e: + print(f"Error during git operations: {e}") + restore_backup() + +def restore_backup(): + """Restore the original Mergify config.""" + if os.path.exists(BACKUP_CONFIG_PATH): + with open(BACKUP_CONFIG_PATH, "r") as backup, open(MERGIFY_CONFIG_PATH, "w") as original: + original.write(backup.read()) + print("Backup restored.") + else: + print("Backup not found. Cannot restore.") + +def main(): + """Main function to disable Mergify rules.""" + if not backup_mergify_config(): + return + + try: + comment_out_rules() + push_changes() + except Exception as e: + print(f"An error occurred: {e}") + restore_backup() + +if __name__ == "__main__": + main() +commands_restrictions: + update: + conditions: + - or: + - sender-permission: reader # Adjusted permission level + - sender: "{{author}}" # Allowed if sender is the author + rebase: + conditions: + - or: + - sender-permission: reader # Adjusted permission level + - sender: "{{author}}" # Allowed if sender is the author + squash: + conditions: + - or: + - sender-permission: reader # Adjusted permission level + - sender: "{{author}}" # Allowed if sender is the author + backport: + conditions: + - sender-permission: reader # Adjusted permission level + unqueue: + conditions: + - sender-permission: reader # Adjusted permission leve From 5ef3198e854f470291c46c3a41eaa7a94f2b19a4 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:27:01 -0500 Subject: [PATCH 38/40] Update install-azure-devops-cli.sh --- .../scripts/build/install-azure-devops-cli.sh | 45 +++++++++++++++---- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/images/ubuntu/scripts/build/install-azure-devops-cli.sh b/images/ubuntu/scripts/build/install-azure-devops-cli.sh index 54652a49fbc8..75eed800d262 100644 --- a/images/ubuntu/scripts/build/install-azure-devops-cli.sh +++ b/images/ubuntu/scripts/build/install-azure-devops-cli.sh @@ -1,20 +1,47 @@ -#!/bin/bash -e +#!/bin/bash + ################################################################################ ## File: install-azure-devops-cli.sh -## Desc: Install Azure DevOps CLI (az devops) -## Install Azure DevOps CLI (az devops) +## Desc: Install and upgrade Azure DevOps CLI (az devops) with error handling ################################################################################ # Source the helpers for use with the script -source $HELPER_SCRIPTS/etc-environment.sh +source /path/to/helpers.sh # Update to the actual path of helpers.sh -# AZURE_EXTENSION_DIR shell variable defines where modules are installed -# https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview +# Set Azure CLI extension directory export AZURE_EXTENSION_DIR=/opt/az/azcliextensions set_etc_environment_variable "AZURE_EXTENSION_DIR" "${AZURE_EXTENSION_DIR}" -# install azure devops Cli extension -sudo Install Azure DevOps CLI (az devops) -az extension add -n azure-devops +# Install or update Azure DevOps CLI extension +function install_or_update_devops_cli() { + echo "Checking if Azure DevOps CLI extension is installed..." + + # Check if the extension exists + if az extension show -n azure-devops &> /dev/null; then + echo "Azure DevOps CLI extension found. Attempting to update..." + + # Try updating the extension + if az extension update -n azure-devops; then + echo "Azure DevOps CLI extension updated successfully." + else + echo "Error updating Azure DevOps CLI extension." >&2 + exit 1 + fi + else + echo "Azure DevOps CLI extension not found. Installing..." + + # Try installing the extension + if az extension add -n azure-devops; then + echo "Azure DevOps CLI extension installed successfully." + else + echo "Error installing Azure DevOps CLI extension." >&2 + exit 1 + fi + fi +} + +# Invoke the function +install_or_update_devops_cli +# Run tests to verify installation invoke_tests "CLI.Tools" "Azure DevOps CLI" From cfdce210c5b644fafc512043d00129fd3541cb8e Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sat, 4 Jan 2025 23:58:08 -0500 Subject: [PATCH 39/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards --- .mergify.yml | 100 ++------------------------------------------------- 1 file changed, 2 insertions(+), 98 deletions(-) diff --git a/.mergify.yml b/.mergify.yml index b4fa9e310866..c7e7055d469a 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -21,101 +21,5 @@ commands_restrictions: conditions: - "" - sender-permission >= reader - queue: - conditions: - - sender-permission >= reader - requeue: - conditions: - - sender-permission >= reader - -import yaml -import os -import subprocess - -# Path to your Mergify config file -MERGIFY_CONFIG_PATH = ".mergify.yml" -BACKUP_CONFIG_PATH = ".mergify.yml.bak" - -def backup_mergify_config(): - """Backup the Mergify config.""" - if not os.path.exists(MERGIFY_CONFIG_PATH): - print(f"Mergify config not found at {MERGIFY_CONFIG_PATH}") - return False - - # Create a backup - with open(MERGIFY_CONFIG_PATH, "r") as original, open(BACKUP_CONFIG_PATH, "w") as backup: - backup.write(original.read()) - print(f"Backup created: {BACKUP_CONFIG_PATH}") - return True - -def comment_out_rules(): - """Comment out all rules in the Mergify config.""" - with open(MERGIFY_CONFIG_PATH, "r") as file: - config = yaml.safe_load(file) - - if "pull_request_rules" in config: - for rule in config["pull_request_rules"]: - rule["disabled"] = True # Disable all rules - print("All pull request rules disabled.") - - # Save updated config - with open(MERGIFY_CONFIG_PATH, "w") as file: - yaml.dump(config, file, default_flow_style=False) - print(f"Updated config written to {MERGIFY_CONFIG_PATH}") - -def push_changes(): - """Push changes to the Git repository.""" - try: - subprocess.run(["git", "add", MERGIFY_CONFIG_PATH], check=True) - subprocess.run(["git", "commit", "-m", "Temporarily disable Mergify rules"], check=True) - subprocess.run(["git", "push"], check=True) - print("Changes pushed successfully.") - except subprocess.CalledProcessError as e: - print(f"Error during git operations: {e}") - restore_backup() - -def restore_backup(): - """Restore the original Mergify config.""" - if os.path.exists(BACKUP_CONFIG_PATH): - with open(BACKUP_CONFIG_PATH, "r") as backup, open(MERGIFY_CONFIG_PATH, "w") as original: - original.write(backup.read()) - print("Backup restored.") - else: - print("Backup not found. Cannot restore.") - -def main(): - """Main function to disable Mergify rules.""" - if not backup_mergify_config(): - return - - try: - comment_out_rules() - push_changes() - except Exception as e: - print(f"An error occurred: {e}") - restore_backup() - -if __name__ == "__main__": - main() -commands_restrictions: - update: - conditions: - - or: - - sender-permission: reader # Adjusted permission level - - sender: "{{author}}" # Allowed if sender is the author - rebase: - conditions: - - or: - - sender-permission: reader # Adjusted permission level - - sender: "{{author}}" # Allowed if sender is the author - squash: - conditions: - - or: - - sender-permission: reader # Adjusted permission level - - sender: "{{author}}" # Allowed if sender is the author - backport: - conditions: - - sender-permission: reader # Adjusted permission level - unqueue: - conditions: - - sender-permission: reader # Adjusted permission leve +queue_rules: + - name: "100" From 83c04b9f9b377a6a02014a51954b28b12529e1c9 Mon Sep 17 00:00:00 2001 From: "J. K. Edwards" Date: Sun, 5 Jan 2025 00:02:28 -0500 Subject: [PATCH 40/40] ci(Mergify): configuration update Signed-off-by: J. K. Edwards --- .mergify.yml | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.mergify.yml b/.mergify.yml index c7e7055d469a..eed2f9c870b6 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -21,5 +21,37 @@ commands_restrictions: conditions: - "" - sender-permission >= reader -queue_rules: - - name: "100" +pull_request_rules: + - name: Make sure PR are update before merging with rebase + description: This automatically rebases PRs when they are out-of-date with the + base branch to avoid semantic conflicts (next step us switch to merge + queue). + conditions: + - "#commits-behind >= 10" + actions: + rebase: + - name: Add a queue label when PR is queued + description: Toggle the queue label when a pull request is (un)queued. + conditions: + - queue-position > 0 + actions: + label: + toggle: + - merge-queued + - name: Request review from team + description: Request review from a specific team when checks are green. + conditions: + - -closed + - "#approved-reviews-by = 0" + - "#changes-requested-reviews-by = 0" + - review-requested != @TEAM_NAME_HERE + actions: + request_reviews: + teams: + - TEAM_NAME_HERE + - name: Automatic merge + description: Merge when PR passes all branch protection and has label automerge + conditions: + - label = automerge + actions: + merge: