@@ -16,69 +16,12 @@ import {
1616 runManagedImagePromotion ,
1717 runPublicationBarrier ,
1818} from "./helpers/managed-image-publication-barrier" ;
19-
20- type Step = {
21- env ?: Record < string , unknown > ;
22- id ?: string ;
23- if ?: string ;
24- name ?: string ;
25- run ?: string ;
26- uses ?: string ;
27- with ?: Record < string , unknown > ;
28- "working-directory" ?: string ;
29- } ;
30-
31- type MatrixEntry = {
32- agent ?: string ;
33- arch ?: string ;
34- artifact_platform ?: string ;
35- base_alias ?: string ;
36- base_dockerfile ?: string ;
37- base_image ?: string ;
38- base_repository ?: string ;
39- display_name ?: string ;
40- dockerfile ?: string ;
41- image ?: string ;
42- repository ?: string ;
43- platform ?: string ;
44- required_binary ?: string ;
45- runner ?: string ;
46- } ;
47-
48- type Job = {
49- env ?: Record < string , unknown > ;
50- if ?: string ;
51- needs ?: string | string [ ] ;
52- permissions ?: Record < string , string > ;
53- "runs-on" ?: string ;
54- steps ?: Step [ ] ;
55- strategy ?: {
56- "fail-fast" ?: boolean ;
57- matrix ?: { include ?: MatrixEntry [ ] } ;
58- } ;
59- "timeout-minutes" ?: number ;
60- uses ?: string ;
61- } ;
62-
63- type Workflow = {
64- concurrency ?: {
65- "cancel-in-progress" ?: string | boolean ;
66- group ?: string ;
67- } ;
68- env ?: Record < string , string > ;
69- jobs ?: Record < string , Job > ;
70- on ?: {
71- pull_request ?: {
72- branches ?: string [ ] ;
73- paths ?: string [ ] ;
74- } ;
75- push ?: {
76- paths ?: string [ ] ;
77- } ;
78- workflow_call ?: unknown ;
79- } ;
80- permissions ?: Record < string , string > ;
81- } ;
19+ import type {
20+ Job ,
21+ MatrixEntry ,
22+ Step ,
23+ Workflow ,
24+ } from "./helpers/managed-image-publication-workflow-types" ;
8225
8326const repoRoot = path . resolve ( import . meta. dirname , ".." ) ;
8427const fullShaAction = / ^ [ ^ @ ] + @ [ 0 - 9 a - f ] { 40 } $ / iu;
@@ -1497,4 +1440,33 @@ fi
14971440 } ,
14981441 } ) ;
14991442 } ) ;
1443+
1444+ it ( "retains exact platform and aggregate cohort contracts for ninety days (#7744)" , ( ) => {
1445+ const promoter = managedPromoter ( readWorkflow ( "managed-images.yaml" ) ) ;
1446+ const uploads = ( promoter . steps ?? [ ] )
1447+ . filter ( ( candidate ) => candidate . uses ?. startsWith ( "actions/upload-artifact@" ) )
1448+ . map ( ( candidate ) => candidate . with ) ;
1449+
1450+ expect ( uploads ) . toEqual ( [
1451+ {
1452+ name : "managed-image-cohort-${{ github.run_id }}-${{ github.run_attempt }}" ,
1453+ path : "${{ runner.temp }}/managed-image-contracts/cohort.json" ,
1454+ "if-no-files-found" : "error" ,
1455+ "retention-days" : 90 ,
1456+ } ,
1457+ ...publicationAgents . flatMap ( ( agent ) =>
1458+ publicationPlatforms . map ( ( platform ) => {
1459+ const artifactPlatform = platform . replaceAll ( "/" , "-" ) ;
1460+ return {
1461+ name :
1462+ "managed-image-${{ github.run_id }}-${{ github.run_attempt }}-" +
1463+ `${ agent } -${ artifactPlatform } ` ,
1464+ path : `\${{ runner.temp }}/managed-image-contracts/${ agent } /${ artifactPlatform } /contract.json` ,
1465+ "if-no-files-found" : "error" ,
1466+ "retention-days" : 90 ,
1467+ } ;
1468+ } ) ,
1469+ ) ,
1470+ ] ) ;
1471+ } ) ;
15001472} ) ;
0 commit comments