Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .claude/agents/oci-workflow-fixer.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ AUTH/CONFIG: "authentication|invalid.*ocid" → Alert user immediately
```bash
(export OCI_SHAPE="VM.Standard.A1.Flex" OCI_OCPUS="4" OCI_MEMORY_IN_GBS="24"; ./launch-instance.sh) &
(export OCI_SHAPE="VM.Standard.E2.1.Micro" OCI_OCPUS="" OCI_MEMORY_IN_GBS=""; ./launch-instance.sh) &
wait # 55s timeout protection
wait # Generous timeout for optimal success rate
```

### **Performance Benchmarks**
- **<20 seconds**: Optimal performance ✅
- **20-30 seconds**: Acceptable with minor delays
- **30-60 seconds**: Investigate - config/network issues ⚠️
- **>1 minute**: Critical - missing optimizations
### **Performance Benchmarks** (Updated for Public Repository)
- **<30 seconds**: Excellent performance ✅
- **30-60 seconds**: Good performance with proper Oracle API handling
- **1-3 minutes**: Acceptable with retry logic and capacity constraints
- **>5 minutes**: Investigate - likely configuration or network issues

### **Telegram Notification Policy**
- **NOTIFY**: Any instance created OR critical failures
Expand Down
10 changes: 5 additions & 5 deletions .claude/commands/analyze-oci.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ model: claude-sonnet-4-20250514

- GitHub Repository: !`git remote get-url origin | sed 's/^.*://;s/.git$//'`
- Workflow run details: !`gh run view $1 --json conclusion,status,databaseId,workflowDatabaseId,workflowName,headBranch,jobs`
- Complete log of Core OCI workflow step 'Launch OCI Instances (Parallel)':
!`gh run view $1 --log | grep 'Launch OCI Instances (Parallel)' | awk '{ sub(/^.*Z/,""); print }'`
- Complete log of OCI workflow steps:
!`gh run view $1 --log | grep 'OCI' | awk '{ sub(/^.*Z/,""); print }'`
- Log of only failed jobs:
!`gh run view $1 --log-failed | awk '{ sub(/^.*Z/,""); print }'`
- Workflow file: @.github/workflows/infrastructure-deployment.yml
Expand All @@ -22,19 +22,19 @@ Perform specialized OCI workflow analysis focusing on:
**CRITICAL PATTERNS TO VALIDATE**:
- Performance benchmarks: <20s optimal, 20-30s acceptable, >30s investigate
- OCI CLI optimization flags: --no-retry, --connection-timeout 5, --read-timeout 15
- Parallel execution: A1.Flex (4 OCPUs, 24GB) + E2.1.Micro (1 OCPU, 1GB)
- Separate jobs execution: ARM hunt (4 OCPUs, 24GB) + AMD hunt (1 OCPU, 1GB)
- Error classification: CAPACITY/DUPLICATE (success), TRANSIENT (retry), AUTH/CONFIG (alert)
- Circuit breaker behavior: 3 AD failures = skip

**ANALYSIS REQUIREMENTS**:
1. **Read CLAUDE.md** first for project-specific patterns and benchmarks
2. **Parse parallel execution logs** for environment variable injection validation
2. **Parse separate job logs** for environment variable injection validation
3. **Classify errors** according to documented patterns (capacity vs transient vs config)
4. **Validate notification policy** compliance (notify on success/critical, silent on capacity)
5. **Cross-reference git changes** that might affect workflow behavior

**OUTPUT STRUCTURE**:
- **Performance Analysis**: Timing vs benchmarks, parallel efficiency
- **Performance Analysis**: Timing vs benchmarks, separate jobs efficiency
- **Error Classification**: Pattern matching against CLAUDE.md specifications
- **Configuration Validation**: OCI CLI flags, environment variables, proxy settings
- **Root Cause**: Specific failure analysis with actionable fixes
Expand Down
2 changes: 1 addition & 1 deletion .claude/commands/manual-run-oci.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ model: claude-sonnet-4-20250514

- GitHub Repository: !`git remote get-url origin | sed 's/^.*://;s/.git$//'`

!`gh workflow run infrastructure-deployment.yml --ref $(git branch --show-current) -f check_existing_instance=false -f adaptive_scheduling=false -f region_optimization=false`
!`gh workflow run infrastructure-deployment.yml --ref $(git branch --show-current) -f check_existing_instance=false -f adaptive_scheduling=false -f region_optimization=false -f script_debug=true -f oci_api_debug=false`

- Workflow run id: !`gh run list --workflow infrastructure-deployment.yml --branch $(git branch --show-current) --limit 1 --json databaseId --jq '.[0].databaseId' | awk '{print($0)}' | column`

Expand Down
146 changes: 146 additions & 0 deletions .github/actions/setup-oci/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
name: 'Setup OCI Environment'
description: 'Sets up OCI CLI, Python, SSH, and caching for Oracle Cloud Infrastructure workflows'

inputs:
oci_user_ocid:
description: 'OCI User OCID'
required: true
oci_key_fingerprint:
description: 'OCI Key Fingerprint'
required: true
oci_tenancy_ocid:
description: 'OCI Tenancy OCID'
required: true
oci_region:
description: 'OCI Region'
required: true
oci_private_key:
description: 'OCI Private Key'
required: true
oci_proxy_url:
description: 'OCI Proxy URL (optional)'
required: false
instance_ssh_public_key:
description: 'SSH Public Key for instances'
required: true
telegram_token:
description: 'Telegram Bot Token'
required: false
telegram_user_id:
description: 'Telegram User ID'
required: false
enable_notifications:
description: 'Enable Telegram notifications'
required: false
default: 'true'

