From e7b7c99c8d4e8dfeff1fecc57729abaf3582be04 Mon Sep 17 00:00:00 2001 From: Peter Vinter Date: Sun, 17 Nov 2024 22:52:36 +0100 Subject: [PATCH] Add: GitHub templates, workflows, and wiki --- .github/ISSUE_TEMPLATE/bug_report.md | 31 +++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++ .github/pull_request_template.md | 26 ++++++++ .github/workflows/powershell-tests.yml | 37 +++++++++++ wiki/Home.md | 77 +++++++++++++++++++++++ 5 files changed, 191 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/powershell-tests.yml create mode 100644 wiki/Home.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..e70d78f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,31 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '[BUG] ' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Run command '...' +2. With container '....' +3. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Environment (please complete the following information):** + - OS: [e.g. Windows 10] + - PowerShell Version: [e.g. 5.1] + - Docker Version: [e.g. 20.10.7] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..0f540bf --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '[FEATURE] ' +labels: enhancement +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..d57f909 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,26 @@ +## Description +Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. + +Fixes # (issue) + +## Type of change +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Documentation update + +## How Has This Been Tested? +Please describe the tests that you ran to verify your changes. + +- [ ] Test A +- [ ] Test B + +## Checklist: +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] Any dependent changes have been merged and published in downstream modules diff --git a/.github/workflows/powershell-tests.yml b/.github/workflows/powershell-tests.yml new file mode 100644 index 0000000..1067bde --- /dev/null +++ b/.github/workflows/powershell-tests.yml @@ -0,0 +1,37 @@ +name: PowerShell Tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Check PowerShell version + shell: pwsh + run: $PSVersionTable.PSVersion + + - name: Check Docker version + shell: pwsh + run: docker --version + + - name: Verify script syntax + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + foreach ($script in Get-ChildItem -Path . -Filter *.ps1) { + Write-Host "Checking $($script.Name)" + $null = [System.Management.Automation.Language.Parser]::ParseFile($script.FullName, [ref]$null, [ref]$null) + } + + - name: Run PSScriptAnalyzer + shell: pwsh + run: | + Install-Module -Name PSScriptAnalyzer -Force + Invoke-ScriptAnalyzer -Path . -Recurse -Settings PSGallery diff --git a/wiki/Home.md b/wiki/Home.md new file mode 100644 index 0000000..0201e68 --- /dev/null +++ b/wiki/Home.md @@ -0,0 +1,77 @@ +# Docker Graceful Shutdown for Windows Wiki + +Welcome to the Docker Graceful Shutdown for Windows wiki! This wiki provides detailed information about using and troubleshooting the utility. + +## Table of Contents + +1. [Getting Started](#getting-started) +2. [Use Cases](#use-cases) +3. [Troubleshooting](#troubleshooting) +4. [Advanced Usage](#advanced-usage) + +## Getting Started + +### Prerequisites +- Windows OS +- PowerShell 5.1 or higher +- Docker Desktop for Windows +- Administrator privileges (recommended) + +### Installation +1. Download both script files: + - `shutdownallcontainers.cmd` + - `gracefully_shutdown_all_docker_containers.ps1` +2. Place them in the same directory +3. Ensure you have execution permissions + +## Use Cases + +### 1. Development Environment Shutdown +Perfect for developers who need to cleanly shut down their development environment at the end of the day. + +### 2. System Maintenance +Use before system updates or maintenance to ensure all containers are properly stopped. + +### 3. Container Dependency Management +Handles complex container dependencies automatically during shutdown. + +## Troubleshooting + +### Common Issues + +#### 1. Permission Denied +```powershell +Solution: Run the script as Administrator +``` + +#### 2. Docker Not Running +```powershell +Solution: Ensure Docker Desktop is running and accessible +``` + +#### 3. Timeout Issues +```powershell +Solution: Adjust timeout settings in the PowerShell script +``` + +## Advanced Usage + +### Custom Timeout Settings +You can modify the default timeout value in the PowerShell script: +```powershell +$timeout = 30 # Adjust this value as needed +``` + +### Dependency Override +To force shutdown regardless of dependencies: +```cmd +shutdownallcontainers.cmd -force +``` + +## Contributing to the Wiki + +Feel free to contribute to this wiki by: +1. Creating new pages for specific topics +2. Adding more troubleshooting scenarios +3. Sharing your use cases +4. Improving existing documentation