From 441ba314b4d74511557334c434e3902055ab56d7 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Sat, 28 Mar 2026 19:17:59 +0000 Subject: [PATCH 1/2] Initial plan From d7a995ecf7e0fc2ff372492eecccfba5bce29016 Mon Sep 17 00:00:00 2001 From: "anthropic-code-agent[bot]" <242468646+Claude@users.noreply.github.com> Date: Sat, 28 Mar 2026 19:52:38 +0000 Subject: [PATCH 2/2] feat: expand dependency management with automated PR creation - Add Kubernetes, Terraform, Podman, and OpenSSH dependency checking - Create auto-update-dependencies workflow for automated PR creation - Link issues to PRs automatically with proper references - Update README with expanded dependency management documentation Agent-Logs-Url: https://github.com/Stensel8/Scripts/sessions/a9715b88-7029-4fed-8b1b-6f8a3b934ef6 Co-authored-by: Stensel8 <102481635+Stensel8@users.noreply.github.com> --- .../workflows/auto-update-dependencies.yml | 233 ++++++++++++++++++ .github/workflows/check-dependencies.yml | 152 +++++++++++- README.md | 32 ++- 3 files changed, 405 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/auto-update-dependencies.yml diff --git a/.github/workflows/auto-update-dependencies.yml b/.github/workflows/auto-update-dependencies.yml new file mode 100644 index 0000000..860da8d --- /dev/null +++ b/.github/workflows/auto-update-dependencies.yml @@ -0,0 +1,233 @@ +name: Auto-Update Dependencies + +# This workflow automatically creates Pull Requests to update dependencies +# when dependency update issues are created or updated + +on: + issues: + types: [opened, edited] + workflow_dispatch: + inputs: + issue_number: + description: 'Issue number to process' + required: true + type: number + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + auto-update: + name: Auto-Update Dependencies + runs-on: ubuntu-latest + # Only run for dependency update issues + if: | + (github.event_name == 'workflow_dispatch') || + (contains(github.event.issue.labels.*.name, 'dependencies') && + contains(github.event.issue.title, 'Update Available')) + steps: + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Parse issue and create PR + uses: actions/github-script@v8 + with: + script: | + const issueNumber = context.payload.issue?.number || ${{ github.event.inputs.issue_number }}; + + // Get the issue details + const issue = await github.rest.issues.get({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber + }); + + 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, + repo: context.repo.repo, + state: 'open' + }); + + const linkedPR = allPRs.data.find(pr => + pr.body && pr.body.includes(`#${issueNumber}`) + ); + + 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; + } + + // Create a new branch + const mainBranch = await github.rest.repos.getBranch({ + owner: context.repo.owner, + repo: context.repo.repo, + branch: context.payload.repository.default_branch + }); + + try { + await github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: `refs/heads/${branchName}`, + sha: mainBranch.data.commit.sha + }); + console.log(`Created branch ${branchName}`); + } catch (error) { + if (error.status === 422) { + console.log('Branch already exists, using existing branch'); + } else { + throw error; + } + } + + // Create PR body with instructions and link to issue + const prBody = `## Automated Dependency Update + +This PR addresses the dependency updates identified in issue #${issueNumber}. + +### Changes Required + +The following files need to be updated: +${files.map(f => `- [ ] \`${f}\``).join('\n')} + +### Update Information + +Please refer to issue #${issueNumber} for: +- Current vs. latest version comparison +- Download URLs and checksums (if applicable) +- Testing instructions + +### Manual Steps Required + +This PR creates the branch and structure. To complete the update: + +1. Check out this branch: + \`\`\`bash + git checkout ${branchName} + \`\`\` + +2. Update the version numbers in the affected files according to issue #${issueNumber} + +3. For NGINX updates: Download new tarballs and update SHA256 checksums + +4. Test the installation on a clean system + +5. Commit and push your changes: + \`\`\`bash + git add ${files.join(' ')} + git commit -m "Update ${updateType} dependencies" + git push + \`\`\` + +### Verification + +- [ ] Version numbers updated in all files +- [ ] SHA256 checksums updated (if applicable) +- [ ] Installation tested on clean system +- [ ] All tests pass + +--- +*This PR was automatically created by the auto-update workflow.* +*Related issue: #${issueNumber}* + +Closes #${issueNumber} +`; + + // Create the pull request + try { + const pr = await github.rest.pulls.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: `🔄 Update ${updateType} Dependencies`, + head: branchName, + base: context.payload.repository.default_branch, + body: prBody, + draft: true + }); + + console.log(`Created PR #${pr.data.number}`); + + // Add labels to PR + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.data.number, + labels: ['dependencies', 'automated', ...labels.filter(l => l !== 'enhancement')] + }); + + // Add comment to original issue with PR link + 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.` + }); + + console.log(`Successfully created PR and linked to issue #${issueNumber}`); + + } catch (error) { + console.error('Error creating PR:', error); + + // Comment on issue about the error + await github.rest.issues.createComment({ + 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.` + }); + + throw error; + } diff --git a/.github/workflows/check-dependencies.yml b/.github/workflows/check-dependencies.yml index 8295532..33a7166 100644 --- a/.github/workflows/check-dependencies.yml +++ b/.github/workflows/check-dependencies.yml @@ -268,6 +268,146 @@ jobs: console.log('Created new issue'); } + check-kubernetes-deps: + name: Check Kubernetes Dependencies + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Check Kubernetes version + id: kubernetes + run: | + CURRENT_VERSION=$(grep -oP 'K8S_VERSION:-\K[^}]+' kubernetes/kubernetes_installer.sh) + echo "current=$CURRENT_VERSION" >> $GITHUB_OUTPUT + + # Get latest stable version from Kubernetes releases + LATEST_VERSION=$(curl -sL https://dl.k8s.io/release/stable.txt | sed 's/\.[0-9]*$//') + echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT + + if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then + echo "update_needed=true" >> $GITHUB_OUTPUT + else + echo "update_needed=false" >> $GITHUB_OUTPUT + fi + + - name: Check Minikube version + id: minikube + run: | + # Get latest minikube version from GitHub releases + LATEST_VERSION=$(curl -sL -H "Authorization: Bearer ${{ github.token }}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/kubernetes/minikube/releases/latest | jq -r '.tag_name') + echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT + echo "Note: Minikube uses 'latest' in installer script" + echo "update_needed=false" >> $GITHUB_OUTPUT + + - name: Create or update issue + if: steps.kubernetes.outputs.update_needed == 'true' + uses: actions/github-script@v8 + env: + K8S_UPDATE_NEEDED: ${{ steps.kubernetes.outputs.update_needed }} + K8S_CURRENT: ${{ steps.kubernetes.outputs.current }} + K8S_LATEST: ${{ steps.kubernetes.outputs.latest }} + MINIKUBE_LATEST: ${{ steps.minikube.outputs.latest }} + with: + script: | + const issueTitle = '🔄 Kubernetes Dependencies Update Available'; + const issueBody = `## Kubernetes Installer Dependencies Update + + The following dependencies have updates available: + + ${process.env.K8S_UPDATE_NEEDED === 'true' ? `- **Kubernetes**: ${process.env.K8S_CURRENT} → ${process.env.K8S_LATEST}` : ''} + + **Note:** Minikube uses latest release automatically (current latest: ${process.env.MINIKUBE_LATEST}) + + ### Files to update: + - \`kubernetes/kubernetes_installer.sh\` + + ### Update steps: + 1. Update \`K8S_VERSION\` in the script + 2. Test the installation on a clean system + 3. Verify kubectl and minikube functionality + + --- + *This issue was automatically created by the dependency check workflow.* + *Last checked: ${new Date().toISOString()}*`; + + // Search for existing issue + const issues = await github.rest.issues.listForRepo({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + labels: 'dependencies,kubernetes' + }); + + const existingIssue = issues.data.find(issue => issue.title === issueTitle); + + if (existingIssue) { + await github.rest.issues.update({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: existingIssue.number, + body: issueBody + }); + console.log(`Updated issue #${existingIssue.number}`); + } else { + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: issueTitle, + body: issueBody, + labels: ['dependencies', 'kubernetes', 'enhancement'] + }); + console.log('Created new issue'); + } + + check-terraform-deps: + name: Check Terraform Dependencies + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Check Terraform version + id: terraform + run: | + # Terraform uses HashiCorp repositories, so check latest from HashiCorp + LATEST_VERSION=$(curl -sL https://checkpoint-api.hashicorp.com/v1/check/terraform | jq -r '.current_version') + echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT + echo "Note: Terraform installer uses HashiCorp repository, which provides latest versions" + echo "update_needed=false" >> $GITHUB_OUTPUT + + check-podman-deps: + name: Check Podman Dependencies + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Check Podman version + id: podman + run: | + # Podman uses distribution repositories, get latest from GitHub releases as reference + LATEST_VERSION=$(curl -sL -H "Authorization: Bearer ${{ github.token }}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/containers/podman/releases/latest | jq -r '.tag_name' | sed 's/v//') + echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT + echo "Note: Podman installer uses distribution repositories, not hardcoded versions" + echo "update_needed=false" >> $GITHUB_OUTPUT + + check-openssh-deps: + name: Check OpenSSH Dependencies + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Check OpenSSH version + id: openssh + run: | + # OpenSSH uses distribution repositories, get latest portable version as reference + LATEST_VERSION=$(curl -sL -H "Authorization: Bearer ${{ github.token }}" -H "Accept: application/vnd.github+json" https://api.github.com/repos/openssh/openssh-portable/releases/latest | jq -r '.tag_name' | sed 's/V_//;s/_/./g') + echo "latest=$LATEST_VERSION" >> $GITHUB_OUTPUT + echo "Note: OpenSSH installer uses distribution repositories, not hardcoded versions" + echo "update_needed=false" >> $GITHUB_OUTPUT + check-docker: name: Check Docker Installation runs-on: ubuntu-latest @@ -283,19 +423,23 @@ jobs: summary: name: Summary runs-on: ubuntu-latest - needs: [check-nginx-deps, check-ansible-deps, check-docker] + needs: [check-nginx-deps, check-ansible-deps, check-kubernetes-deps, check-terraform-deps, check-podman-deps, check-openssh-deps, check-docker] if: always() steps: - name: Summary run: | NGINX_RESULT="${{ needs.check-nginx-deps.result }}" ANSIBLE_RESULT="${{ needs.check-ansible-deps.result }}" + K8S_RESULT="${{ needs.check-kubernetes-deps.result }}" + TERRAFORM_RESULT="${{ needs.check-terraform-deps.result }}" + PODMAN_RESULT="${{ needs.check-podman-deps.result }}" + OPENSSH_RESULT="${{ needs.check-openssh-deps.result }}" DOCKER_RESULT="${{ needs.check-docker.result }}" echo "### Dependency Check Summary" >> "$GITHUB_STEP_SUMMARY" echo "" >> "$GITHUB_STEP_SUMMARY" - if [ "$NGINX_RESULT" = "success" ] && [ "$ANSIBLE_RESULT" = "success" ] && [ "$DOCKER_RESULT" = "success" ]; then + if [ "$NGINX_RESULT" = "success" ] && [ "$ANSIBLE_RESULT" = "success" ] && [ "$K8S_RESULT" = "success" ] && [ "$TERRAFORM_RESULT" = "success" ] && [ "$PODMAN_RESULT" = "success" ] && [ "$OPENSSH_RESULT" = "success" ] && [ "$DOCKER_RESULT" = "success" ]; then echo "✅ All dependency checks completed successfully." >> "$GITHUB_STEP_SUMMARY" else echo "⚠️ Some dependency checks did not complete successfully. See details below." >> "$GITHUB_STEP_SUMMARY" @@ -306,6 +450,10 @@ jobs: echo "|-----------------------|----------|" >> "$GITHUB_STEP_SUMMARY" echo "| NGINX dependencies | $NGINX_RESULT |" >> "$GITHUB_STEP_SUMMARY" echo "| Ansible dependencies | $ANSIBLE_RESULT |" >> "$GITHUB_STEP_SUMMARY" + echo "| Kubernetes dependencies | $K8S_RESULT |" >> "$GITHUB_STEP_SUMMARY" + echo "| Terraform installation | $TERRAFORM_RESULT |" >> "$GITHUB_STEP_SUMMARY" + echo "| Podman installation | $PODMAN_RESULT |" >> "$GITHUB_STEP_SUMMARY" + echo "| OpenSSH installation | $OPENSSH_RESULT |" >> "$GITHUB_STEP_SUMMARY" echo "| Docker installation | $DOCKER_RESULT |" >> "$GITHUB_STEP_SUMMARY" echo "" >> "$GITHUB_STEP_SUMMARY" echo "If any updates are needed, issues have been created or updated automatically." >> "$GITHUB_STEP_SUMMARY" \ No newline at end of file diff --git a/README.md b/README.md index b1d57cb..8e37d33 100644 --- a/README.md +++ b/README.md @@ -51,18 +51,30 @@ A GitHub Actions workflow runs weekly (every Monday at 9:00 AM UTC) to check for - Python (built from source) - Ansible (from PyPI) +**Kubernetes Installer:** +- Kubernetes (kubectl) version +- Minikube (uses latest release) + **Other Installers:** - Docker (uses official repositories) -- Kubernetes (kubectl) -- Terraform -- Podman -- OpenSSH - -When new versions are detected, the workflow automatically creates or updates GitHub issues with: -- Current vs. latest version comparison -- Files that need updating -- Step-by-step update instructions -- SHA256 checksum update reminders +- Terraform (uses HashiCorp repositories) +- Podman (uses distribution repositories) +- OpenSSH (uses distribution repositories) + +When new versions are detected, the workflow automatically: +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 + +This automated system ensures you're always notified of available updates and provides a streamlined workflow to apply them. ### Script Validation All installer scripts are automatically validated on every push and pull request: