85 lines
No EOL
3 KiB
Markdown
85 lines
No EOL
3 KiB
Markdown
# Forgejo Runner Fix - Git Clone URL Issue
|
|
|
|
## 🐛 **Problem Identified**
|
|
|
|
The Forgejo Actions runner was failing with this error:
|
|
```
|
|
fatal: unable to access 'http://forgejo:3000/robojerk/deb-mock/': Could not resolve host: forgejo
|
|
```
|
|
|
|
## 🔍 **Root Cause**
|
|
|
|
The workflow was using GitHub Actions syntax that tried to clone from an internal Docker network address:
|
|
```yaml
|
|
# This was failing:
|
|
git clone ${{ github.server_url }}/${{ github.repository }} .
|
|
git checkout ${{ github.sha }}
|
|
```
|
|
|
|
The `${{ github.server_url }}` was resolving to `http://forgejo:3000`, which is an internal Docker network address that doesn't exist from the runner's perspective.
|
|
|
|
## ✅ **Solution Implemented**
|
|
|
|
Based on the working examples from [bootc-deb](https://git.raines.xyz/robojerk/bootc-deb/raw/branch/main/.forgejo/workflows/build-packages.yml), I fixed all workflows to use the proper external Forgejo URL:
|
|
|
|
### **Before (Failing)**
|
|
```yaml
|
|
- name: Checkout code
|
|
run: |
|
|
git clone ${{ github.server_url }}/${{ github.repository }} .
|
|
git checkout ${{ github.sha }}
|
|
```
|
|
|
|
### **After (Working)**
|
|
```yaml
|
|
- name: Checkout code
|
|
run: |
|
|
git clone https://git.raines.xyz/robojerk/deb-mock.git /tmp/deb-mock
|
|
cp -r /tmp/deb-mock/* .
|
|
cp -r /tmp/deb-mock/.* . 2>/dev/null || true
|
|
```
|
|
|
|
## 📁 **Files Fixed**
|
|
|
|
1. **`.forgejo/workflows/build.yml`** - Build workflow
|
|
2. **`.forgejo/workflows/test.yml`** - Test workflow
|
|
3. **`.forgejo/workflows/release.yml`** - Release workflow
|
|
4. **`.forgejo/workflows/update-readme.yml`** - Update README workflow
|
|
|
|
## 🎯 **Key Changes**
|
|
|
|
### **1. External URL Usage**
|
|
- **Before**: `${{ github.server_url }}/${{ github.repository }}` → `http://forgejo:3000/robojerk/deb-mock`
|
|
- **After**: `https://git.raines.xyz/robojerk/deb-mock.git` → External accessible URL
|
|
|
|
### **2. Proper Clone Strategy**
|
|
- **Before**: Direct clone to current directory with checkout
|
|
- **After**: Clone to `/tmp/deb-mock` then copy files (following bootc-deb pattern)
|
|
|
|
### **3. Error Handling**
|
|
- Added `2>/dev/null || true` to handle hidden files gracefully
|
|
|
|
## 🚀 **Expected Results**
|
|
|
|
With these fixes, the Forgejo Actions runner should now:
|
|
|
|
1. ✅ **Successfully clone** the repository from the external URL
|
|
2. ✅ **Copy all files** including hidden ones to the workspace
|
|
3. ✅ **Execute all workflow steps** without network connectivity issues
|
|
4. ✅ **Complete the build and test processes** successfully
|
|
|
|
## 📊 **Runner Log Analysis**
|
|
|
|
From the runner logs, we can see:
|
|
```
|
|
expression 'format('git clone {0}/{1} .\ngit checkout {2}\n', github.server_url, github.repository, github.sha)'
|
|
evaluated to '%!t(string=git clone http://forgejo:3000/robojerk/deb-mock .\ngit checkout 94a2914dff6848d50ea5181fc4676ba2a5800cdb\n)'
|
|
```
|
|
|
|
This confirms that the internal Docker network URL was being used, which is why the clone failed.
|
|
|
|
## 🎉 **Status**
|
|
|
|
**Fixed and Ready**: All workflows now use the proper external Forgejo URL pattern that matches the working bootc-deb examples.
|
|
|
|
The next push should trigger successful workflow execution! 🚀 |