1111 - ' cloudformation/scenarios/simply-readable/cdk/**'
1212 - ' cloudformation/scenarios/simply-readable/scripts/**'
1313 - ' cloudformation/scenarios/minute/cdk/**'
14+ - ' cloudformation/scenarios/fixmystreet/cdk/**'
1415 - ' cloudformation/isb-hub/**'
1516 workflow_dispatch :
1617
@@ -292,8 +293,64 @@ jobs:
292293 path : cloudformation/scenarios/minute/template.yaml
293294 retention-days : 1
294295
296+ synth-fixmystreet :
297+ runs-on : ubuntu-latest
298+ steps :
299+ - uses : actions/checkout@v6
300+
301+ - uses : actions/setup-node@v6
302+ with :
303+ node-version : ' 22'
304+ cache : ' npm'
305+ cache-dependency-path : cloudformation/scenarios/fixmystreet/cdk/package-lock.json
306+
307+ - name : Build and synth fixmystreet CDK
308+ working-directory : cloudformation/scenarios/fixmystreet/cdk
309+ run : |
310+ npm ci
311+ npm run build
312+ npx cdk synth
313+
314+ - name : Strip bootstrap cruft and validate template
315+ working-directory : cloudformation/scenarios/fixmystreet/cdk
316+ run : |
317+ node -e "
318+ const fs = require('fs');
319+ const t = JSON.parse(fs.readFileSync('../cdk.out/FixMyStreetStack.template.json', 'utf8'));
320+ delete t.Parameters?.BootstrapVersion;
321+ delete t.Resources?.CDKMetadata;
322+ delete t.Rules?.CheckBootstrapVersion;
323+ const str = JSON.stringify(t);
324+ const errors = [];
325+ if (str.includes('AssetParameters') || str.includes('cdk-bootstrap')) {
326+ errors.push('Template contains CDK bootstrap/asset dependencies');
327+ }
328+ const deletionPolicies = str.match(/\"DeletionPolicy\":\s*\"(Snapshot|Retain)\"/g);
329+ if (deletionPolicies) {
330+ errors.push('Template contains non-DESTROY deletion policies: ' + deletionPolicies.join(', '));
331+ }
332+ const size = Buffer.byteLength(JSON.stringify(t, null, 2));
333+ if (size > 400000) {
334+ errors.push('Template size ' + size + ' bytes approaching CloudFormation S3 limit (460,800)');
335+ }
336+ if (errors.length > 0) {
337+ errors.forEach(e => console.error('ERROR: ' + e));
338+ process.exit(1);
339+ }
340+ // Write JSON content to .yaml — CloudFormation accepts both formats regardless of extension
341+ const content = '# Auto-generated from CDK synthesis. Do not edit.\n' + JSON.stringify(t, null, 2);
342+ fs.writeFileSync('../template.yaml', content);
343+ console.log('Wrote template.yaml (' + size + ' bytes, ' + Object.keys(t.Resources || {}).length + ' resources)');
344+ "
345+
346+ - uses : actions/upload-artifact@v7
347+ with :
348+ name : fixmystreet-template
349+ path : cloudformation/scenarios/fixmystreet/template.yaml
350+ retention-days : 1
351+
295352 deploy :
296- needs : [synth-localgov-drupal, synth-localgov-ims, synth-simply-readable, synth-minute]
353+ needs : [synth-localgov-drupal, synth-localgov-ims, synth-simply-readable, synth-minute, synth-fixmystreet ]
297354 runs-on : ubuntu-latest
298355 steps :
299356 - uses : actions/checkout@v6
@@ -313,6 +370,11 @@ jobs:
313370 name : minute-template
314371 path : cloudformation/scenarios/minute
315372
373+ - uses : actions/download-artifact@v8
374+ with :
375+ name : fixmystreet-template
376+ path : cloudformation/scenarios/fixmystreet
377+
316378 - uses : actions/download-artifact@v8
317379 with :
318380 name : simply-readable-template
0 commit comments