@@ -31,6 +31,7 @@ import (
31
31
const (
32
32
artifactoryLifecycleMinVersion = "7.68.3"
33
33
signingKeyOptionalArtifactoryMinVersion = "7.104.1"
34
+ promotionTypeFlagArtifactoryMinVersion = "7.106.1"
34
35
gpgKeyPairName = "lc-tests-key-pair"
35
36
lcTestdataPath = "lifecycle"
36
37
releaseBundlesSpec = "release-bundles-spec.json"
@@ -144,8 +145,7 @@ func TestLifecycleFullFlow(t *testing.T) {
144
145
defer deleteReleaseBundle (t , lcManager , tests .LcRbName3 , number3 )
145
146
146
147
// Promote the last release bundle to prod repo 1.
147
- promoteRb (t , lcManager , number3 )
148
-
148
+ promoteRb (t , lcManager , tests .LcRbName3 , number3 , tests .RtProdRepo1 , "" )
149
149
// Assert the artifacts of both the initial release bundles made it to prod repo 1.
150
150
assertExpectedArtifacts (t , tests .SearchAllProdRepo1 , tests .GetExpectedLifecycleArtifacts ())
151
151
// Assert no artifacts were promoted to prod repo 2.
@@ -181,6 +181,22 @@ func TestImportReleaseBundle(t *testing.T) {
181
181
assert .Error (t , err )
182
182
}
183
183
184
+ func TestPromoteReleaseBundleWithPromotionTypeFlag (t * testing.T ) {
185
+ cleanCallback := initLifecycleTest (t , promotionTypeFlagArtifactoryMinVersion )
186
+ defer cleanCallback ()
187
+ lcManager := getLcServiceManager (t )
188
+
189
+ deleteBuilds := uploadBuilds (t )
190
+ defer deleteBuilds ()
191
+
192
+ createRbFromSpec (t , tests .LifecycleBuilds12 , tests .LcRbName1 , number1 , true , false )
193
+ defer deleteReleaseBundle (t , lcManager , tests .LcRbName1 , number1 )
194
+ assertStatusCompleted (t , lcManager , tests .LcRbName1 , number1 , "" )
195
+
196
+ promoteRb (t , lcManager , tests .LcRbName1 , number1 , tests .RtProdRepo1 , "move" )
197
+ assertStatusCompleted (t , lcManager , tests .LcRbName1 , number1 , "" )
198
+ }
199
+
184
200
func deleteExportedReleaseBundle (t * testing.T , rbName string ) {
185
201
assert .NoError (t , os .RemoveAll (rbName ))
186
202
}
@@ -285,16 +301,24 @@ func getOption(option, value string) string {
285
301
return fmt .Sprintf ("--%s=%s" , option , value )
286
302
}
287
303
288
- func promoteRb (t * testing.T , lcManager * lifecycle.LifecycleServicesManager , rbVersion string ) {
289
- output := lcCli . RunCliCmdWithOutput ( t , "rbp" , tests . LcRbName3 , rbVersion , prodEnvironment ,
304
+ func promoteRb (t * testing.T , lcManager * lifecycle.LifecycleServicesManager , rbName , rbVersion , promoteRepo , promotionType string ) {
305
+ cmdArgs := [] string { "rbp" , rbName , rbVersion , prodEnvironment ,
290
306
getOption (cliutils .SigningKey , gpgKeyPairName ),
291
- getOption (cliutils .IncludeRepos , tests .RtProdRepo1 ),
292
- "--project=default" )
307
+ getOption (cliutils .IncludeRepos , promoteRepo ),
308
+ "--project=default" }
309
+
310
+ // Include promotion type if specified
311
+ if promotionType != "" {
312
+ cmdArgs = append (cmdArgs , getOption (cliutils .PromotionType , promotionType ))
313
+ }
314
+
315
+ output := lcCli .RunCliCmdWithOutput (t , cmdArgs ... )
316
+
293
317
var promotionResp services.RbPromotionResp
294
318
if ! assert .NoError (t , json .Unmarshal ([]byte (output ), & promotionResp )) {
295
319
return
296
320
}
297
- assertStatusCompleted (t , lcManager , tests . LcRbName3 , rbVersion , promotionResp .CreatedMillis .String ())
321
+ assertStatusCompleted (t , lcManager , rbName , rbVersion , promotionResp .CreatedMillis .String ())
298
322
}
299
323
300
324
func getSpecFile (fileName string ) (string , error ) {
0 commit comments