Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/gitea.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ After changing `app.ini`, restart Gitea for the setting to take effect.

## Differences from GitHub

- **Runner binary:** Gitea uses `act_runner` instead of the GitHub Actions runner. GARM handles the differences transparently.
- **Runner binary:** Gitea uses `gitea-runner` (formerly `act_runner`) instead of the GitHub Actions runner. GARM handles the differences transparently.
- **Enterprise level:** Not available for Gitea
- **Scale sets:** Not available for Gitea (GitHub-only feature)
- **GitHub Apps:** Gitea uses PATs only
10 changes: 5 additions & 5 deletions internal/templates/userdata/gitea_linux_userdata.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CALLBACK_URL="{{ .CallbackURL }}"
METADATA_URL="{{ .MetadataURL }}"
BEARER_TOKEN="{{ .CallbackToken }}"

RUN_HOME="/home/{{.RunnerUsername}}/act-runner"
RUN_HOME="/home/{{.RunnerUsername}}/gitea-runner"

if [ -z "$METADATA_URL" ];then
echo "no token is available and METADATA_URL is not set"
Expand Down Expand Up @@ -87,7 +87,7 @@ log_file = "/var/log/garm-agent/garm-agent.log"
work_dir = "$RUN_HOME"
enable_shell = $AGENT_SHELL
token = "$AGENT_TOKEN"
runner_cmdline = ["$RUN_HOME/act_runner", "daemon", "--once"]
runner_cmdline = ["$RUN_HOME/gitea-runner", "daemon", "--once"]
state_db_path = "/etc/garm-agent/agent-state.db"
EOF

Expand Down Expand Up @@ -119,9 +119,9 @@ fi
function downloadAndExtractRunner() {
sendStatus "downloading tools from {{ .DownloadURL }}"
mkdir -p "$RUN_HOME" || fail "failed to create actions-runner folder"
curl --retry 5 --retry-delay 5 --retry-connrefused --fail -L -o "$RUN_HOME/act_runner" "{{ .DownloadURL }}" || fail "failed to download tools"
curl --retry 5 --retry-delay 5 --retry-connrefused --fail -L -o "$RUN_HOME/gitea-runner" "{{ .DownloadURL }}" || fail "failed to download tools"
chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R "$RUN_HOME"/ || fail "failed to change owner"
chmod +x "$RUN_HOME/act_runner" || fail "failed to set executable flag"
chmod +x "$RUN_HOME/gitea-runner" || fail "failed to set executable flag"
}

if [ ! -d "$RUN_HOME" ];then
Expand All @@ -147,7 +147,7 @@ set +e
attempt=1
while true; do
ERROUT=$(mktemp)
./act_runner register --ephemeral --no-interactive --instance "{{ .RepoURL }}" --token "$GITHUB_TOKEN" --name "{{ .RunnerName }}" --labels "{{ .RunnerLabels }}" 2>$ERROUT
./gitea-runner register --ephemeral --no-interactive --instance "{{ .RepoURL }}" --token "$GITHUB_TOKEN" --name "{{ .RunnerName }}" --labels "{{ .RunnerLabels }}" 2>$ERROUT
if [ $? -eq 0 ]; then
rm $ERROUT || true
sendStatus "runner successfully configured after $attempt attempt(s)"
Expand Down
20 changes: 10 additions & 10 deletions internal/templates/userdata/gitea_windows_userdata.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -465,15 +465,15 @@ function Install-NSSM {
rm -Recurse -Force "$runnerDir\nssm"
rm -Force "$runnerDir\nssm.zip"
$nssm="$runnerDir/nssm.exe"
& $nssm install GiteaActRunner "$runnerDir/act_runner.exe"
& $nssm set GiteaActRunner AppParameters daemon
& $nssm set GiteaActRunner AppStdout $runnerDir\stdout.log
& $nssm set GiteaActRunner AppStderr $runnerDir\stderr.log
& $nssm set GiteaActRunner AppStopMethodSkip 6
& $nssm set GiteaActRunner AppStopMethodConsole 1000
& $nssm set GiteaActRunner AppThrottle 5000
& $nssm set GiteaActRunner ObjectName $username $password
& $nssm start GiteaActRunner
& $nssm install GiteaRunner "$runnerDir/gitea-runner.exe"
& $nssm set GiteaRunner AppParameters daemon
& $nssm set GiteaRunner AppStdout $runnerDir\stdout.log
& $nssm set GiteaRunner AppStderr $runnerDir\stderr.log
& $nssm set GiteaRunner AppStopMethodSkip 6
& $nssm set GiteaRunner AppStopMethodConsole 1000
& $nssm set GiteaRunner AppThrottle 5000
& $nssm set GiteaRunner ObjectName $username $password
& $nssm start GiteaRunner
}


