Skip to content

Commit

Permalink
Add Forgejo Runner service (#257)
Browse files Browse the repository at this point in the history
* Add Forgejo Runner service

Signed-off-by: Sergio Durigan Junior <[email protected]>

* Update woodpecker-ci.md

---------

Signed-off-by: Sergio Durigan Junior <[email protected]>
Co-authored-by: Sergio Durigan Junior <[email protected]>
Co-authored-by: Slavi Pantaleev <[email protected]>
  • Loading branch information
3 people authored Sep 17, 2024
1 parent 13fcd5b commit 5bfda23
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 2 deletions.
57 changes: 57 additions & 0 deletions docs/services/forgejo-runner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Forgejo Runner

[Forgejo Runner](https://code.forgejo.org/forgejo/runner) is a runner to use with [Forgejo Actions](https://forgejo.org/docs/latest/admin/actions/). It provides a way to perform CI using Forgejo. You might also be interested in [Woodpecker CI](https://woodpecker-ci.org/) (that this playbook also [supports](woodpecker-ci.md)).

> [!WARNING]
> Upstream considers this software as being an **alpha release**, and says it should **not** be considered secure enough to deploy in production. Use at your own risk.

## Configuration

To enable this service, add the following configuration to your `vars.yml` file and re-run the [installation](../installing.md) process:

```yaml
########################################################################
# #
# forgejo-runner #
# #
########################################################################

forgejo_runner_enabled: true

forgejo_runner_runner_name: "Your Runner Name Here"

# The instance URL.
forgejo_runner_instance_url: "https://example.com"

# The registration token.
#
# Should be obtained via the web interface, by going to:
#
# Site Administration -> Actions -> Runners -> Create new runner
forgejo_runner_registration_token: "TOKEN_HERE"

# The capacity of the runner, i.e., how many concurrent tasks it can run.
forgejo_runner_capacity: 1

# The labels associated with this runner.
forgejo_runner_labels:
- ubuntu-22.04:docker://node:20-bullseye

########################################################################
# #
# /forgejo-runner #
# #
########################################################################
```

As mentioned in the example above, the registration token should be obtained via Forgejo's web interface, by going to `Site Administration -> Actions -> Runners -> Create new runner`.

Labels are an important aspect of the runner, and as such should be carefully chosen. Read [the official documentation](https://forgejo.org/docs/latest/admin/actions/#labels-and-runs-on) for more information.


## Usage

After the installation, the runner will register with the Forgejo instance (provided via the `forgejo_runner_instance_url` variable) and generate a `.runner` file inside its configuration path. This file should not be modified manually. If for some reason you wish to force the registration to run again, you can delete the `.runner` file and restart the service.

If you with to change the labels associated with the runner, you can simply modify the `forgejo_runner_labels` variable and run the playbook again. There is no need to delete the `.runner` file and run the registration again.
2 changes: 1 addition & 1 deletion docs/services/forgejo.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Going there, you'll be taken to the initial setup wizard, which will let you ass

## Recommended other services

You may also wish to look into [Woodpecker CI](woodpecker-ci.md), which can integrate nicely with Forgejo.
You may also wish to look into [Woodpecker CI](woodpecker-ci.md) and [Forgejo Runner](forgejo-runner.md), which can integrate nicely with Forgejo.


## Integration with Woodpecker CI
Expand Down
3 changes: 2 additions & 1 deletion docs/services/woodpecker-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

This playbook can install and configure [Woodpecker CI](https://woodpecker-ci.org/) for you.

Woodpecker CI is a [Continuous Integration](https://en.wikipedia.org/wiki/Continuous_integration) engine which can build and deploy your code automatically after pushing to a Gitea repository.
Woodpecker CI is a [Continuous Integration](https://en.wikipedia.org/wiki/Continuous_integration) engine which can build and deploy your code automatically after pushing to a [Gitea](./gitea.md) or [Forgejo](./forgejo.md) repository.
If you are using [Forgejo](./forgejo.md), you might also be interested in [Forgejo Runner](https://code.forgejo.org/forgejo/runner) (that this playbook also [supports](forgejo-runner.md)).

A Woodpecker CI installation contains 2 components:

Expand Down
1 change: 1 addition & 0 deletions docs/supported-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
| [Wetty](https://github.com/butlerx/wetty) | An SSH terminal over HTTP/HTTPS | [Link](services/wetty.md) |
| [WireGuard Easy](https://github.com/wg-easy/wg-easy) | The easiest way to run [WireGuard](https://www.wireguard.com/) VPN + Web-based Admin UI. | [Link](services/wg-easy.md) |
| [Forgejo](https://forgejo.org/) | An alternative fork of Gitea. Easy and painless self-hosted git server. | [Link](services/forgejo.md) |
| [Forgejo Runner](https://code.forgejo.org/forgejo/runner) | A runner to use with Forgejo Actions | [Link](services/forgejo-runner.md) |
| [Woodpecker CI](https://woodpecker-ci.org/) | A simple Continuous Integration (CI) engine with great extensibility. | [Link](services/woodpecker-ci.md) |
| [WordPress](https://wordpress.org/) | A widley used open source web content management system | [Link](services/wordpress.md) |
| [Writefreely](https://writefreely.org) | A clean, minimalist publishing platform made for writers with optional federation via ActivityPub. | [Link](services/writefreely.md) |
Expand Down
35 changes: 35 additions & 0 deletions templates/group_vars_mash_servers
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,11 @@ mash_playbook_devture_systemd_service_manager_services_list_auto_itemized:
{{ ({'name': (forgejo_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'forgejo', 'forgejo-server']} if forgejo_enabled else omit) }}
# /role-specific:forgejo

# role-specific:forgejo_runner
- |-
{{ ({'name': (forgejo_runner_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'forgejo-runner']} if forgejo_runner_enabled else omit) }}
# /role-specific:forgejo_runner

# role-specific:writefreely
- |-
{{ ({'name': (writefreely_identifier + '.service'), 'priority': 2000, 'groups': ['mash', 'writefreely']} if writefreely_enabled else omit) }}
Expand Down Expand Up @@ -5457,6 +5462,36 @@ forgejo_config_database_password: "{{ '%s' | format(mash_playbook_generic_secret



# role-specific:forgejo_runner
########################################################################
# #
# forgejo_runner #
# #
########################################################################

forgejo_runner_enabled: false

forgejo_runner_uid: "0"
forgejo_runner_gid: "0"

forgejo_runner_identifier: "{{ mash_playbook_service_identifier_prefix }}forgejo-runner"

forgejo_runner_base_path: "{{ mash_playbook_base_path }}/{{ mash_playbook_service_base_directory_name_prefix }}forgejo-runner"

forgejo_runner_systemd_required_systemd_services_list: |
{{
([devture_systemd_docker_base_docker_service_name] if devture_systemd_docker_base_docker_service_name else [])
}}

########################################################################
# #
# /forgejo_runner #
# #
########################################################################
# /role-specific:forgejo_runner



# role-specific:woodpecker_ci_server
########################################################################
# #
Expand Down
4 changes: 4 additions & 0 deletions templates/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
version: v8.0.3-0
name: forgejo
activation_prefix: forgejo_
- src: git+https://git.sergiodj.net/sergiodj/ansible-role-forgejo-runner.git
version: v3.5.1-0
name: forgejo_runner
activation_prefix: forgejo_runner_
- src: git+https://github.com/kinduff/ansible-docker-freshrss.git
version: v2.4.0
name: freshrss
Expand Down
4 changes: 4 additions & 0 deletions templates/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@
- role: galaxy/forgejo
# /role-specific:forgejo

# role-specific:forgejo_runner
- role: galaxy/forgejo_runner
# /role-specific:forgejo_runner

# role-specific:woodpecker_ci_server
- role: galaxy/woodpecker_ci_server
# /role-specific:woodpecker_ci_server
Expand Down

0 comments on commit 5bfda23

Please sign in to comment.