Initial commit
This commit is contained in:
4
gitea/gitea-ns.yaml
Normal file
4
gitea/gitea-ns.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: gitea
|
||||
38
gitea/gitea/gitea-pvc.yaml
Normal file
38
gitea/gitea/gitea-pvc.yaml
Normal file
@@ -0,0 +1,38 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: containers-data-smb
|
||||
spec:
|
||||
capacity:
|
||||
storage: 5Gi
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
mountOptions:
|
||||
- dir_mode=0700
|
||||
- file_mode=0700
|
||||
- noperm
|
||||
- uid=1000
|
||||
- gid=1000
|
||||
csi:
|
||||
driver: smb.csi.k8s.io
|
||||
volumeHandle: containers
|
||||
volumeAttributes:
|
||||
source: "//10.8.14.2/containers"
|
||||
nodeStageSecretRef:
|
||||
name: gitea-secrets
|
||||
namespace: gitea
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
namespace: gitea
|
||||
name: gitea-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
||||
volumeName: containers-data-smb
|
||||
storageClassName: ""
|
||||
14
gitea/gitea/gitea-svc.yaml
Normal file
14
gitea/gitea/gitea-svc.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gitea
|
||||
namespace: gitea
|
||||
spec:
|
||||
selector:
|
||||
app: gitea
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: gitea-svc
|
||||
protocol: TCP
|
||||
port: 3000
|
||||
targetPort: 3000
|
||||
71
gitea/gitea/gitea.yaml
Normal file
71
gitea/gitea/gitea.yaml
Normal file
@@ -0,0 +1,71 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: gitea
|
||||
namespace: gitea
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gitea
|
||||
serviceName: gitea
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gitea
|
||||
spec:
|
||||
terminationGracePeriodSeconds: 60
|
||||
containers:
|
||||
- name: gitea
|
||||
image: docker.gitea.com/gitea:1.25
|
||||
resources:
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 1Gi
|
||||
ports:
|
||||
- containerPort: 3000
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
subPath: Gitea
|
||||
env:
|
||||
- name: GITEA__database__HOST
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: db_host
|
||||
- name: GITEA__database__DB_TYPE
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: db_type
|
||||
- name: GITEA__database__NAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: db_name
|
||||
- name: GITEA__database__USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: db_user
|
||||
- name: GITEA__database__PASSWD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: db_password
|
||||
- name: USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: gitea_user
|
||||
restartPolicy: Always
|
||||
volumes:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: gitea-pvc
|
||||
|
||||
|
||||
51
gitea/httproute.yaml
Normal file
51
gitea/httproute.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: gitea-route
|
||||
namespace: gitea
|
||||
spec:
|
||||
parentRefs:
|
||||
- group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: gateway-internal
|
||||
namespace: envoy-gateway
|
||||
sectionName: gitea
|
||||
- group: gateway.networking.k8s.io
|
||||
kind: Gateway
|
||||
name: gateway-public
|
||||
namespace: envoy-gateway
|
||||
sectionName: gitea
|
||||
hostnames:
|
||||
- "gitea.jsme.be"
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
filters:
|
||||
- type: RequestHeaderModifier
|
||||
requestHeaderModifier:
|
||||
set:
|
||||
- name: X-Forwarded-Host
|
||||
value: "gitea.jsme.be"
|
||||
- name: X-Forwarded-Proto
|
||||
value: https
|
||||
- type: ResponseHeaderModifier
|
||||
responseHeaderModifier:
|
||||
set:
|
||||
- name: Strict-Transport-Security
|
||||
value: "max-age=31536000; includeSubDomains"
|
||||
- name: X-Content-Type-Options
|
||||
value: nosniff
|
||||
- name: X-Frame-Options
|
||||
value: SAMEORIGIN
|
||||
- name: Referrer-Policy
|
||||
value: strict-origin-when-cross-origin
|
||||
- name: Permissions-Policy
|
||||
value: "camera=(), microphone=(), geolocation=(), payment=()"
|
||||
backendRefs:
|
||||
- name: gitea
|
||||
port: 3000
|
||||
kind: Service
|
||||
group: ""
|
||||
weight: 1
|
||||
55
gitea/postgres/postgres.yaml
Normal file
55
gitea/postgres/postgres.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
namespace: gitea
|
||||
name: gitea-postgresql
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: gitea-postgresql
|
||||
serviceName: gitea-postgresql
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: gitea-postgresql
|
||||
spec:
|
||||
restartPolicy: Always
|
||||
terminationGracePeriodSeconds: 60
|
||||
containers:
|
||||
- name: gitea-postgresql
|
||||
image: postgres:18
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
volumeMounts:
|
||||
- name: gitea-postgresql-database
|
||||
mountPath: /var/lib/postgresql/volumes/pgdata
|
||||
env:
|
||||
- name: POSTGRES_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: db_password
|
||||
- name: POSTGRES_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: db_user
|
||||
- name: POSTGRES_DB
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: gitea-secrets
|
||||
key: db_name
|
||||
- name: PGDATA
|
||||
value: /var/lib/postgresql/volumes/pgdata/data
|
||||
volumes:
|
||||
- name: gitea-postgresql-database
|
||||
persistentVolumeClaim:
|
||||
claimName: gitea-postgresql-pvc
|
||||
13
gitea/postgres/postgresql-pvc.yaml
Normal file
13
gitea/postgres/postgresql-pvc.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
namespace: gitea
|
||||
name: gitea-postgresql-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteMany
|
||||
storageClassName: longhorn-static
|
||||
volumeName: gitea-postgresql-data
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
14
gitea/postgres/postgresql-svc.yaml
Normal file
14
gitea/postgres/postgresql-svc.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: gitea-postgresql
|
||||
namespace: gitea
|
||||
spec:
|
||||
selector:
|
||||
app: gitea-postgresql
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- name: postgresql-port
|
||||
protocol: TCP
|
||||
port: 5432
|
||||
targetPort: 5432
|
||||
500
gitea/runner/GITEA-ACTIONS.md
Normal file
500
gitea/runner/GITEA-ACTIONS.md
Normal file
@@ -0,0 +1,500 @@
|
||||
# Gitea Actions Reference
|
||||
|
||||
> Based on Gitea 1.21+ and act_runner v0.2.x
|
||||
> Gitea Actions is compatible with GitHub Actions syntax. Both `github.*` and `gitea.*` context namespaces work; prefer `gitea.*` for Gitea-specific deployments.
|
||||
|
||||
---
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Workflow File Location](#workflow-file-location)
|
||||
2. [Trigger Events (`on:`)](#trigger-events-on)
|
||||
3. [Context Variables](#context-variables)
|
||||
4. [Secrets](#secrets)
|
||||
5. [Variables (`vars`)](#variables-vars)
|
||||
6. [Built-in Environment Variables](#built-in-environment-variables)
|
||||
7. [Expression Syntax & Functions](#expression-syntax--functions)
|
||||
8. [Runner Labels](#runner-labels)
|
||||
9. [Differences from GitHub Actions](#differences-from-github-actions)
|
||||
10. [Unsupported Features](#unsupported-features)
|
||||
11. [Badge URLs](#badge-urls)
|
||||
|
||||
---
|
||||
|
||||
## Workflow File Location
|
||||
|
||||
```
|
||||
.gitea/workflows/<name>.yaml
|
||||
```
|
||||
|
||||
Basic structure:
|
||||
|
||||
```yaml
|
||||
name: My Workflow
|
||||
run-name: ${{ gitea.actor }} triggered ${{ gitea.event_name }}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run something
|
||||
run: echo "Hello from ${{ gitea.actor }}"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Trigger Events (`on:`)
|
||||
|
||||
### Supported Events
|
||||
|
||||
| Event | Activity Types |
|
||||
|---|---|
|
||||
| `push` | — |
|
||||
| `pull_request` | `opened`, `edited`, `closed`, `reopened`, `assigned`, `unassigned`, `synchronize`, `labeled`, `unlabeled` |
|
||||
| `pull_request_review` | `submitted`, `edited` |
|
||||
| `pull_request_review_comment` | `created`, `edited` |
|
||||
| `issues` | `opened`, `edited`, `closed`, `reopened`, `assigned`, `unassigned`, `milestoned`, `demilestoned`, `labeled`, `unlabeled` |
|
||||
| `issue_comment` | `created`, `edited`, `deleted` |
|
||||
| `release` | `published`, `edited` |
|
||||
| `registry_package` | `published` |
|
||||
| `create` | — |
|
||||
| `delete` | — |
|
||||
| `fork` | — |
|
||||
| `gollum` | — |
|
||||
| `workflow_dispatch` | — |
|
||||
| `workflow_run` | `requested`, `completed` |
|
||||
| `schedule` | — |
|
||||
|
||||
### Filter Options
|
||||
|
||||
```yaml
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- 'feature/**'
|
||||
tags:
|
||||
- 'v*'
|
||||
paths:
|
||||
- 'src/**'
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
branches:
|
||||
- main
|
||||
schedule:
|
||||
- cron: '0 1 * * *'
|
||||
- cron: '@daily' # Gitea extension (not available in GitHub Actions)
|
||||
- cron: '@hourly' # Gitea extension
|
||||
- cron: '@weekly' # Gitea extension
|
||||
- cron: '@monthly' # Gitea extension
|
||||
- cron: '@yearly' # Gitea extension
|
||||
```
|
||||
|
||||
### `workflow_dispatch` with Inputs
|
||||
|
||||
Adds a "Run workflow" button in the Gitea UI. The workflow must be on the **default branch** to appear.
|
||||
|
||||
```yaml
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: 'Target environment'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- staging
|
||||
- production
|
||||
dry_run:
|
||||
description: 'Dry run'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
version:
|
||||
description: 'Version number'
|
||||
type: string
|
||||
```
|
||||
|
||||
Supported input types: `string`, `boolean`, `choice`, `number`, `environment`
|
||||
|
||||
Access inputs via: `${{ inputs.environment }}` or `${{ gitea.event.inputs.environment }}`
|
||||
|
||||
---
|
||||
|
||||
## Context Variables
|
||||
|
||||
### `gitea.*` / `github.*`
|
||||
|
||||
Both namespaces are identical. Prefer `gitea.*`.
|
||||
|
||||
| Variable | Description |
|
||||
|---|---|
|
||||
| `gitea.actor` | Username that triggered the workflow |
|
||||
| `gitea.event_name` | Triggering event name (`push`, `pull_request`, etc.) |
|
||||
| `gitea.event` | Full event payload object |
|
||||
| `gitea.ref` | Full ref (`refs/heads/main`, `refs/pull/1/head`) |
|
||||
| `gitea.ref_name` | Short ref name (`main`, `v1.0`) |
|
||||
| `gitea.ref_type` | `branch` or `tag` |
|
||||
| `gitea.sha` | Full commit SHA |
|
||||
| `gitea.repository` | `owner/repo` |
|
||||
| `gitea.repository_owner` | Repository owner (user or org name) |
|
||||
| `gitea.workspace` | Workspace path on the runner |
|
||||
| `gitea.run_id` | Unique ID for this workflow run |
|
||||
| `gitea.run_number` | Sequential run number for this workflow |
|
||||
| `gitea.server_url` | Gitea instance base URL |
|
||||
| `gitea.api_url` | Gitea API URL |
|
||||
| `gitea.head_ref` | PR source branch name |
|
||||
| `gitea.base_ref` | PR target branch name |
|
||||
| `gitea.token` | Auto-generated short-lived job token |
|
||||
| `gitea.workflow` | Workflow name |
|
||||
| `gitea.job` | Current job ID |
|
||||
|
||||
> **Note**: `gitea.repository_owner` preserves original casing. Use `tr '[:upper:]' '[:lower:]'` when used in Docker image tags.
|
||||
|
||||
### `runner.*`
|
||||
|
||||
| Variable | Description |
|
||||
|---|---|
|
||||
| `runner.os` | `Linux`, `Windows`, or `macOS` |
|
||||
| `runner.arch` | `X64`, `ARM64`, etc. |
|
||||
| `runner.name` | Runner name |
|
||||
| `runner.tool_cache` | Tool cache directory |
|
||||
| `runner.temp` | Temp directory |
|
||||
|
||||
### `steps.*`
|
||||
|
||||
```yaml
|
||||
steps.<step_id>.outputs.<output_name>
|
||||
steps.<step_id>.conclusion # success, failure, cancelled, skipped
|
||||
steps.<step_id>.outcome # success, failure, cancelled, skipped
|
||||
```
|
||||
|
||||
### `needs.*`
|
||||
|
||||
```yaml
|
||||
needs.<job_id>.outputs.<output_name>
|
||||
needs.<job_id>.result # success, failure, cancelled, skipped
|
||||
```
|
||||
|
||||
### `secrets.*`
|
||||
|
||||
```yaml
|
||||
secrets.GITEA_TOKEN # auto-generated job token (cannot push to package registry)
|
||||
secrets.GITHUB_TOKEN # alias for the same token
|
||||
secrets.<SECRET_NAME> # user-defined secrets
|
||||
```
|
||||
|
||||
### `vars.*`
|
||||
|
||||
```yaml
|
||||
vars.<VARIABLE_NAME> # non-sensitive config variables (stored in UPPERCASE)
|
||||
```
|
||||
|
||||
### `inputs.*`
|
||||
|
||||
```yaml
|
||||
inputs.<input_name> # for workflow_dispatch and workflow_call
|
||||
```
|
||||
|
||||
### `matrix.*` / `strategy.*`
|
||||
|
||||
```yaml
|
||||
matrix.<dimension> # current matrix combination value
|
||||
strategy.fail-fast
|
||||
strategy.max-parallel
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Secrets
|
||||
|
||||
### Scope (highest to lowest priority)
|
||||
|
||||
1. Repository secrets
|
||||
2. Organization secrets
|
||||
3. User secrets
|
||||
|
||||
### Rules
|
||||
|
||||
- Allowed characters: `[a-zA-Z0-9_]`
|
||||
- Cannot start with `GITHUB_`, `GITEA_`, or a number
|
||||
- Case-insensitive
|
||||
|
||||
### Usage
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- name: Use secret
|
||||
env:
|
||||
API_KEY: ${{ secrets.API_KEY }}
|
||||
run: ./deploy.sh $API_KEY
|
||||
```
|
||||
|
||||
### Auto Token (`GITEA_TOKEN`)
|
||||
|
||||
Automatically injected into every job. Short-lived — invalidated when the job completes.
|
||||
|
||||
**Known limitation**: `GITEA_TOKEN` / `GITHUB_TOKEN` **cannot push to the Gitea package/container registry**. Use a Personal Access Token (PAT) with `package` scope stored as a manual secret instead.
|
||||
|
||||
---
|
||||
|
||||
## Variables (`vars`)
|
||||
|
||||
Non-sensitive configuration values, visible in logs.
|
||||
|
||||
### Scope (highest to lowest priority)
|
||||
|
||||
1. Repository variables
|
||||
2. Organization variables
|
||||
3. User variables
|
||||
|
||||
### Rules
|
||||
|
||||
- Allowed characters: `[a-zA-Z0-9_]`
|
||||
- Cannot start with `GITHUB_`, `GITEA_`, `CI`, or a number
|
||||
- Keys are stored and accessed in **UPPERCASE**
|
||||
|
||||
### Usage
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- run: echo "Deploying to ${{ vars.ENVIRONMENT }}"
|
||||
```
|
||||
|
||||
### Inline `env` (workflow/job/step level)
|
||||
|
||||
```yaml
|
||||
env:
|
||||
GLOBAL_VAR: "value" # available to all jobs
|
||||
|
||||
jobs:
|
||||
build:
|
||||
env:
|
||||
JOB_VAR: "value" # available to all steps in this job
|
||||
steps:
|
||||
- env:
|
||||
STEP_VAR: "value" # only this step
|
||||
run: echo $STEP_VAR
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Built-in Environment Variables
|
||||
|
||||
Automatically injected into every step:
|
||||
|
||||
| Variable | Description |
|
||||
|---|---|
|
||||
| `CI` | Always `true` |
|
||||
| `GITHUB_WORKFLOW` / `GITEA_WORKFLOW` | Workflow name |
|
||||
| `GITHUB_RUN_ID` / `GITEA_RUN_ID` | Unique run ID |
|
||||
| `GITHUB_RUN_NUMBER` / `GITEA_RUN_NUMBER` | Sequential run number |
|
||||
| `GITHUB_ACTOR` / `GITEA_ACTOR` | Triggering username |
|
||||
| `GITHUB_REPOSITORY` | `owner/repo` |
|
||||
| `GITHUB_EVENT_NAME` | Event name |
|
||||
| `GITHUB_SHA` | Commit SHA |
|
||||
| `GITHUB_REF` | Full ref |
|
||||
| `GITHUB_REF_NAME` | Short ref name |
|
||||
| `GITHUB_REF_TYPE` | `branch` or `tag` |
|
||||
| `GITHUB_HEAD_REF` | PR source branch |
|
||||
| `GITHUB_BASE_REF` | PR target branch |
|
||||
| `GITHUB_WORKSPACE` | Workspace directory |
|
||||
| `GITHUB_SERVER_URL` | Gitea instance URL |
|
||||
| `GITHUB_API_URL` | Gitea API URL |
|
||||
| `GITHUB_TOKEN` / `GITEA_TOKEN` | Auto job token |
|
||||
| `RUNNER_OS` | Runner OS |
|
||||
| `RUNNER_ARCH` | Runner architecture |
|
||||
| `RUNNER_NAME` | Runner name |
|
||||
| `RUNNER_TEMP` | Temp directory |
|
||||
| `RUNNER_TOOL_CACHE` | Tool cache directory |
|
||||
|
||||
---
|
||||
|
||||
## Expression Syntax & Functions
|
||||
|
||||
### Syntax
|
||||
|
||||
```yaml
|
||||
${{ <expression> }}
|
||||
|
||||
# In `if:` blocks, the ${{ }} wrapper is optional:
|
||||
if: github.ref == 'refs/heads/main'
|
||||
if: ${{ github.ref == 'refs/heads/main' }}
|
||||
```
|
||||
|
||||
### Operators
|
||||
|
||||
| Operator | Description |
|
||||
|---|---|
|
||||
| `( )` | Grouping |
|
||||
| `[ ]` | Index |
|
||||
| `.` | Property access |
|
||||
| `!` | Not |
|
||||
| `<` `>` `<=` `>=` | Comparison |
|
||||
| `==` `!=` | Equality |
|
||||
| `&&` `\|\|` | Logical AND / OR |
|
||||
|
||||
### Functions
|
||||
|
||||
| Function | Description |
|
||||
|---|---|
|
||||
| `contains(search, item)` | True if string/array contains item |
|
||||
| `startsWith(str, prefix)` | Case-insensitive prefix check |
|
||||
| `endsWith(str, suffix)` | Case-insensitive suffix check |
|
||||
| `format(str, val0, val1, ...)` | String formatting with `{0}`, `{1}` placeholders |
|
||||
| `join(array, separator)` | Join array with delimiter |
|
||||
| `toJSON(value)` | Serialize to JSON string |
|
||||
| `fromJSON(value)` | Parse JSON string to object |
|
||||
| `hashFiles(path)` | SHA-256 hash of file(s) matching glob |
|
||||
| `success()` | True if all previous steps succeeded |
|
||||
| `failure()` | True if any previous step failed |
|
||||
| `cancelled()` | True if workflow was cancelled |
|
||||
| `always()` | Always true; forces step execution |
|
||||
|
||||
### Examples
|
||||
|
||||
```yaml
|
||||
if: contains(gitea.ref, 'main')
|
||||
if: startsWith(gitea.ref, 'refs/tags/')
|
||||
if: always()
|
||||
if: failure()
|
||||
if: success() && gitea.ref == 'refs/heads/main'
|
||||
run: echo ${{ format('Hello {0}', gitea.actor) }}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Runner Labels
|
||||
|
||||
Labels map `runs-on:` values in workflows to runner execution environments.
|
||||
|
||||
### Label Format
|
||||
|
||||
```
|
||||
<label>:<schema>:<image>
|
||||
```
|
||||
|
||||
- `docker://<image>` — run the job in a Docker container
|
||||
- `host` — run directly on the runner host machine
|
||||
|
||||
### Examples
|
||||
|
||||
```yaml
|
||||
# In act_runner config.yaml
|
||||
runner:
|
||||
labels:
|
||||
- "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
|
||||
- "ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04"
|
||||
- "node18:docker://node:18-bullseye"
|
||||
- "python311:docker://python:3.11-slim"
|
||||
- "native:host"
|
||||
```
|
||||
|
||||
### Runner Scope
|
||||
|
||||
| Scope | Picks up jobs from |
|
||||
|---|---|
|
||||
| Instance-level | All repos on the Gitea instance |
|
||||
| Organization-level | All repos in that organization |
|
||||
| Repository-level | That specific repo only |
|
||||
|
||||
### Registering a Runner
|
||||
|
||||
```bash
|
||||
# Interactive
|
||||
./act_runner register
|
||||
|
||||
# Non-interactive
|
||||
./act_runner register \
|
||||
--instance https://gitea.example.com \
|
||||
--token <registration-token> \
|
||||
--name my-runner \
|
||||
--labels ubuntu-latest:docker://gitea/runner-images:ubuntu-latest
|
||||
```
|
||||
|
||||
Get tokens from:
|
||||
- **Instance-level**: Admin Panel → Actions → Runners
|
||||
- **Org-level**: Org Settings → Actions → Runners
|
||||
- **Repo-level**: Repo Settings → Actions → Runners
|
||||
|
||||
---
|
||||
|
||||
## Differences from GitHub Actions
|
||||
|
||||
### Gitea Additions
|
||||
|
||||
| Feature | Details |
|
||||
|---|---|
|
||||
| Absolute action URLs | `uses: https://github.com/actions/checkout@v4` or any git URL |
|
||||
| Go-based actions | Actions can be written in Go |
|
||||
| Extended cron syntax | `@daily`, `@hourly`, `@weekly`, `@monthly`, `@yearly` |
|
||||
| `gitea.*` context | Recommended namespace alias for `github.*` |
|
||||
| Permissive context | `env` context usable in more places than GitHub allows |
|
||||
| `DEFAULT_ACTIONS_URL` | Server config to pull actions from own Gitea instance instead of GitHub |
|
||||
|
||||
### Behavioral Differences
|
||||
|
||||
| Behavior | GitHub Actions | Gitea Actions |
|
||||
|---|---|---|
|
||||
| PR ref | `refs/pull/:n/merge` (merge preview) | `refs/pull/:n/head` (PR head) |
|
||||
| Unqualified action source | Always GitHub.com | Configurable via `DEFAULT_ACTIONS_URL` |
|
||||
| `GITHUB_TOKEN` for packages | Works | **Does not work** — use PAT |
|
||||
| `permissions:` keyword | Enforced | Ignored |
|
||||
| `continue-on-error:` | Supported | Ignored |
|
||||
| `timeout-minutes:` | Supported | Ignored |
|
||||
|
||||
---
|
||||
|
||||
## Unsupported Features
|
||||
|
||||
| Feature | Status |
|
||||
|---|---|
|
||||
| `permissions:` keyword | Ignored |
|
||||
| `jobs.<id>.timeout-minutes` | Ignored |
|
||||
| `jobs.<id>.continue-on-error` | Ignored |
|
||||
| `jobs.<id>.environment` | Ignored |
|
||||
| Problem Matchers | Not supported |
|
||||
| Log annotations (`::error::`, `::warning::`) | Not supported |
|
||||
| `GITEA_TOKEN` for container registry | Does not work — use PAT with `package` scope |
|
||||
|
||||
---
|
||||
|
||||
## Badge URLs
|
||||
|
||||
```
|
||||
https://<gitea-instance>/<owner>/<repo>/actions/workflows/<workflow-file>/badge.svg
|
||||
```
|
||||
|
||||
### Query Parameters
|
||||
|
||||
| Parameter | Values | Default |
|
||||
|---|---|---|
|
||||
| `branch` | Any branch name | Default branch |
|
||||
| `event` | Event name (`push`, `pull_request`, etc.) | None |
|
||||
| `style` | `flat`, `flat-square` | `flat` |
|
||||
|
||||
### Example
|
||||
|
||||
```markdown
|
||||
[](https://gitea.jsme.be/Jeffrey/azure-ddns-python/actions)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Sources
|
||||
|
||||
- [Gitea Actions Overview](https://docs.gitea.com/usage/actions/overview)
|
||||
- [Gitea Actions Quickstart](https://docs.gitea.com/usage/actions/quickstart)
|
||||
- [act-runner Documentation](https://docs.gitea.com/usage/actions/act-runner)
|
||||
- [Workflow File Reference](https://docs.gitea.com/usage/actions/workflow-file)
|
||||
- [Compared to GitHub Actions](https://docs.gitea.com/usage/actions/comparison)
|
||||
- [Secrets](https://docs.gitea.com/usage/actions/secrets)
|
||||
- [Variables](https://docs.gitea.com/usage/actions/variables)
|
||||
- [Badge](https://docs.gitea.com/usage/actions/badge)
|
||||
- [act_runner config example](https://gitea.com/gitea/act_runner/src/branch/main/internal/pkg/config/config.example.yaml)
|
||||
13
gitea/runner/runner-pvc.yaml
Normal file
13
gitea/runner/runner-pvc.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: gitea-runner-pvc
|
||||
namespace: gitea
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
storageClassName: longhorn-static
|
||||
volumeName: gitea-runner-data
|
||||
resources:
|
||||
requests:
|
||||
storage: 20Gi
|
||||
164
gitea/runner/values.yaml
Normal file
164
gitea/runner/values.yaml
Normal file
@@ -0,0 +1,164 @@
|
||||
# Configure Gitea Actions
|
||||
## @section Gitea Actions
|
||||
#
|
||||
## @param enabled Create an act runner StatefulSet.
|
||||
## @param init.image.repository The image used for the init containers
|
||||
## @param init.image.tag The image tag used for the init containers
|
||||
## @param statefulset.replicas the amount of (replica) runner pods deployed
|
||||
## @param statefulset.timezone is the timezone that will be set in the act_runner image
|
||||
## @param statefulset.annotations Act runner annotations
|
||||
## @param statefulset.labels Act runner labels
|
||||
## @param statefulset.resources Act runner resources
|
||||
## @param statefulset.nodeSelector NodeSelector for the statefulset
|
||||
## @param statefulset.tolerations Tolerations for the statefulset
|
||||
## @param statefulset.affinity Affinity for the statefulset
|
||||
## @param statefulset.extraVolumes Extra volumes for the statefulset
|
||||
## @param statefulset.actRunner.repository The Gitea act runner image
|
||||
## @param statefulset.actRunner.tag The Gitea act runner tag
|
||||
## @param statefulset.actRunner.pullPolicy The Gitea act runner pullPolicy
|
||||
## @param statefulset.actRunner.extraVolumeMounts Allows mounting extra volumes in the act runner container
|
||||
## @param statefulset.actRunner.config [default: Too complex. See values.yaml] Act runner custom configuration. See [Act Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details.
|
||||
## @param statefulset.dind.repository The Docker-in-Docker image
|
||||
## @param statefulset.dind.tag The Docker-in-Docker image tag
|
||||
## @param statefulset.dind.pullPolicy The Docker-in-Docker pullPolicy
|
||||
## @param statefulset.dind.extraVolumeMounts Allows mounting extra volumes in the Docker-in-Docker container
|
||||
## @param statefulset.dind.extraEnvs Allows adding custom environment variables, such as `DOCKER_IPTABLES_LEGACY`
|
||||
## @param statefulset.persistence.size Size for persistence to store act runner data
|
||||
## @param existingSecret Secret that contains the token
|
||||
## @param existingSecretKey Secret key
|
||||
## @param giteaRootURL URL the act_runner registers and connect with
|
||||
enabled: true
|
||||
statefulset:
|
||||
replicas: 1
|
||||
timezone: Europe/Brussels
|
||||
annotations: {}
|
||||
labels: {}
|
||||
resources: {}
|
||||
nodeSelector: {}
|
||||
tolerations: []
|
||||
affinity: {}
|
||||
extraVolumes: []
|
||||
|
||||
actRunner:
|
||||
registry: docker.io
|
||||
repository: gitea/act_runner
|
||||
tag: 0.2.13
|
||||
pullPolicy: IfNotPresent
|
||||
extraVolumeMounts: []
|
||||
|
||||
# See full example here: https://gitea.com/gitea/act_runner/src/branch/main/internal/pkg/config/config.example.yaml
|
||||
config: |
|
||||
log:
|
||||
level: debug
|
||||
runner:
|
||||
# Where to store the registration result.
|
||||
file: .runner
|
||||
# The timeout for a job to be finished.
|
||||
# Please note that the Gitea instance also has a timeout (3h by default) for the job.
|
||||
# So the job could be stopped by the Gitea instance if it's timeout is shorter than this.
|
||||
timeout: 3h
|
||||
# The timeout for the runner to wait for running jobs to finish when shutting down.
|
||||
# Any running jobs that haven't finished after this timeout will be cancelled.
|
||||
shutdown_timeout: 0s
|
||||
# Whether skip verifying the TLS certificate of the Gitea instance.
|
||||
insecure: false
|
||||
# The timeout for fetching the job from the Gitea instance.
|
||||
fetch_timeout: 5s
|
||||
# The interval for fetching the job from the Gitea instance.
|
||||
fetch_interval: 2s
|
||||
labels:
|
||||
- "ubuntu-latest:docker://gitea/runner-images:ubuntu-latest"
|
||||
- "ubuntu-22.04:docker://gitea/runner-images:ubuntu-22.04"
|
||||
cache:
|
||||
# Enable cache server to use actions/cache.
|
||||
enabled: true
|
||||
# The directory to store the cache data.
|
||||
# If it's empty, the cache data will be stored in $HOME/.cache/actcache.
|
||||
dir: ""
|
||||
# The host of the cache server.
|
||||
# It's not for the address to listen, but the address to connect from job containers.
|
||||
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
|
||||
host: ""
|
||||
# The port of the cache server.
|
||||
# 0 means to use a random available port.
|
||||
port: 0
|
||||
# The external cache server URL. Valid only when enable is true.
|
||||
# If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
|
||||
# The URL should generally end with "/".
|
||||
external_server: ""
|
||||
container:
|
||||
# Specifies the network to which the container will connect.
|
||||
# Could be host, bridge or the name of a custom network.
|
||||
# If it's empty, act_runner will create a network automatically.
|
||||
network: "host"
|
||||
# Whether to use privileged mode or not when launching task containers (privileged mode is required for Docker-in-Docker).
|
||||
privileged: true
|
||||
# And other options to be used when the container is started (eg, --add-host=my.gitea.url:host-gateway).
|
||||
options:
|
||||
# The parent directory of a job's working directory.
|
||||
# NOTE: There is no need to add the first '/' of the path as act_runner will add it automatically.
|
||||
# If the path starts with '/', the '/' will be trimmed.
|
||||
# For example, if the parent directory is /path/to/my/dir, workdir_parent should be path/to/my/dir
|
||||
# If it's empty, /workspace will be used.
|
||||
workdir_parent:
|
||||
# Volumes (including bind mounts) can be mounted to containers. Glob syntax is supported, see https://github.com/gobwas/glob
|
||||
# You can specify multiple volumes. If the sequence is empty, no volumes can be mounted.
|
||||
# For example, if you only allow containers to mount the `data` volume and all the json files in `/src`, you should change the config to:
|
||||
# valid_volumes:
|
||||
# - data
|
||||
# - /src/*.json
|
||||
# If you want to allow any volume, please use the following configuration:
|
||||
# valid_volumes:
|
||||
# - '**'
|
||||
valid_volumes: [/var/run/docker.sock]
|
||||
# overrides the docker client host with the specified one.
|
||||
# If it's empty, act_runner will find an available docker host automatically.
|
||||
# If it's "-", act_runner will find an available docker host automatically, but the docker host won't be mounted to the job containers and service containers.
|
||||
# If it's not empty or "-", the specified docker host will be used. An error will be returned if it doesn't work.
|
||||
docker_host: ""
|
||||
# Pull docker image(s) even if already present
|
||||
force_pull: false
|
||||
# Rebuild docker image(s) even if already present
|
||||
force_rebuild: false
|
||||
# Always require a reachable docker daemon, even if not required by act_runner
|
||||
require_docker: false
|
||||
# Timeout to wait for the docker daemon to be reachable, if docker is required by require_docker or act_runner
|
||||
docker_timeout: 0s
|
||||
dind:
|
||||
repository: docker
|
||||
tag: 28.3.3-dind
|
||||
pullPolicy: IfNotPresent
|
||||
extraVolumeMounts: []
|
||||
|
||||
# If the container keeps crashing in your environment, you might have to add the `DOCKER_IPTABLES_LEGACY` environment variable.
|
||||
# See https://github.com/docker-library/docker/issues/463#issuecomment-1881909456
|
||||
extraEnvs:
|
||||
[]
|
||||
# - name: "DOCKER_IPTABLES_LEGACY"
|
||||
# value: "1"
|
||||
|
||||
persistence:
|
||||
size: 15Gi
|
||||
|
||||
init:
|
||||
image:
|
||||
repository: busybox
|
||||
# Overrides the image tag whose default is the chart appVersion.
|
||||
tag: "1.37.0"
|
||||
|
||||
## Specify an existing token secret
|
||||
##
|
||||
existingSecret: "gitea-secrets"
|
||||
existingSecretKey: "runner_token"
|
||||
|
||||
## Specify the root URL of the Gitea instance
|
||||
giteaRootURL: "https://gitea.jsme.be"
|
||||
|
||||
## @section Global
|
||||
#
|
||||
## @param global.imageRegistry global image registry override
|
||||
## @param global.storageClass global storage class override
|
||||
global:
|
||||
imageRegistry: ""
|
||||
storageClass: ""
|
||||
|
||||
Reference in New Issue
Block a user