|
| 1 | +# CI Debugging Guide |
| 2 | + |
| 3 | +## Firebird Log Display on Test Failures |
| 4 | + |
| 5 | +### Overview |
| 6 | +When tests fail in the CI pipeline, the workflow automatically displays Firebird server logs to help with debugging. This feature was added to make it easier to diagnose connection, authentication, and other Firebird-related issues. |
| 7 | + |
| 8 | +### What Gets Displayed |
| 9 | + |
| 10 | +When a test fails, the following information is automatically shown: |
| 11 | + |
| 12 | +1. **Firebird Server Log** (last 100 lines) |
| 13 | + - Location: `/firebird/log/firebird.log` inside the Docker container |
| 14 | + - Contains Firebird server events, errors, warnings, and diagnostic information |
| 15 | + - Useful for diagnosing authentication failures, connection issues, and SQL errors |
| 16 | + |
| 17 | +2. **Docker Container Status** |
| 18 | + - Shows if the Firebird container is running, stopped, or has exited |
| 19 | + - Displays container ID, image, status, and ports |
| 20 | + - Command: `docker ps -a` |
| 21 | + |
| 22 | +3. **Docker Container Logs** (last 50 lines) |
| 23 | + - Shows the stdout/stderr output from the Firebird container |
| 24 | + - Includes startup messages and any runtime errors |
| 25 | + - Command: `docker logs firebird --tail 50` |
| 26 | + |
| 27 | +### How It Works |
| 28 | + |
| 29 | +The workflow uses GitHub Actions' conditional execution: |
| 30 | + |
| 31 | +```yaml |
| 32 | +- name: Show Firebird log on failure |
| 33 | + if: failure() |
| 34 | + run: | |
| 35 | + # Display Firebird log |
| 36 | + docker exec firebird tail -n 100 /firebird/log/firebird.log || echo "Could not read firebird.log" |
| 37 | + # Display container status |
| 38 | + docker ps -a |
| 39 | + # Display container logs |
| 40 | + docker logs firebird --tail 50 |
| 41 | +``` |
| 42 | +
|
| 43 | +**Key Features:** |
| 44 | +- Only runs when previous steps fail (`if: failure()`) |
| 45 | +- No performance impact on successful builds |
| 46 | +- Gracefully handles missing log file with fallback message |
| 47 | +- Works with all Firebird versions (3, 4, 5) |
| 48 | + |
| 49 | +### Interpreting the Output |
| 50 | + |
| 51 | +#### Common Firebird Log Patterns |
| 52 | + |
| 53 | +**Authentication Failures:** |
| 54 | +``` |
| 55 | +INET/inet_error: read errno = 104 |
| 56 | +login by SYSDBA failed (authentication failed) |
| 57 | +``` |
| 58 | +
|
| 59 | +**Connection Issues:** |
| 60 | +``` |
| 61 | +INET/inet_error: connect errno = 111 |
| 62 | +connection refused |
| 63 | +``` |
| 64 | +
|
| 65 | +**Database Errors:** |
| 66 | +``` |
| 67 | +Database: /firebird/data/test.fdb |
| 68 | +validation error |
| 69 | +``` |
| 70 | +
|
| 71 | +#### Docker Container Status |
| 72 | +
|
| 73 | +**Running Container:** |
| 74 | +``` |
| 75 | +CONTAINER ID IMAGE STATUS |
| 76 | +abc123... firebirdsql/firebird:5 Up 2 minutes |
| 77 | +``` |
| 78 | +
|
| 79 | +**Stopped Container:** |
| 80 | +``` |
| 81 | +CONTAINER ID IMAGE STATUS |
| 82 | +abc123... firebirdsql/firebird:5 Exited (1) 2 minutes ago |
| 83 | +``` |
| 84 | +
|
| 85 | +### Testing Locally |
| 86 | +
|
| 87 | +To test the Firebird log display locally: |
| 88 | +
|
| 89 | +1. Start Firebird Docker container: |
| 90 | + ```bash |
| 91 | + docker run -d --name firebird \ |
| 92 | + -e FIREBIRD_ROOT_PASSWORD="masterkey" \ |
| 93 | + -p 3050:3050 \ |
| 94 | + firebirdsql/firebird:5 |
| 95 | + ``` |
| 96 | + |
| 97 | +2. View Firebird log: |
| 98 | + ```bash |
| 99 | + docker exec firebird tail -n 100 /firebird/log/firebird.log |
| 100 | + ``` |
| 101 | + |
| 102 | +3. Check container status: |
| 103 | + ```bash |
| 104 | + docker ps -a |
| 105 | + ``` |
| 106 | + |
| 107 | +4. View container logs: |
| 108 | + ```bash |
| 109 | + docker logs firebird --tail 50 |
| 110 | + ``` |
| 111 | + |
| 112 | +### Troubleshooting |
| 113 | + |
| 114 | +**"Could not read firebird.log" message:** |
| 115 | +- The log file may not exist yet (Firebird hasn't started) |
| 116 | +- The log path may be different (though it's standard across versions 3-5) |
| 117 | +- Check the Docker container logs for more information |
| 118 | + |
| 119 | +**No output shown:** |
| 120 | +- Verify the step ran (check GitHub Actions logs) |
| 121 | +- Ensure the `if: failure()` condition was triggered |
| 122 | +- Check that the Firebird container is running |
| 123 | + |
| 124 | +**Container not found:** |
| 125 | +- The container may have been removed before this step ran |
| 126 | +- Check earlier steps in the workflow for container lifecycle issues |
| 127 | + |
| 128 | +### Related Documentation |
| 129 | + |
| 130 | +- [Firebird Documentation](https://firebirdsql.org/en/documentation/) |
| 131 | +- [GitHub Actions Conditional Execution](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif) |
| 132 | +- [Docker Logging](https://docs.docker.com/config/containers/logging/) |
| 133 | + |
| 134 | +### Contributing |
| 135 | + |
| 136 | +If you encounter issues with the log display or have suggestions for improvement: |
| 137 | + |
| 138 | +1. Check if the Firebird log path has changed in newer versions |
| 139 | +2. Verify the Docker container name matches (`firebird`) |
| 140 | +3. Test with different Firebird versions (3, 4, 5) |
| 141 | +4. Submit an issue or pull request with your findings |
| 142 | + |
| 143 | +### Version History |
| 144 | + |
| 145 | +- **2026-03-23**: Initial implementation |
| 146 | + - Added automatic Firebird log display on test failure |
| 147 | + - Includes Docker container status and logs |
| 148 | + - Works with Firebird 3, 4, and 5 |
0 commit comments