outputs:
cache_key:
description: 'Generated cache key for OCI state'
value: ${{ steps.cache-key.outputs.key }}
setup_completed:
description: 'Whether setup completed successfully'
value: 'true'

runs:
using: 'composite'
steps:
- name: Get current date for cache key
id: get-date
shell: bash
run: echo "date=$(date '+%Y-%m-%d')" >> "$GITHUB_OUTPUT"

- name: Generate cache key with region hash
id: cache-key
shell: bash
env:
OCI_REGION: ${{ inputs.oci_region }}
run: |
# Generate region hash to match state-manager.sh logic
region_hash=$(echo -n "$OCI_REGION" | sha256sum | cut -d' ' -f1 | head -c 8)
echo "key=oci-instances-${region_hash}-v1-${{ steps.get-date.outputs.date }}" >> "$GITHUB_OUTPUT"
echo "prefix=oci-instances-${region_hash}-v1-" >> "$GITHUB_OUTPUT"

- name: Restore instance state cache
id: cache-instance-state
uses: actions/cache/restore@v4.2.4
with:
path: .cache/oci-state
key: ${{ steps.cache-key.outputs.key }}
restore-keys: |
${{ steps.cache-key.outputs.prefix }}
oci-instances-

- name: Initialize state manager
shell: bash
env:
CACHE_ENABLED: "true"
CACHE_TTL_HOURS: "24"
CACHE_DATE_KEY: ${{ steps.get-date.outputs.date }}
run: |
# Make state manager executable
chmod +x scripts/state-manager.sh
# Initialize state management system
./scripts/state-manager.sh init
# Show current state for debugging
if [[ "${SCRIPT_DEBUG:-}" == "true" ]]; then
./scripts/state-manager.sh print
fi

- name: Create requirements file
shell: bash
run: echo "oci-cli" > requirements.txt

- name: Setup Python
uses: actions/setup-python@v5.6.0
id: setup-python
with:
python-version: '3.x'
check-latest: false
update-environment: true

- name: Cache pip dependencies
uses: actions/cache@v4.2.4
with:
path: |
~/.cache/pip
~/.local/lib
~/.local/bin
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pip-

- name: Install OCI CLI
shell: bash
run: pip install --user -r requirements.txt

- name: Production preflight check
shell: bash
env:
OCI_USER_OCID: ${{ inputs.oci_user_ocid }}
OCI_KEY_FINGERPRINT: ${{ inputs.oci_key_fingerprint }}
OCI_TENANCY_OCID: ${{ inputs.oci_tenancy_ocid }}
OCI_REGION: ${{ inputs.oci_region }}
OCI_PRIVATE_KEY: ${{ inputs.oci_private_key }}
OCI_PROXY_URL: ${{ inputs.oci_proxy_url }}
INSTANCE_SSH_PUBLIC_KEY: ${{ inputs.instance_ssh_public_key }}
TELEGRAM_TOKEN: ${{ inputs.telegram_token }}
TELEGRAM_USER_ID: ${{ inputs.telegram_user_id }}
ENABLE_NOTIFICATIONS: ${{ inputs.enable_notifications }}
run: ./scripts/preflight-check.sh

- name: Setup OCI and SSH configuration (parallel)
shell: bash
env:
OCI_USER_OCID: ${{ inputs.oci_user_ocid }}
OCI_KEY_FINGERPRINT: ${{ inputs.oci_key_fingerprint }}
OCI_TENANCY_OCID: ${{ inputs.oci_tenancy_ocid }}
OCI_REGION: ${{ inputs.oci_region }}
OCI_PRIVATE_KEY: ${{ inputs.oci_private_key }}
OCI_PROXY_URL: ${{ inputs.oci_proxy_url }}
INSTANCE_SSH_PUBLIC_KEY: ${{ inputs.instance_ssh_public_key }}
run: |
# Run setup scripts in parallel for faster execution
./scripts/setup-oci.sh &
./scripts/setup-ssh.sh &
wait
4 changes: 2 additions & 2 deletions .github/linters/.jscpd.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"threshold": 1,
"threshold": 3,
"reporters": ["html", "console"],
"ignore": ["node_modules/**", ".git/**", "docs/**", "tests/fixtures/**", "**/package-lock.json", "**/*.min.js"],
"ignore": ["node_modules/**", ".git/**", "docs/**", "tests/fixtures/**", "**/package-lock.json", "**/*.min.js", ".github/workflows/**/*.yml"],
"minLines": 6,
"minTokens": 60,
"format": ["javascript", "typescript", "bash", "shell", "yaml", "json"],
Expand Down
15 changes: 9 additions & 6 deletions .github/linters/.markdownlint.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"default": true,
"MD013": false,
"MD026": false,
"MD013": false,
"MD033": false,
"MD036": false,
"line-length": false,
"no-trailing-punctuation": false,
"no-emphasis-as-heading": false
"MD041": false,
"MD034": false,
"MD040": false,
"MD009": false,
"MD022": false,
"MD032": false,
"MD031": false,
"MD047": false
}
11 changes: 11 additions & 0 deletions .github/linters/.shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# ShellCheck configuration for OracleInstanceCreator
# Disable overly strict rules that conflict with our coding preferences

# Disable rules that are too restrictive for our use case
disable=SC2034 # Unused variables (common in scripts with sourcing)
disable=SC2086 # Double quote to prevent globbing (sometimes intentional)
disable=SC2181 # Check exit code directly (sometimes $? is clearer)
disable=SC1091 # Not following sourced files (external dependencies)
disable=SC2155 # Declare and assign separately (sometimes combined is clearer)
disable=SC2001 # See if you can use ${variable//search/replace} instead of sed
disable=SC2329 # Function never invoked (test functions called indirectly)
Loading