fix(ci): use Renovate endpoint variable
Heimdall Gitea / Detect CI scope (push) Successful in 17s
Heimdall Gitea / Build and tests (push) Successful in 22m20s
Heimdall Gitea / Build and scan server image (push) Skipped
Heimdall Gitea / Build and scan agent image (push) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Skipped
Heimdall Gitea / Publish versioned installer release (push) Skipped
Heimdall Gitea / CI policy (push) Successful in 33s
Heimdall Gitea / Detect CI scope (push) Successful in 17s
Heimdall Gitea / Build and tests (push) Successful in 22m20s
Heimdall Gitea / Build and scan server image (push) Skipped
Heimdall Gitea / Build and scan agent image (push) Skipped
Heimdall Gitea / Build and scan NVIDIA Agent image (push) Skipped
Heimdall Gitea / Publish versioned installer release (push) Skipped
Heimdall Gitea / CI policy (push) Successful in 33s
Refs #421 Co-authored-by: Arnaud Dartois <admin@tordais.cc>
This commit was merged in pull request #422.
This commit is contained in:
1 parent
5009c96120
commit
b76168706f
4 files changed
+7
-7
No files matched your search
@@ -9,12 +9,12 @@ export function validateEndpoint(value) {
|
||||
try {
|
||||
parsed = new URL(value);
|
||||
} catch {
|
||||
throw new Error('FORGEJO_API_ENDPOINT must be a valid HTTPS URL ending in /api/v1.');
|
||||
throw new Error('RENOVATE_ENDPOINT must be a valid HTTPS URL ending in /api/v1.');
|
||||
}
|
||||
|
||||
if (parsed.protocol !== 'https:' || parsed.username || parsed.password ||
|
||||
parsed.search || parsed.hash || !parsed.pathname.replace(/\/$/, '').endsWith('/api/v1')) {
|
||||
throw new Error('FORGEJO_API_ENDPOINT must be a valid HTTPS URL ending in /api/v1.');
|
||||
throw new Error('RENOVATE_ENDPOINT must be a valid HTTPS URL ending in /api/v1.');
|
||||
}
|
||||
|
||||
return parsed.href.replace(/\/$/, '');
|
||||
@@ -38,7 +38,7 @@ export async function checkGiteaAccess(apiEndpoint, accessToken, fetchImpl = fet
|
||||
if (!response.ok) {
|
||||
const detail = response.status === 401 || response.status === 403
|
||||
? 'Check that RENOVATE_TOKEN is active and has repository read and write access.'
|
||||
: 'Check FORGEJO_API_ENDPOINT and the Forgejo API availability.';
|
||||
: 'Check RENOVATE_ENDPOINT and the Gitea API availability.';
|
||||
throw new Error(`Gitea API preflight failed with HTTP ${response.status}. ${detail}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@ import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { checkGiteaAccess, validateEndpoint } from './renovate-preflight.mjs';
|
||||
|
||||
test('accepts an HTTPS Forgejo API endpoint and trims its trailing slash', () => {
|
||||
test('accepts an HTTPS Gitea API endpoint and trims its trailing slash', () => {
|
||||
assert.equal(validateEndpoint('https://forge.example/api/v1/'), 'https://forge.example/api/v1');
|
||||
});
|
||||
|
||||
test('rejects non-HTTPS, malformed, and non-API endpoints', () => {
|
||||
for (const value of ['http://forge.example/api/v1', 'https://forge.example/', 'not a URL']) {
|
||||
assert.throws(() => validateEndpoint(value), /FORGEJO_API_ENDPOINT.*HTTPS URL ending in \/api\/v1/);
|
||||
assert.throws(() => validateEndpoint(value), /RENOVATE_ENDPOINT.*HTTPS URL ending in \/api\/v1/);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user