|
| 1 | +name: Demo – configurable instance for debugging |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + instance_type: |
| 6 | + description: "EC2 instance type (e.g., t3.medium, t3.large)" |
| 7 | + required: false |
| 8 | + type: string |
| 9 | + default: "t3.large" |
| 10 | + image_id: |
| 11 | + description: "AMI ID to use" |
| 12 | + required: false |
| 13 | + type: string |
| 14 | + default: "ami-0e86e20dae9224db8" # Ubuntu 24.04 LTS x86_64 (us-east-1) |
| 15 | + registration_timeout: |
| 16 | + description: "Max seconds to wait for runner registration (default: 360)" |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + default: "360" |
| 20 | + initial_grace_period: |
| 21 | + description: "Grace period if no job starts (default: 180)" |
| 22 | + required: false |
| 23 | + type: string |
| 24 | + default: "180" |
| 25 | + grace_period: |
| 26 | + description: "Grace period before termination after job (default: 60)" |
| 27 | + required: false |
| 28 | + type: string |
| 29 | + default: "60" |
| 30 | + max_instance_lifetime: |
| 31 | + description: "Max instance lifetime in minutes (default: 360)" |
| 32 | + required: false |
| 33 | + type: string |
| 34 | + default: "360" |
| 35 | + sleep: |
| 36 | + description: "Sleep duration in seconds" |
| 37 | + required: false |
| 38 | + type: string |
| 39 | + default: "600" |
| 40 | + debug: |
| 41 | + description: "Enable debug mode (extends termination delay to 600s)" |
| 42 | + required: false |
| 43 | + type: boolean |
| 44 | + default: true |
| 45 | + |
| 46 | +permissions: |
| 47 | + id-token: write # Required for AWS OIDC authentication |
| 48 | + contents: read # Required for actions/checkout |
| 49 | + |
| 50 | +jobs: |
| 51 | + launch: |
| 52 | + name: Launch Debug Instance |
| 53 | + uses: ./.github/workflows/runner.yml |
| 54 | + with: |
| 55 | + ec2_instance_type: ${{ inputs.instance_type }} |
| 56 | + ec2_image_id: ${{ inputs.image_id }} |
| 57 | + debug: ${{ inputs.debug }} |
| 58 | + instance_name: "debug/$name#$run_number" |
| 59 | + runner_registration_timeout: ${{ inputs.registration_timeout }} |
| 60 | + runner_grace_period: ${{ inputs.grace_period }} |
| 61 | + runner_initial_grace_period: ${{ inputs.initial_grace_period }} |
| 62 | + max_instance_lifetime: ${{ inputs.max_instance_lifetime }} |
| 63 | + secrets: inherit |
| 64 | + |
| 65 | + test: |
| 66 | + needs: launch |
| 67 | + name: Test Job |
| 68 | + runs-on: ${{ needs.launch.outputs.id }} |
| 69 | + steps: |
| 70 | + - name: Instance Info |
| 71 | + run: | |
| 72 | + echo "=== Instance Information ===" |
| 73 | + echo "Hostname: $(hostname)" |
| 74 | + echo "Instance ID: $(curl -s http://169.254.169.254/latest/meta-data/instance-id)" |
| 75 | + echo "Instance type: $(curl -s http://169.254.169.254/latest/meta-data/instance-type)" |
| 76 | + echo "Public IP: $(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)" |
| 77 | + echo "Region: $(curl -s http://169.254.169.254/latest/meta-data/placement/region)" |
| 78 | + echo "AMI ID: $(curl -s http://169.254.169.254/latest/meta-data/ami-id)" |
| 79 | + echo "" |
| 80 | + echo "=== System Details ===" |
| 81 | + echo "OS: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)" |
| 82 | + echo "Kernel: $(uname -r)" |
| 83 | + echo "Architecture: $(uname -m)" |
| 84 | + echo "CPU cores: $(nproc)" |
| 85 | + echo "Memory: $(free -h | grep Mem | awk '{print $2}')" |
| 86 | + echo "User: $(whoami)" |
| 87 | + echo "Home: $HOME" |
| 88 | +
|
| 89 | + - name: Sleep Test |
| 90 | + run: | |
| 91 | + DURATION=${{ inputs.sleep }} |
| 92 | + echo "Starting sleep at: $(date '+%Y-%m-%d %H:%M:%S.%3N')" |
| 93 | + echo "Sleeping for ${DURATION} seconds..." |
| 94 | + sleep $DURATION |
| 95 | + echo "Finished at: $(date '+%Y-%m-%d %H:%M:%S.%3N')" |
| 96 | +
|
| 97 | + - name: Debug Info |
| 98 | + run: | |
| 99 | + echo "=== Runner Environment ===" |
| 100 | + echo "Runner home: ${RUNNER_HOME:-not set}" |
| 101 | + echo "Runner workspace: ${GITHUB_WORKSPACE:-not set}" |
| 102 | + echo "Runner temp: ${RUNNER_TEMP:-not set}" |
| 103 | + echo "" |
| 104 | + echo "=== Timeout Settings ===" |
| 105 | + echo "Debug mode: ${{ inputs.debug }}" |
| 106 | + echo "Registration timeout: ${{ inputs.registration_timeout }}s" |
| 107 | + echo "Grace period: ${{ inputs.grace_period }}s" |
| 108 | + echo "Initial grace period: ${{ inputs.initial_grace_period }}s" |
| 109 | + echo "Max lifetime: ${{ inputs.max_instance_lifetime }} minutes" |
| 110 | + echo "" |
| 111 | + echo "=== Important Logs ===" |
| 112 | + echo "Setup log: /var/log/runner-setup.log" |
| 113 | + echo "Debug log: /var/log/runner-debug.log" |
| 114 | + if [ -f /tmp/runner-0-config.log ]; then |
| 115 | + echo "Config log exists: /tmp/runner-0-config.log" |
| 116 | + echo "Last 5 lines of config log:" |
| 117 | + tail -5 /tmp/runner-0-config.log |
| 118 | + fi |
| 119 | +
|
0 commit comments