Explain how to make the user in Forgejo an Administrator or Owner of the repository so they can add repository-level runners
Some checks are pending
CI/CD Pipeline / Test Backend (push) Waiting to run
CI/CD Pipeline / Test Frontend (push) Waiting to run
CI/CD Pipeline / Build and Push Docker Images (push) Blocked by required conditions
CI/CD Pipeline / Deploy to Production (push) Blocked by required conditions

This commit is contained in:
continuist 2025-06-29 15:52:48 -04:00
parent 449000dfb3
commit e4e29b039d

View file

@ -927,7 +927,124 @@ sudo systemctl daemon-reload
sudo systemctl enable forgejo-runner.service
```
#### 7.4 Start Service
#### 7.4 Register Runner
**Important**: The runner must be registered with your Forgejo instance before it can start. This creates the required `.runner` configuration file.
**Step 1: Get Registration Token**
1. Go to your Forgejo repository
2. Navigate to **Settings → Actions → Runners**
3. Click **"New runner"**
4. Copy the registration token
**Step 2: Register the Runner**
```bash
# Switch to SERVICE_USER to register the runner
sudo su - SERVICE_USER
# Register the runner with your Forgejo instance
forgejo-runner register \
--instance https://your-forgejo-instance \
--token YOUR_REGISTRATION_TOKEN \
--name "ci-cd-runner" \
--labels "ubuntu-latest,docker" \
--no-interactive
# Exit SERVICE_USER shell
exit
```
**Important**: Replace `your-forgejo-instance` with your actual Forgejo instance URL and `YOUR_REGISTRATION_TOKEN` with the token you copied from Step 1.
**Forgejo Permissions Required**
To create a repository-level runner, you need **Repository Admin** or **Owner** permissions. Here's how to check and manage permissions:
**Check Your Current Permissions:**
1. Go to your repository: `https://your-forgejo-instance/your-username/your-repo`
2. Look for the **Settings** tab in the repository navigation
3. If you see **Actions** in the left sidebar under Settings, you have the right permissions
4. If you don't see Settings or Actions, you don't have admin access
**Add Repository Admin (Repository Owner Only):**
If you're the repository owner and need to give someone else admin access:
1. **Go to Repository Settings:**
- Navigate to your repository
- Click **Settings** tab
- Click **Collaborators** in the left sidebar
2. **Add Collaborator:**
- Click **Add Collaborator** button
- Enter the username or email of the person you want to add
- Select **Admin** from the role dropdown
- Click **Add Collaborator**
3. **Alternative: Manage Team Access (for Organizations):**
- Go to **Settings → Collaborators**
- Click **Manage Team Access**
- Add the team with **Admin** permissions
**Repository Roles and Permissions:**
| Role | Can Create Runners | Can Manage Repository | Can Push Code |
|------|-------------------|----------------------|---------------|
| **Owner** | ✅ Yes | ✅ Yes | ✅ Yes |
| **Admin** | ✅ Yes | ✅ Yes | ✅ Yes |
| **Write** | ❌ No | ❌ No | ✅ Yes |
| **Read** | ❌ No | ❌ No | ❌ No |
**If You Don't Have Permissions:**
**Option 1: Ask Repository Owner**
- Contact the person who owns the repository
- Ask them to create the runner and share the registration token with you
**Option 2: Use Organization/User Runner**
- If you have access to organization settings, create an org-level runner
- Or create a user-level runner if you own other repositories
**Option 3: Site Admin Help**
- Contact your Forgejo instance administrator to create a site-level runner
**Site Administrator: Setting Repository Admin (Forgejo Instance Admin)**
To add an existing user as an Administrator of an existing repository in Forgejo, follow these steps:
1. **Go to the repository**: Navigate to the main page of the repository you want to manage.
2. **Access repository settings**: Click on the "Settings" tab under your repository name.
3. **Go to Collaborators & teams**: In the sidebar, under the "Access" section, click on "Collaborators & teams".
4. **Manage access**: Under "Manage access", locate the existing user you want to make an administrator.
5. **Change their role**: Next to the user's name, select the "Role" dropdown menu and click on "Administrator".
**Important Note**: If the user is already the Owner of the repository, then they do not have to add themselves as an Administrator of the repository and indeed cannot. Repository owners automatically have all administrative permissions.
**Site Admin Commands (if using CLI):**
If your Forgejo instance supports command-line administration:
```bash
# Add user as repository admin via CLI
forgejo admin user change-status --admin --username target-user
# Or manage repository access directly
forgejo admin repo add-collaborator --repo owner/repo-name --user target-user --permission admin
```
**Important Notes for Site Administrators:**
- **Repository Admin** can manage the repository but cannot modify site-wide settings
- **Site Admin** retains full control over the Forgejo instance
- Changes take effect immediately for the user
- Consider the security implications of granting admin access
**What this does**:
- Creates the required `.runner` configuration file in the SERVICE_USER's home directory
- Registers the runner with your Forgejo instance
- Sets up the runner with appropriate labels for Ubuntu and Docker environments
#### 7.5 Start Service
```bash
# Start the Forgejo runner service
@ -944,7 +1061,7 @@ sudo systemctl status forgejo-runner.service
- The runner will now be available to accept and execute workflows from your Forgejo instance
- The service will automatically restart if it crashes or the system reboots
#### 7.5 Test Runner Configuration
#### 7.6 Test Runner Configuration
```bash
# Check if the runner is running