fix(infra): integrate private revalidation provisioning and narrow release gates
Deploy Canina / deploy (push) Failing after 1m6s
Deploy Canina / deploy (push) Failing after 1m6s
This commit is contained in:
1 parent
1bb6274b35
commit
f94ef580fb
6 files changed
+79
-12
No files matched your search
@@ -11,6 +11,21 @@ class ProductionGuards(unittest.TestCase):
|
||||
def receipt(self):
|
||||
return dict(sha='a'*40, baseline='b'*40, stage_run_url='https://git.parsaaghayi.ir/parsa/canina/actions/runs/123', reviewer='CEO delegated acceptance', accepted=True, scope='reliability-only', paths=['nginx.conf'])
|
||||
|
||||
def test_exact_six_baseline_gate_repairs_allowed_not_frontend_wildcard(self):
|
||||
files = {
|
||||
'frontend/admin-panel/src/pages/OrchestrationCommandCenter.tsx',
|
||||
'frontend/admin-panel/src/pages/selectionSafety.test.tsx',
|
||||
'frontend/admin-panel/src/pages/workflowSafety.test.tsx',
|
||||
'frontend/admin-panel/src/test/setup.ts',
|
||||
'frontend/admin-panel/src/test/storage.test.ts',
|
||||
'frontend/application/components/AnalyticsDeferred.tsx',
|
||||
}
|
||||
r=self.receipt();r['paths']=sorted(files)
|
||||
m.validate_receipt(r,'a'*40,'b'*40,sorted(files))
|
||||
for path in ['frontend/admin-panel/src/pages/Other.tsx', 'frontend/application/components/Other.tsx']:
|
||||
r['paths']=[path]
|
||||
with self.assertRaises(ValueError): m.validate_receipt(r,'a'*40,'b'*40,[path])
|
||||
|
||||
def test_exact_stage_sha(self):
|
||||
r=self.receipt()
|
||||
m.validate_receipt(r, 'a'*40, 'b'*40, ['nginx.conf'])
|
||||
@@ -37,6 +52,23 @@ class ProductionGuards(unittest.TestCase):
|
||||
x['Mounts'][0]['Name']='stage_canina_stage_uploads'
|
||||
with self.assertRaises(ValueError): m.snapshot([x])
|
||||
|
||||
def test_production_snapshot_forces_direct_next_url(self):
|
||||
import os, json
|
||||
from unittest.mock import patch
|
||||
c={'services':{n:{'environment':['FRONTEND_INTERNAL_URL=http://legacy:8080','REVALIDATION_SECRET=old'], 'labels':{}} for n in ['backend_prod','frontend_prod']}}
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
old=os.getcwd()
|
||||
try:
|
||||
os.chdir(d)
|
||||
with patch.object(m.sys,'argv',['production-release.py','snapshot']), patch.dict(os.environ,DEPLOY_SHA='a'*40), patch.object(m.subprocess,'check_output',return_value=b'[]'), patch.object(m,'snapshot',return_value=c):
|
||||
m.main()
|
||||
services=json.loads(Path('.prod-compose.json').read_text())['services']
|
||||
self.assertIn('FRONTEND_INTERNAL_URL=http://frontend_prod:3000',services['backend_prod']['environment'])
|
||||
for s in services.values():
|
||||
self.assertFalse(any(v.startswith('REVALIDATION_SECRET=') for v in s['environment']))
|
||||
self.assertTrue(s['env_file'][0]['required'])
|
||||
finally: os.chdir(old)
|
||||
|
||||
def test_private_receipt_permissions(self):
|
||||
import os
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
|
||||
Reference in new issue
Block a user