Expand All @@ -494,7 +494,7 @@ function Install-Runner() {
Throw "missing metadata URL"
}
$runnerDir = "C:\actions-runner"
$runnerExecutable = Join-Path $runnerDir "act_runner.exe"
$runnerExecutable = Join-Path $runnerDir "gitea-runner.exe"

# Create user with administrator rights to run service as
$userPasswd = Get-RandomString -Length 10
Expand Down
6 changes: 3 additions & 3 deletions runner/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ WantedBy=multi-user.target
`

var giteaSystemdUnitTemplate = `[Unit]
Description=Act Runner ({{.ServiceName}})
Description=Gitea Runner ({{.ServiceName}})
After=network.target

[Service]
ExecStart=/home/{{.RunAsUser}}/act-runner/act_runner daemon --once
ExecStart=/home/{{.RunAsUser}}/gitea-runner/gitea-runner daemon --once
User={{.RunAsUser}}
WorkingDirectory=/home/{{.RunAsUser}}/act-runner
WorkingDirectory=/home/{{.RunAsUser}}/gitea-runner
KillMode=process
KillSignal=SIGTERM
TimeoutStopSec=5min
Expand Down
6 changes: 3 additions & 3 deletions runner/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ func (s *MetadataTestSuite) TestGenerateSystemdUnitFile() {
name: "Gitea with custom user",
runAsUser: "gitea-user",
forgeType: params.GiteaEndpointType,
expectedTemplate: "Act Runner",
expectedTemplate: "Gitea Runner",
},
}

Expand Down Expand Up @@ -1282,8 +1282,8 @@ func (s *MetadataTestSuite) TestGenerateSystemdUnitFileGiteaWithDefaultUser() {

s.Require().Nil(err)
s.Require().NotEmpty(unitFile)
s.Require().Contains(string(unitFile), "Act Runner")
s.Require().Contains(string(unitFile), "act_runner daemon --once")
s.Require().Contains(string(unitFile), "Gitea Runner")
s.Require().Contains(string(unitFile), "gitea-runner daemon --once")
s.Require().Contains(string(unitFile), "Restart=always")
}

