From 3263b02d703de5342a54a9420ba169cbfaceb1cc Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Sun, 29 Mar 2026 10:41:29 +0000 Subject: [PATCH 1/4] Initial plan From 34ce09f3527dde9e9e579b3780fdc860d1046b2a Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Sun, 29 Mar 2026 10:44:35 +0000 Subject: [PATCH 2/4] feat: enhance automated dependency management with actual code updates - Auto-update workflow now modifies files directly instead of just creating empty PRs - Automatically extracts versions from issues and updates installer scripts - Creates PRs with actual code changes for Ansible, Kubernetes, and NGINX - Marks NGINX PRs as draft (requires SHA256 checksum verification) - Add helper script to calculate and update NGINX SHA256 checksums - Enhanced README documentation explaining true self-maintenance The repository can now maintain itself - detects updates, creates PRs with code changes, only needs human review before merging. Agent-Logs-Url: https://github.com/Stensel8/Scripts/sessions/547a61b6-040d-4e32-ab08-55063bbe8ef5 Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com> --- .github/scripts/update-nginx-checksums.sh | 139 ++++++++ .../workflows/auto-update-dependencies.yml | 317 +++++++++++++----- README.md | 31 +- 3 files changed, 397 insertions(+), 90 deletions(-) create mode 100755 .github/scripts/update-nginx-checksums.sh diff --git a/.github/scripts/update-nginx-checksums.sh b/.github/scripts/update-nginx-checksums.sh new file mode 100755 index 0000000..cf5975d --- /dev/null +++ b/.github/scripts/update-nginx-checksums.sh @@ -0,0 +1,139 @@ +#!/usr/bin/env bash +# +# Helper script to calculate and update SHA256 checksums for NGINX dependencies +# This script downloads the dependencies and updates the checksums in installer files +# +# Usage: ./update-nginx-checksums.sh [nginx_version] [openssl_version] [pcre2_version] [zlib_version] +# + +set -euo pipefail + +readonly RED='\033[0;31m' +readonly GREEN='\033[0;32m' +readonly YELLOW='\033[1;33m' +readonly BLUE='\033[0;34m' +readonly NC='\033[0m' + +log_info() { echo -e "${BLUE}[INFO]${NC} $1"; } +log_success() { echo -e "${GREEN}[✓]${NC} $1"; } +log_error() { echo -e "${RED}[✗]${NC} $1" >&2; } +log_warn() { echo -e "${YELLOW}[!]${NC} $1"; } + +# Get versions from arguments or read from installer files +NGINX_VERSION="${1:-$(grep -oP 'NGINX_VERSION="\K[^"]+' nginx/nginx_installer.sh)}" +OPENSSL_VERSION="${2:-$(grep -oP 'OPENSSL_VERSION="\K[^"]+' nginx/nginx_installer.sh)}" +PCRE2_VERSION="${3:-$(grep -oP 'PCRE2_VERSION="\K[^"]+' nginx/nginx_installer.sh)}" +ZLIB_VERSION="${4:-$(grep -oP 'ZLIB_VERSION="\K[^"]+' nginx/nginx_installer.sh)}" + +log_info "Versions to check:" +echo " NGINX: $NGINX_VERSION" +echo " OpenSSL: $OPENSSL_VERSION" +echo " PCRE2: $PCRE2_VERSION" +echo " Zlib: $ZLIB_VERSION" +echo + +# Create temp directory +TEMP_DIR=$(mktemp -d) +trap "rm -rf $TEMP_DIR" EXIT + +cd "$TEMP_DIR" + +# Download and calculate checksums +log_info "Downloading NGINX $NGINX_VERSION..." +if wget -q "https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz"; then + NGINX_SHA256=$(sha256sum "nginx-${NGINX_VERSION}.tar.gz" | awk '{print $1}') + log_success "NGINX SHA256: $NGINX_SHA256" +else + log_error "Failed to download NGINX $NGINX_VERSION" + NGINX_SHA256="" +fi + +log_info "Downloading OpenSSL $OPENSSL_VERSION..." +if wget -q "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"; then + OPENSSL_SHA256=$(sha256sum "openssl-${OPENSSL_VERSION}.tar.gz" | awk '{print $1}') + log_success "OpenSSL SHA256: $OPENSSL_SHA256" +else + log_error "Failed to download OpenSSL $OPENSSL_VERSION" + OPENSSL_SHA256="" +fi + +log_info "Downloading PCRE2 $PCRE2_VERSION..." +if wget -q "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${PCRE2_VERSION}/pcre2-${PCRE2_VERSION}.tar.gz"; then + PCRE2_SHA256=$(sha256sum "pcre2-${PCRE2_VERSION}.tar.gz" | awk '{print $1}') + log_success "PCRE2 SHA256: $PCRE2_SHA256" +else + log_error "Failed to download PCRE2 $PCRE2_VERSION" + PCRE2_SHA256="" +fi + +log_info "Downloading Zlib $ZLIB_VERSION..." +if wget -q "https://github.com/madler/zlib/releases/download/v${ZLIB_VERSION}/zlib-${ZLIB_VERSION}.tar.gz"; then + ZLIB_SHA256=$(sha256sum "zlib-${ZLIB_VERSION}.tar.gz" | awk '{print $1}') + log_success "Zlib SHA256: $ZLIB_SHA256" +else + log_error "Failed to download Zlib $ZLIB_VERSION" + ZLIB_SHA256="" +fi + +echo +log_info "SHA256 Checksums:" +echo "====================" +[ -n "$NGINX_SHA256" ] && echo "NGINX: $NGINX_SHA256" +[ -n "$OPENSSL_SHA256" ] && echo "OpenSSL: $OPENSSL_SHA256" +[ -n "$PCRE2_SHA256" ] && echo "PCRE2: $PCRE2_SHA256" +[ -n "$ZLIB_SHA256" ] && echo "Zlib: $ZLIB_SHA256" +echo + +# Ask if user wants to update the files +read -rp "Update installer files with these checksums? [y/N] " response +if [[ "$response" =~ ^[Yy]$ ]]; then + cd "$OLDPWD" + + # Update Bash installer + if [ -n "$NGINX_SHA256" ]; then + sed -i "s/NGINX_SHA256=\"[^\"]*\"/NGINX_SHA256=\"$NGINX_SHA256\"/" nginx/nginx_installer.sh + log_success "Updated NGINX SHA256 in nginx_installer.sh" + fi + + if [ -n "$OPENSSL_SHA256" ]; then + sed -i "s/OPENSSL_SHA256=\"[^\"]*\"/OPENSSL_SHA256=\"$OPENSSL_SHA256\"/" nginx/nginx_installer.sh + log_success "Updated OpenSSL SHA256 in nginx_installer.sh" + fi + + if [ -n "$PCRE2_SHA256" ]; then + sed -i "s/PCRE2_SHA256=\"[^\"]*\"/PCRE2_SHA256=\"$PCRE2_SHA256\"/" nginx/nginx_installer.sh + log_success "Updated PCRE2 SHA256 in nginx_installer.sh" + fi + + if [ -n "$ZLIB_SHA256" ]; then + sed -i "s/ZLIB_SHA256=\"[^\"]*\"/ZLIB_SHA256=\"$ZLIB_SHA256\"/" nginx/nginx_installer.sh + log_success "Updated Zlib SHA256 in nginx_installer.sh" + fi + + # Update PowerShell installer + if [ -n "$NGINX_SHA256" ]; then + sed -i "s/\$NGINX_SHA256 = \"[^\"]*\"/\$NGINX_SHA256 = \"$NGINX_SHA256\"/" nginx/nginx_installer.ps1 + log_success "Updated NGINX SHA256 in nginx_installer.ps1" + fi + + if [ -n "$OPENSSL_SHA256" ]; then + sed -i "s/\$OPENSSL_SHA256 = \"[^\"]*\"/\$OPENSSL_SHA256 = \"$OPENSSL_SHA256\"/" nginx/nginx_installer.ps1 + log_success "Updated OpenSSL SHA256 in nginx_installer.ps1" + fi + + if [ -n "$PCRE2_SHA256" ]; then + sed -i "s/\$PCRE2_SHA256 = \"[^\"]*\"/\$PCRE2_SHA256 = \"$PCRE2_SHA256\"/" nginx/nginx_installer.ps1 + log_success "Updated PCRE2 SHA256 in nginx_installer.ps1" + fi + + if [ -n "$ZLIB_SHA256" ]; then + sed -i "s/\$ZLIB_SHA256 = \"[^\"]*\"/\$ZLIB_SHA256 = \"$ZLIB_SHA256\"/" nginx/nginx_installer.ps1 + log_success "Updated Zlib SHA256 in nginx_installer.ps1" + fi + + echo + log_success "All checksums updated in installer files!" + log_info "Review the changes with: git diff nginx/" +else + log_info "No changes made to installer files" +fi diff --git a/.github/workflows/auto-update-dependencies.yml b/.github/workflows/auto-update-dependencies.yml index 860da8d..f915072 100644 --- a/.github/workflows/auto-update-dependencies.yml +++ b/.github/workflows/auto-update-dependencies.yml @@ -1,7 +1,7 @@ name: Auto-Update Dependencies -# This workflow automatically creates Pull Requests to update dependencies -# when dependency update issues are created or updated +# This workflow automatically creates Pull Requests with actual code changes +# to update dependencies when dependency update issues are created on: issues: @@ -33,10 +33,18 @@ jobs: with: fetch-depth: 0 - - name: Parse issue and create PR + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Parse issue and update dependencies uses: actions/github-script@v8 with: script: | + const fs = require('fs'); + const { execSync } = require('child_process'); + const issueNumber = context.payload.issue?.number || ${{ github.event.inputs.issue_number }}; // Get the issue details @@ -48,43 +56,9 @@ jobs: console.log(`Processing issue #${issueNumber}: ${issue.data.title}`); - // Extract version information from issue body const body = issue.data.body; const labels = issue.data.labels.map(l => l.name); - // Determine which type of dependency update this is - let updateType = ''; - let branchName = ''; - let files = []; - - if (labels.includes('nginx')) { - updateType = 'NGINX'; - branchName = `update-nginx-deps-${Date.now()}`; - files = ['nginx/nginx_installer.sh', 'nginx/nginx_installer.ps1']; - } else if (labels.includes('ansible')) { - updateType = 'Ansible'; - branchName = `update-ansible-deps-${Date.now()}`; - files = ['ansible/ansible_installer.sh']; - } else if (labels.includes('kubernetes')) { - updateType = 'Kubernetes'; - branchName = `update-kubernetes-deps-${Date.now()}`; - files = ['kubernetes/kubernetes_installer.sh']; - } else { - console.log('Unknown dependency type, skipping PR creation'); - return; - } - - console.log(`Update type: ${updateType}`); - console.log(`Branch name: ${branchName}`); - - // Check if a PR already exists for this issue - const existingPRs = await github.rest.pulls.list({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open', - head: `${context.repo.owner}:${branchName.split('-').slice(0, -1).join('-')}` - }); - // Search for any PR that references this issue const allPRs = await github.rest.pulls.list({ owner: context.repo.owner, @@ -98,15 +72,152 @@ jobs: if (linkedPR) { console.log(`PR #${linkedPR.number} already exists for this issue`); - - // Add comment to issue await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issueNumber, body: `A pull request already exists to address this update: #${linkedPR.number}` }); + return; + } + // Extract version information from issue body + const versionRegex = /\*\*([^:]+)\*\*:\s+([^\s]+)\s+→\s+([^\s]+)/g; + const updates = {}; + let match; + + while ((match = versionRegex.exec(body)) !== null) { + const [, component, currentVersion, latestVersion] = match; + updates[component.trim()] = { + current: currentVersion.trim(), + latest: latestVersion.trim() + }; + } + + console.log('Extracted updates:', JSON.stringify(updates, null, 2)); + + // Determine update type and files to modify + let updateType = ''; + let branchName = ''; + let files = []; + let updatesMade = false; + + if (labels.includes('ansible')) { + updateType = 'Ansible'; + branchName = `automated-update/ansible-${Date.now()}`; + + // Update Ansible installer + const ansibleFile = 'ansible/ansible_installer.sh'; + let content = fs.readFileSync(ansibleFile, 'utf8'); + let modified = false; + + if (updates['Python']) { + const pythonRegex = /BUILD_PYTHON_VERSION:-([0-9.]+)/; + content = content.replace(pythonRegex, `BUILD_PYTHON_VERSION:-${updates['Python'].latest}`); + modified = true; + console.log(`Updated Python version to ${updates['Python'].latest}`); + } + + if (updates['Ansible']) { + const ansibleRegex = /pip install ansible==([0-9.]+)/; + content = content.replace(ansibleRegex, `pip install ansible==${updates['Ansible'].latest}`); + modified = true; + console.log(`Updated Ansible version to ${updates['Ansible'].latest}`); + } + + if (modified) { + fs.writeFileSync(ansibleFile, content); + files.push(ansibleFile); + updatesMade = true; + } + + } else if (labels.includes('nginx')) { + updateType = 'NGINX'; + branchName = `automated-update/nginx-${Date.now()}`; + + // Update NGINX installer (Bash) + const nginxShFile = 'nginx/nginx_installer.sh'; + let shContent = fs.readFileSync(nginxShFile, 'utf8'); + let shModified = false; + + // Update NGINX installer (PowerShell) + const nginxPs1File = 'nginx/nginx_installer.ps1'; + let ps1Content = fs.readFileSync(nginxPs1File, 'utf8'); + let ps1Modified = false; + + if (updates['NGINX']) { + shContent = shContent.replace(/NGINX_VERSION="([0-9.]+)"/, `NGINX_VERSION="${updates['NGINX'].latest}"`); + ps1Content = ps1Content.replace(/\$NGINX_VERSION = "([0-9.]+)"/, `$NGINX_VERSION = "${updates['NGINX'].latest}"`); + shModified = ps1Modified = true; + console.log(`Updated NGINX version to ${updates['NGINX'].latest}`); + } + + if (updates['OpenSSL']) { + shContent = shContent.replace(/OPENSSL_VERSION="([0-9.]+)"/, `OPENSSL_VERSION="${updates['OpenSSL'].latest}"`); + ps1Content = ps1Content.replace(/\$OPENSSL_VERSION = "([0-9.]+)"/, `$OPENSSL_VERSION = "${updates['OpenSSL'].latest}"`); + shModified = ps1Modified = true; + console.log(`Updated OpenSSL version to ${updates['OpenSSL'].latest}`); + } + + if (updates['PCRE2']) { + shContent = shContent.replace(/PCRE2_VERSION="([0-9.]+)"/, `PCRE2_VERSION="${updates['PCRE2'].latest}"`); + ps1Content = ps1Content.replace(/\$PCRE2_VERSION = "([0-9.]+)"/, `$PCRE2_VERSION = "${updates['PCRE2'].latest}"`); + shModified = ps1Modified = true; + console.log(`Updated PCRE2 version to ${updates['PCRE2'].latest}`); + } + + if (updates['Zlib']) { + shContent = shContent.replace(/ZLIB_VERSION="([0-9.]+)"/, `ZLIB_VERSION="${updates['Zlib'].latest}"`); + ps1Content = ps1Content.replace(/\$ZLIB_VERSION = "([0-9.]+)"/, `$ZLIB_VERSION = "${updates['Zlib'].latest}"`); + shModified = ps1Modified = true; + console.log(`Updated Zlib version to ${updates['Zlib'].latest}`); + } + + if (shModified) { + fs.writeFileSync(nginxShFile, shContent); + files.push(nginxShFile); + updatesMade = true; + } + + if (ps1Modified) { + fs.writeFileSync(nginxPs1File, ps1Content); + files.push(nginxPs1File); + updatesMade = true; + } + + } else if (labels.includes('kubernetes')) { + updateType = 'Kubernetes'; + branchName = `automated-update/kubernetes-${Date.now()}`; + + const k8sFile = 'kubernetes/kubernetes_installer.sh'; + let content = fs.readFileSync(k8sFile, 'utf8'); + let modified = false; + + if (updates['Kubernetes']) { + content = content.replace(/K8S_VERSION:-([v0-9.]+)/, `K8S_VERSION:-${updates['Kubernetes'].latest}`); + modified = true; + console.log(`Updated Kubernetes version to ${updates['Kubernetes'].latest}`); + } + + if (modified) { + fs.writeFileSync(k8sFile, content); + files.push(k8sFile); + updatesMade = true; + } + + } else { + console.log('Unknown dependency type, skipping PR creation'); + return; + } + + if (!updatesMade) { + console.log('No updates were made to files'); + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + body: `⚠️ Unable to automatically update files. Manual intervention required.\n\nPlease review the issue details and update the files manually.` + }); return; } @@ -118,69 +229,89 @@ jobs: }); try { - await github.rest.git.createRef({ - owner: context.repo.owner, - repo: context.repo.repo, - ref: `refs/heads/${branchName}`, - sha: mainBranch.data.commit.sha - }); + execSync(`git checkout -b ${branchName}`, { stdio: 'inherit' }); console.log(`Created branch ${branchName}`); } catch (error) { - if (error.status === 422) { - console.log('Branch already exists, using existing branch'); - } else { - throw error; - } + console.error('Failed to create branch:', error.message); + throw error; } - // Create PR body with instructions and link to issue - const prBody = `## Automated Dependency Update + // Commit changes + try { + execSync(`git add ${files.join(' ')}`, { stdio: 'inherit' }); -This PR addresses the dependency updates identified in issue #${issueNumber}. + const commitMessage = `chore: update ${updateType} dependencies -### Changes Required +${Object.entries(updates).map(([comp, vers]) => `- ${comp}: ${vers.current} → ${vers.latest}`).join('\n')} -The following files need to be updated: -${files.map(f => `- [ ] \`${f}\``).join('\n')} +Automated update from issue #${issueNumber}`; -### Update Information + execSync(`git commit -m "${commitMessage.replace(/"/g, '\\"')}"`, { stdio: 'inherit' }); + console.log('Committed changes'); + } catch (error) { + console.error('Failed to commit:', error.message); + throw error; + } -Please refer to issue #${issueNumber} for: -- Current vs. latest version comparison -- Download URLs and checksums (if applicable) -- Testing instructions + // Push the branch + try { + execSync(`git push -u origin ${branchName}`, { stdio: 'inherit' }); + console.log('Pushed branch'); + } catch (error) { + console.error('Failed to push:', error.message); + throw error; + } -### Manual Steps Required + // Create PR body + const prBody = `## Automated Dependency Update -This PR creates the branch and structure. To complete the update: +This PR automatically updates ${updateType} dependencies as identified in issue #${issueNumber}. -1. Check out this branch: - \`\`\`bash - git checkout ${branchName} - \`\`\` +### Changes Made + +${Object.entries(updates).map(([component, versions]) => + `- **${component}**: ${versions.current} → ${versions.latest}` +).join('\n')} + +### Files Updated -2. Update the version numbers in the affected files according to issue #${issueNumber} +${files.map(f => `- \`${f}\``).join('\n')} -3. For NGINX updates: Download new tarballs and update SHA256 checksums +### ⚠️ Important Notes -4. Test the installation on a clean system +${updateType === 'NGINX' ? ` +**NGINX requires SHA256 checksum updates:** -5. Commit and push your changes: +After reviewing this PR, you'll need to: +1. Download the new NGINX tarball and calculate its SHA256: \`\`\`bash - git add ${files.join(' ')} - git commit -m "Update ${updateType} dependencies" - git push + wget https://nginx.org/download/nginx-${updates['NGINX']?.latest}.tar.gz + sha256sum nginx-${updates['NGINX']?.latest}.tar.gz \`\`\` +2. Update the SHA256 checksums in both installer files +3. Test the installation on a clean system -### Verification +**The PR cannot be merged until SHA256 checksums are updated.** +` : ''} + +### Testing Checklist -- [ ] Version numbers updated in all files -- [ ] SHA256 checksums updated (if applicable) +- [ ] Version numbers updated correctly +${updateType === 'NGINX' ? '- [ ] SHA256 checksums updated and verified' : ''} - [ ] Installation tested on clean system -- [ ] All tests pass +- [ ] All functionality verified + +### Verification + +Test the installation: +\`\`\`bash +${files[0].includes('ansible') ? './ansible/ansible_installer.sh' : + files[0].includes('nginx') ? './nginx/nginx_installer.sh' : + files[0].includes('kubernetes') ? './kubernetes/kubernetes_installer.sh' : './installer.sh'} +\`\`\` --- -*This PR was automatically created by the auto-update workflow.* +*🤖 This PR was automatically created by the dependency management workflow.* *Related issue: #${issueNumber}* Closes #${issueNumber} @@ -195,7 +326,7 @@ Closes #${issueNumber} head: branchName, base: context.payload.repository.default_branch, body: prBody, - draft: true + draft: updateType === 'NGINX' // Mark as draft if NGINX (needs SHA256 updates) }); console.log(`Created PR #${pr.data.number}`); @@ -205,15 +336,31 @@ Closes #${issueNumber} owner: context.repo.owner, repo: context.repo.repo, issue_number: pr.data.number, - labels: ['dependencies', 'automated', ...labels.filter(l => l !== 'enhancement')] + labels: ['dependencies', 'automated', ...labels.filter(l => !['enhancement', 'dependencies'].includes(l))] }); // Add comment to original issue with PR link + const commentBody = updateType === 'NGINX' + ? `🤖 **Automated PR Created** + +A pull request has been created with automated dependency updates: #${pr.data.number} + +⚠️ **Action Required:** The PR is marked as draft because NGINX updates require SHA256 checksum verification. Please: +1. Review the version updates +2. Download and verify SHA256 checksums +3. Update the checksums in the installer files +4. Mark the PR as ready for review` + : `🤖 **Automated PR Created** + +A pull request has been created with automated dependency updates: #${pr.data.number} + +The changes have been automatically applied. Please review and test before merging.`; + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: issueNumber, - body: `🤖 **Automated PR Created**\n\nA pull request has been created to address this update: #${pr.data.number}\n\nPlease review the PR for instructions on completing the update.` + body: commentBody }); console.log(`Successfully created PR and linked to issue #${issueNumber}`); @@ -226,7 +373,11 @@ Closes #${issueNumber} owner: context.repo.owner, repo: context.repo.repo, issue_number: issueNumber, - body: `⚠️ **Automated PR Creation Failed**\n\nThere was an error creating the automated pull request. Error: ${error.message}\n\nPlease create a pull request manually to address this update.` + body: `⚠️ **Automated PR Creation Failed** + +There was an error creating the automated pull request. Error: ${error.message} + +The branch \`${branchName}\` may have been created with updates. Please check and create a pull request manually if needed.` }); throw error; diff --git a/README.md b/README.md index 8e37d33..ec8bdad 100644 --- a/README.md +++ b/README.md @@ -62,19 +62,36 @@ A GitHub Actions workflow runs weekly (every Monday at 9:00 AM UTC) to check for - OpenSSH (uses distribution repositories) When new versions are detected, the workflow automatically: -1. Creates or updates GitHub issues with: + +1. **Creates or updates GitHub issues** with: - Current vs. latest version comparison - Files that need updating - Step-by-step update instructions - SHA256 checksum update reminders (where applicable) -2. Triggers the Auto-Update Bot to: - - Create a draft Pull Request linked to the issue - - Set up the branch for the update - - Provide detailed instructions for completing the update - - Auto-link the issue and PR together +2. **Triggers the Auto-Update Bot** to: + - **Automatically update version numbers** in installer files + - Create a Pull Request with actual code changes + - **For Ansible/Kubernetes**: Creates ready-to-merge PRs + - **For NGINX**: Creates draft PRs (requires SHA256 checksum verification) + - Auto-links issues and PRs together + - Provides testing instructions and checklists + +### NGINX Checksum Updates + +For NGINX dependency updates, use the helper script to calculate and update SHA256 checksums: + +```bash +# Run from the repository root +./.github/scripts/update-nginx-checksums.sh +``` + +This script will: +- Download the current NGINX, OpenSSL, PCRE2, and Zlib versions +- Calculate SHA256 checksums +- Optionally update both `nginx_installer.sh` and `nginx_installer.ps1` -This automated system ensures you're always notified of available updates and provides a streamlined workflow to apply them. +This automated system provides **true self-maintenance** - the repository automatically detects updates, creates PRs with code changes, and only requires human review and testing before merging. ### Script Validation All installer scripts are automatically validated on every push and pull request: From 183f825da659fd2f1ed12a908c99213954c6c2c4 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Sun, 29 Mar 2026 10:45:32 +0000 Subject: [PATCH 3/4] docs: add comprehensive testing guide for automation Added TESTING_AUTOMATION.md with detailed instructions for testing the enhanced automated dependency management system Agent-Logs-Url: https://github.com/Stensel8/Scripts/sessions/547a61b6-040d-4e32-ab08-55063bbe8ef5 Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com> --- .github/TESTING_AUTOMATION.md | 166 ++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 .github/TESTING_AUTOMATION.md diff --git a/.github/TESTING_AUTOMATION.md b/.github/TESTING_AUTOMATION.md new file mode 100644 index 0000000..3232618 --- /dev/null +++ b/.github/TESTING_AUTOMATION.md @@ -0,0 +1,166 @@ +# Testing the Enhanced Automated Dependency Management + +This document explains how to test the improved automated dependency management system. + +## Overview + +The enhanced workflow now automatically: +1. Extracts version information from dependency update issues +2. Updates version numbers in installer files +3. Creates and commits changes to a new branch +4. Opens a Pull Request with actual code modifications +5. Links the PR to the original issue + +## Testing with Issue #48 + +Issue #48 is a perfect test case for the Ansible dependency updates: +- **Python**: 3.14.2 → 3.14.3 +- **Ansible**: 13.3.0 → 13.5.0 + +### Method 1: Manually Trigger via GitHub Actions UI + +1. Go to the [Actions tab](https://github.com/Stensel8/Scripts/actions) +2. Select "Auto-Update Dependencies" workflow +3. Click "Run workflow" +4. Enter issue number: `48` +5. Click "Run workflow" button + +### Method 2: Trigger by Editing the Issue + +The workflow automatically runs when dependency issues are opened or edited: + +1. Go to [Issue #48](https://github.com/Stensel8/Scripts/issues/48) +2. Click "Edit" on the issue +3. Add a space or make any minor edit to the description +4. Save the changes + +The workflow will automatically trigger. + +### Method 3: Using GitHub CLI (with proper authentication) + +```bash +gh workflow run auto-update-dependencies.yml -f issue_number=48 +``` + +## Expected Behavior + +When the workflow runs successfully: + +1. **Version Extraction**: The workflow parses issue #48 and extracts: + ``` + Python: 3.14.2 → 3.14.3 + Ansible: 13.3.0 → 13.5.0 + ``` + +2. **File Updates**: Automatically modifies `ansible/ansible_installer.sh`: + - Updates `BUILD_PYTHON_VERSION:-3.14.2` to `BUILD_PYTHON_VERSION:-3.14.3` + - Updates `pip install ansible==13.3.0` to `pip install ansible==13.5.0` + +3. **Branch Creation**: Creates a new branch like `automated-update/ansible-1743422410` + +4. **Commit**: Creates a commit with message: + ``` + chore: update Ansible dependencies + + - Python: 3.14.2 → 3.14.3 + - Ansible: 13.3.0 → 13.5.0 + + Automated update from issue #48 + ``` + +5. **PR Creation**: Opens a PR with: + - Title: "🔄 Update Ansible Dependencies" + - Body containing changelog, files updated, and testing checklist + - Labels: `dependencies`, `automated`, `ansible` + - Status: Ready for review (not draft, unlike NGINX PRs) + +6. **Issue Comment**: Adds a comment to issue #48: + ``` + 🤖 Automated PR Created + + A pull request has been created with automated dependency updates: #XX + + The changes have been automatically applied. Please review and test before merging. + ``` + +7. **PR Closes Issue**: The PR body includes `Closes #48`, so merging the PR will automatically close the issue. + +## Verification Steps + +After the workflow completes: + +1. **Check the PR**: Verify the actual code changes in the Files tab +2. **Review the commit**: Ensure version numbers are correct +3. **Test the installer**: Clone the PR branch and run: + ```bash + git fetch origin automated-update/ansible-XXXXX + git checkout automated-update/ansible-XXXXX + ./ansible/ansible_installer.sh + ``` +4. **Verify versions**: After installation, check: + ```bash + python3 --version # Should show 3.14.3 + ansible --version # Should show 13.5.0 + ``` + +## NGINX Updates (Different Flow) + +For NGINX updates, the workflow behavior is different: + +1. **Draft PR**: NGINX PRs are marked as draft because they require SHA256 checksum verification +2. **Manual Step Required**: Use the helper script to update checksums: + ```bash + ./.github/scripts/update-nginx-checksums.sh + ``` +3. **Review and Mark Ready**: After checksums are updated, mark the PR as ready for review + +## Troubleshooting + +### Workflow Doesn't Trigger + +- Ensure the issue has the `dependencies` label +- Ensure the issue title contains "Update Available" +- Check the workflow runs in the Actions tab for any errors + +### PR Not Created + +- Check workflow logs in the Actions tab +- Look for errors in the "Parse issue and update dependencies" step +- Verify the issue body format matches expected patterns + +### Version Regex Not Matching + +The workflow expects version information in this format: +``` +- **ComponentName**: current_version → latest_version +``` + +Examples: +``` +- **Python**: 3.14.2 → 3.14.3 +- **NGINX**: 1.29.7 → 1.29.8 +- **OpenSSL**: 3.6.1 → 3.6.2 +``` + +## Success Criteria + +The automated dependency management is working correctly when: + +1. ✅ Workflow triggers automatically on issue creation/edit +2. ✅ Version information is correctly extracted from issues +3. ✅ Installer files are modified with correct version numbers +4. ✅ PRs are created with actual code changes (not empty branches) +5. ✅ NGINX PRs are marked as draft +6. ✅ Ansible/Kubernetes PRs are ready to merge +7. ✅ Issues and PRs are properly linked +8. ✅ Comments are added to issues when PRs are created +9. ✅ All files are committed and pushed successfully + +## Next Steps + +After successful testing with issue #48: + +1. Monitor for new dependency updates +2. Review and merge automatically created PRs +3. Verify that merged PRs close their associated issues +4. Watch for the next weekly dependency check (every Monday at 9:00 AM UTC) From 749b8a800b562d2d056c48759ac9388d41c723d9 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Sun, 29 Mar 2026 10:47:44 +0000 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20correct=20typo=20in=20PCRE2=20versio?= =?UTF-8?q?n=20check=20(CURRENT=5FOUTPUT=20=E2=86=92=20CURRENT=5FVERSION)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed typo on line 65 where CURRENT_OUTPUT was used instead of CURRENT_VERSION, which would cause the PCRE2 current version to be empty in the workflow output. Agent-Logs-Url: https://github.com/Stensel8/Scripts/sessions/fd0f5acc-490c-4a4f-b409-1ad4d50bdc39 Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com> --- .github/workflows/check-dependencies.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml index 33a7166..05deced 100644 --- a/.github/workflows/check-dependencies.yml +++ b/.github/workflows/check-dependencies.yml @@ -62,7 +62,7 @@ jobs: id: pcre2 run: | CURRENT_VERSION=$(grep -oP 'PCRE2_VERSION="\K[^"]+' nginx/nginx_installer.sh) - echo "current=$CURRENT_OUTPUT" >> $GITHUB_OUTPUT + echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT # Get latest version from GitHub releases LATEST_VERSION=$(curl -sL -H "Authorization: Bearer ${{ github.token }}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/PCRE2Project/pcre2/releases/latest | jq -r '.tag_name' | sed 's/pcre2-//')