Preview-Deploy: gleichzeitige Deploys desselben Repos nacheinander
Projektaenderung und Gitea-Webhook deployten Kirschner Gebaeudeservice am 30.09.2026 gleichzeitig; beide git clone liefen ins selbe preview-data-Verzeichnis und brachen ab. runDeploy sperrt jetzt je Arbeitsverzeichnis und Subdomain (keyedLock), andere Repos laufen weiter parallel. Test stellt drei gleichzeitige Deploys nach. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d4241d20c4
commit
edef85c7b3
2 files changed
+67
-1
No files matched your search
@@ -4,6 +4,7 @@ import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
import { config } from '../config.js'
|
||||
import { listDocuments, Query } from './appwriteAdmin.js'
|
||||
import { withLocks } from './keyedLock.js'
|
||||
|
||||
const execFileAsync = promisify(execFile)
|
||||
|
||||
@@ -428,8 +429,17 @@ export async function runDeploy(repoFullName, branch, previewConfig) {
|
||||
}
|
||||
|
||||
const subdomain = previewConfig.subdomain || repoFullName.split('/').pop()
|
||||
const cloneUrl = `${config.gitea.baseUrl}/${repoFullName}.git`
|
||||
const workDir = previewWorkDir(repoFullName)
|
||||
// Deploys desselben Repos oder derselben Subdomain nacheinander: Projektaenderung und
|
||||
// Gitea-Webhook kamen gleichzeitig, beide git clone liefen ins selbe workDir und
|
||||
// brachen ab (Kirschner Gebaeudeservice, 30.09.2026).
|
||||
return withLocks([`preview-work:${workDir}`, `preview-site:${subdomain}`], () =>
|
||||
deployLocked(repoFullName, branch, previewConfig, subdomain, workDir)
|
||||
)
|
||||
}
|
||||
|
||||
async function deployLocked(repoFullName, branch, previewConfig, subdomain, workDir) {
|
||||
const cloneUrl = `${config.gitea.baseUrl}/${repoFullName}.git`
|
||||
const targetDir = path.join(config.preview.deployRoot, subdomain)
|
||||
|
||||
await cloneRepo(cloneUrl, workDir, branch, config.gitea.apiToken)
|
||||
|
||||
Reference in new issue
Block a user