Expand Down
2 changes: 1 addition & 1 deletion util/appdefaults/appdefaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (

// GiteaRunnerReleasesURL is the public API URL that returns a json of all Gitea runner releases.
// By default it returns the last 10 releases, which is enough for our needs.
GiteaRunnerReleasesURL = "https://gitea.com/api/v1/repos/gitea/act_runner/releases"
GiteaRunnerReleasesURL = "https://gitea.com/api/v1/repos/gitea/runner/releases"
// GiteaRunnerMinimumVersion is the minimum version we need in order to support ephemeral runners.
GiteaRunnerMinimumVersion = "v0.2.12"

Expand Down
94 changes: 39 additions & 55 deletions webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions webapp/src/lib/components/forms/EndpointForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
<div class="ml-2">
<Tooltip
title="Tools Metadata URL"
content="URL where GARM checks for act_runner binary downloads and release information. Defaults to https://gitea.com/api/v1/repos/gitea/act_runner/releases if not specified. Use a custom URL to point to your own tools repository or mirror."
content="URL where GARM checks for gitea-runner binary downloads and release information. Defaults to https://gitea.com/api/v1/repos/gitea/runner/releases if not specified. Use a custom URL to point to your own tools repository or mirror."
position="top"
width="w-80"
/>
Expand All @@ -166,7 +166,7 @@
disabled={formData.use_internal_tools_metadata}
autocomplete="off"
class="w-full px-3 py-2 border rounded-md focus:outline-none transition-colors {formData.use_internal_tools_metadata ? 'bg-gray-100 dark:bg-gray-800 border-gray-300 dark:border-gray-700 text-gray-400 dark:text-gray-500 cursor-not-allowed' : 'border-gray-300 dark:border-gray-600 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white'}"
placeholder="https://gitea.com/api/v1/repos/gitea/act_runner/releases"
placeholder="https://gitea.com/api/v1/repos/gitea/runner/releases"
/>
<p class="text-xs {formData.use_internal_tools_metadata ? 'text-gray-400 dark:text-gray-500' : 'text-gray-500 dark:text-gray-400'} mt-1">{formData.use_internal_tools_metadata ? 'Disabled when using internal tools metadata' : 'Leave empty to use default Gitea releases URL'}</p>
</div>
Expand All @@ -184,7 +184,7 @@
<div class="ml-2">
<Tooltip
title="Internal Tools Metadata"
content="When enabled, GARM uses built-in URLs for nightly act_runner binaries instead of calling the external tools metadata URL. This is useful in air-gapped environments where runner images already include the binaries and don't need to download them."
content="When enabled, GARM uses built-in URLs for nightly gitea-runner binaries instead of calling the external tools metadata URL. This is useful in air-gapped environments where runner images already include the binaries and don't need to download them."
position="top"
width="w-80"
/>
Expand Down
29 changes: 27 additions & 2 deletions webapp/src/routes/objects/page.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/svelte';
import ObjectsPage from './+page.svelte';
import { createMockFileObject } from '../../test/factories.js';

// Reset any component mocks that might be set by setup.ts
vi.unmock('$lib/components/PageHeader.svelte');
vi.unmock('$lib/components/DataTable.svelte');
vi.unmock('$lib/components/DeleteModal.svelte');
vi.unmock('$lib/components/cells');

// Only mock the GARM API
vi.mock('$lib/api/client.js', () => ({
garmApi: {
Expand Down Expand Up @@ -34,8 +40,12 @@ vi.mock('$app/paths', () => ({
}));

vi.mock('$lib/utils/format', () => ({
formatFileSize: vi.fn((size) => `${(size / 1024).toFixed(1)} KB`),
formatDateTime: vi.fn((date) => date || 'N/A')
formatFileSize: vi.fn((size: number) => `${(size / 1024).toFixed(1)} KB`),
formatDateTime: vi.fn((date: string) => date || 'N/A')
}));

vi.mock('$lib/utils/apiError', () => ({
extractAPIError: vi.fn((err: any) => err.message || 'Unknown error')
}));

const mockObject1 = createMockFileObject({
Expand All @@ -56,6 +66,21 @@ describe('Objects Page - Integration Tests', () => {
beforeEach(async () => {
vi.clearAllMocks();

// Ensure localStorage is available (jsdom may not always provide it)
const mockLocalStorage = {
getItem: vi.fn().mockReturnValue(null),
setItem: vi.fn(),
removeItem: vi.fn(),
clear: vi.fn(),
length: 0,
key: vi.fn()
};
Object.defineProperty(window, 'localStorage', {
value: mockLocalStorage,
writable: true,
configurable: true
});

const { garmApi } = await import('$lib/api/client.js');
(garmApi.listFileObjects as any).mockResolvedValue({
results: [mockObject1, mockObject2],
Expand Down
Loading