@@ -32,10 +32,11 @@ const (
3232)
3333
3434var (
35- outputFn string
36- buildMode string
37- offline bool
38- doUpdate bool
35+ outputFn string
36+ buildMode string
37+ offline bool
38+ doUpdate bool
39+ deploymentName string
3940
4041 Cmd = & cobra.Command {
4142 Use : "build" ,
@@ -44,14 +45,17 @@ var (
4445 Run : func (_ * cobra.Command , _ []string ) {
4546 cfg := cliConfig .Global ()
4647 npa := common .GetNPASelection (cfg )
47- manifest := roflCommon .LoadManifestAndSetNPA (cfg , npa )
48+ manifest , deployment := roflCommon .LoadManifestAndSetNPA (cfg , npa , deploymentName )
4849
4950 fmt .Println ("Building a ROFL application..." )
50- fmt .Printf ("App ID: %s\n " , manifest .AppID )
51- fmt .Printf ("Name: %s\n " , manifest .Name )
52- fmt .Printf ("Version: %s\n " , manifest .Version )
53- fmt .Printf ("TEE: %s\n " , manifest .TEE )
54- fmt .Printf ("Kind: %s\n " , manifest .Kind )
51+ fmt .Printf ("Deployment: %s\n " , deploymentName )
52+ fmt .Printf ("Network: %s\n " , deployment .Network )
53+ fmt .Printf ("ParaTime: %s\n " , deployment .ParaTime )
54+ fmt .Printf ("App ID: %s\n " , deployment .AppID )
55+ fmt .Printf ("Name: %s\n " , manifest .Name )
56+ fmt .Printf ("Version: %s\n " , manifest .Version )
57+ fmt .Printf ("TEE: %s\n " , manifest .TEE )
58+ fmt .Printf ("Kind: %s\n " , manifest .Kind )
5559
5660 // Prepare temporary build directory.
5761 tmpDir , err := os .MkdirTemp ("" , "oasis-build" )
6266
6367 bnd := & bundle.Bundle {
6468 Manifest : & bundle.Manifest {
65- Name : manifest .AppID ,
69+ Name : deployment .AppID ,
6670 ID : npa .ParaTime .Namespace (),
6771 },
6872 }
@@ -80,14 +84,14 @@ var (
8084 return
8185 }
8286
83- sgxBuild (npa , manifest , bnd )
87+ sgxBuild (npa , manifest , deployment , bnd )
8488 case buildRofl .TEETypeTDX :
8589 // TDX.
8690 switch manifest .Kind {
8791 case buildRofl .AppKindRaw :
88- err = tdxBuildRaw (tmpDir , npa , manifest , bnd )
92+ err = tdxBuildRaw (tmpDir , npa , manifest , deployment , bnd )
8993 case buildRofl .AppKindContainer :
90- err = tdxBuildContainer (tmpDir , npa , manifest , bnd )
94+ err = tdxBuildContainer (tmpDir , npa , manifest , deployment , bnd )
9195 }
9296 default :
9397 fmt .Printf ("unsupported TEE kind: %s\n " , manifest .TEE )
99103 }
100104
101105 // Write the bundle out.
102- outFn := fmt .Sprintf ("%s.orc" , manifest .Name )
106+ outFn := fmt .Sprintf ("%s.%s. orc" , manifest .Name , deploymentName )
103107 if outputFn != "" {
104108 outFn = outputFn
105109 }
@@ -119,7 +123,7 @@ var (
119123 }
120124
121125 // Override the update manifest flag in case the policy does not exist.
122- if manifest .Policy == nil {
126+ if deployment .Policy == nil {
123127 doUpdate = false
124128 }
125129
@@ -135,9 +139,9 @@ var (
135139 fmt .Println ()
136140 case true :
137141 // Update the manifest with the given enclave identities, overwriting existing ones.
138- manifest .Policy .Enclaves = make ([]sgx.EnclaveIdentity , 0 , len (eids ))
142+ deployment .Policy .Enclaves = make ([]sgx.EnclaveIdentity , 0 , len (eids ))
139143 for _ , eid := range eids {
140- manifest .Policy .Enclaves = append (manifest .Policy .Enclaves , * eid )
144+ deployment .Policy .Enclaves = append (deployment .Policy .Enclaves , * eid )
141145 }
142146
143147 // Serialize manifest and write it to file.
@@ -173,12 +177,12 @@ func detectBuildMode(npa *common.NPASelection) {
173177 }
174178}
175179
176- func setupBuildEnv (manifest * buildRofl.Manifest , npa * common.NPASelection ) {
180+ func setupBuildEnv (deployment * buildRofl.Deployment , npa * common.NPASelection ) {
177181 // Configure app ID.
178- os .Setenv ("ROFL_APP_ID" , manifest .AppID )
182+ os .Setenv ("ROFL_APP_ID" , deployment .AppID )
179183
180184 // Obtain and configure trust root.
181- trustRoot , err := fetchTrustRoot (npa , manifest .TrustRoot )
185+ trustRoot , err := fetchTrustRoot (npa , deployment .TrustRoot )
182186 cobra .CheckErr (err )
183187 os .Setenv ("ROFL_CONSENSUS_TRUST_ROOT" , trustRoot )
184188}
@@ -250,6 +254,7 @@ func init() {
250254 buildFlags .BoolVar (& offline , "offline" , false , "do not perform any operations requiring network access" )
251255 buildFlags .StringVar (& outputFn , "output" , "" , "output bundle filename" )
252256 buildFlags .BoolVar (& doUpdate , "update-manifest" , false , "automatically update the manifest" )
257+ buildFlags .StringVar (& deploymentName , "deployment" , buildRofl .DefaultDeploymentName , "deployment name" )
253258
254259 Cmd .Flags ().AddFlagSet (buildFlags )
255260}
0 commit comments