fix: pin the E2E backend SHA in the frontend contract
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -18,20 +18,22 @@ if (!existsSync(contractPath)) {
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
/** @type {{ repositoryUrl: string; checkoutPath: string; localRef?: string }} */
|
||||
/** @type {{ repositoryUrl: string; checkoutPath: string; localRef?: string; pinnedRef?: string }} */
|
||||
const contract = JSON.parse(readFileSync(contractPath, 'utf8'))
|
||||
|
||||
const envRef = process.env.E2E_BACKEND_REF?.trim()
|
||||
let ref = envRef
|
||||
|
||||
if (isCi) {
|
||||
if (!ref) {
|
||||
if (isCi && !ref) {
|
||||
ref = contract.pinnedRef?.trim()
|
||||
if (!/^[0-9a-f]{40}$/i.test(ref ?? '')) {
|
||||
console.error(
|
||||
'E2E backend ref is required in CI. Set repository variable E2E_BACKEND_REF to a full commit SHA (or immutable tag). Silent fallback to main is disabled.',
|
||||
'E2E backend ref is required in CI. Set E2E_BACKEND_REF or pinnedRef in e2e/backend.contract.json to a full commit SHA. Silent fallback to main is disabled.',
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
} else if (!ref) {
|
||||
console.log('E2E_BACKEND_REF unset; using committed pinnedRef')
|
||||
} else if (!isCi && !ref) {
|
||||
ref = contract.localRef?.trim()
|
||||
if (!ref) {
|
||||
console.error(
|
||||
|
||||
Reference in New Issue
Block a user