This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. Check config values being loaded | |
| docker exec jenkins-failure-agent python3 -c " | |
| from src.config import load_config | |
| cfg = load_config('/app/config.yaml') | |
| print(f'Jenkins URL: {cfg.jenkins.url}') | |
| print(f'Jenkins User: {cfg.jenkins.username}') | |
| print(f'Jenkins Token: {cfg.jenkins.api_token[:10]}...' if cfg.jenkins.api_token else 'Token: EMPTY') | |
| print(f'Verify SSL: {cfg.jenkins.verify_ssl}') | |
| " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pipeline: | |
| # ── Your actual service tag names ───────────────────────────────────────── | |
| # Must match exactly what appears before the colon in your log lines. | |
| # Log line: [2024-01-15T10:00:15.123z] service-exec: docker() | |
| # Tag: service-exec | |
| static_tags: | |
| - "service-exec" # ← replace with your real tag names | |
| - "service-deploy" | |
| - "service-test" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import yaml | |
| from pathlib import Path | |
| # Custom type to force PyYAML to use a literal block style (|) for multiline strings | |
| class LiteralStr(str): | |
| pass | |
| def represent_literal_str(dumper, data): | |
| # Use the YAML string tag and force literal style |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jenkins_create_token() { | |
| local user=$1 pass=$2 name=$3 jurl=$4 | |
| # Get CSRF crumb | |
| local crumb | |
| crumb=$(curl -s -u "$user:$pass" \ | |
| "$jurl/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,\":\",//crumb)") | |
| # Create token | |
| curl -s -u "$user:$pass" \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Instance ID | |
| INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
| # Region | |
| REGION=$(curl -s http://169.254.169.254/latest/dynamic/instance-identity/document \ | |
| | jq -r '.region') | |
| # Fetch the "Name" tag | |
| NAME=$(aws ec2 describe-tags \ | |
| --region $REGION \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| inal Version — jenkins_audit.py | |
| python | |
| #!/usr/bin/env python3 | |
| import argparse | |
| import os | |
| import requests | |
| from packaging.version import Version, InvalidVersion | |
| from tabulate import tabulate | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # cli.py | |
| import argparse | |
| import os | |
| from main import analyze_plugin | |
| def main(): | |
| parser = argparse.ArgumentParser( | |
| description="\U0001F9E9 Jenkins Plugin Compatibility Analyzer", | |
| formatter_class=argparse.ArgumentDefaultsHelpFormatter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Directory where plugin .hpi files will be stored | |
| # File: plugins.yaml | |
| # Define plugins with specific versions | |
| # Example YAML file to track plugin versions | |
| --- | |
| plugins: | |
| - name: git | |
| version: 5.1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import jenkins.model.* | |
| import hudson.PluginWrapper | |
| import java.nio.file.* | |
| def pluginDir = new File(Jenkins.instance.rootDir, "plugins") | |
| def pluginList = [ | |
| [name: "git", version: "5.2.1"], | |
| [name: "workflow-job", version: "2.40"] | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CloudBees CI (the enterprise version of Jenkins) uses Configuration as Code (CasC) bundles to manage plugins in a scalable, automated, and version-controlled way. Here's a detailed breakdown of how plugin management works within CasC bundles: | |
| A. What Is a CasC Bundle? | |
| A CasC bundle is a structured collection of YAML files that define the configuration of a CloudBees CI instance — including plugins, security, jobs, RBAC, and more. These bundles can be stored in Git and applied automatically to controllers via the CloudBees Operations Center. | |
| B. Plugin Management via CasC | |
| 1. plugins.yaml File | |
| This file lists all plugins that should be installed on a controller. It supports both CAP (CloudBees Assurance Program) plugins and custom plugins. |
NewerOlder