Skip to content

Commit 0e3e7dd

Browse files
qchalmer-oracleJulia3072
authored andcommitted
Bug Fix - revert Devops Deploy Deployment Execution Progress
1 parent 4841f06 commit 0e3e7dd

File tree

2 files changed

+29
-165
lines changed

2 files changed

+29
-165
lines changed

internal/integrationtest/devops_deploy_artifact_command_spec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ var (
5151
}
5252
deployCommandSpecArtifactDeployArtifactSourceRepresentation = map[string]interface{}{
5353
"deploy_artifact_source_type": acctest.Representation{RepType: acctest.Required, Create: `INLINE`},
54-
"base64encoded_content": acctest.Representation{RepType: acctest.Required, Create: " base64_encode", Update: "base64_encode_update"},
54+
"base64encoded_content": acctest.Representation{RepType: acctest.Required, Create: "base64_encode", Update: "base64_encode_update"},
5555
}
5656

5757
DevopsDeployCommandSpecArtifactResourceDependencies = acctest.GenerateResourceFromRepresentationMap("oci_devops_project", "test_project", acctest.Required, acctest.Create, DevopsProjectRepresentation) +

internal/service/devops/devops_deployment_resource.go

Lines changed: 28 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package devops
55

66
import (
77
"context"
8+
"encoding/json"
89
"fmt"
910
"log"
1011
"strings"
@@ -381,114 +382,9 @@ func DevopsDeploymentResource() *schema.Resource {
381382

382383
// Computed
383384
"deploy_stage_execution_progress": {
384-
Type: schema.TypeList,
385+
Type: schema.TypeMap,
385386
Computed: true,
386-
Elem: &schema.Resource{
387-
Schema: map[string]*schema.Schema{
388-
389-
"deploy_stage_display_name": {
390-
Type: schema.TypeString,
391-
Computed: true,
392-
},
393-
"deploy_stage_execution_progress_details": {
394-
Type: schema.TypeList,
395-
Computed: true,
396-
Elem: &schema.Resource{
397-
Schema: map[string]*schema.Schema{
398-
399-
"target_id": {
400-
Type: schema.TypeString,
401-
Computed: true,
402-
},
403-
"target_group": {
404-
Type: schema.TypeString,
405-
Computed: true,
406-
},
407-
"steps": {
408-
Type: schema.TypeList,
409-
Computed: true,
410-
Elem: &schema.Resource{
411-
Schema: map[string]*schema.Schema{
412-
"name": {
413-
Type: schema.TypeString,
414-
Computed: true,
415-
},
416-
"state": {
417-
Type: schema.TypeString,
418-
Computed: true,
419-
},
420-
"time_started": {
421-
Type: schema.TypeString,
422-
Computed: true,
423-
},
424-
"time_finished": {
425-
Type: schema.TypeString,
426-
Computed: true,
427-
},
428-
},
429-
},
430-
},
431-
"rollback_steps": {
432-
Type: schema.TypeList,
433-
Computed: true,
434-
Elem: &schema.Resource{
435-
Schema: map[string]*schema.Schema{
436-
"name": {
437-
Type: schema.TypeString,
438-
Computed: true,
439-
},
440-
"state": {
441-
Type: schema.TypeString,
442-
Computed: true,
443-
},
444-
"time_started": {
445-
Type: schema.TypeString,
446-
Computed: true,
447-
},
448-
"time_finished": {
449-
Type: schema.TypeString,
450-
Computed: true,
451-
},
452-
},
453-
},
454-
},
455-
},
456-
},
457-
},
458-
"deploy_stage_id": {
459-
Type: schema.TypeString,
460-
Computed: true,
461-
},
462-
"deploy_stage_type": {
463-
Type: schema.TypeString,
464-
Computed: true,
465-
},
466-
"status": {
467-
Type: schema.TypeString,
468-
Computed: true,
469-
},
470-
"deploy_stage_predecessors": {
471-
Type: schema.TypeList,
472-
Computed: true,
473-
Elem: &schema.Resource{
474-
Schema: map[string]*schema.Schema{
475-
"deploy_stage_predecessor": {
476-
Type: schema.TypeString,
477-
Computed: true,
478-
},
479-
},
480-
},
481-
},
482-
"time_finished": {
483-
Type: schema.TypeString,
484-
Computed: true,
485-
},
486-
"time_started": {
487-
Type: schema.TypeString,
488-
Computed: true,
489-
},
490-
},
491-
},
387+
Elem: schema.TypeString,
492388
},
493389
"time_finished": {
494390
Type: schema.TypeString,
@@ -774,6 +670,7 @@ func (s *DevopsDeploymentResourceCrud) SetData() error {
774670
} else {
775671
s.D.Set("deployment_arguments", nil)
776672
}
673+
777674
if v.DeploymentExecutionProgress != nil {
778675
s.D.Set("deployment_execution_progress", []interface{}{DeploymentExecutionProgressToMap(v.DeploymentExecutionProgress)})
779676
} else {
@@ -1115,63 +1012,6 @@ func DeployStageExecutionStepToMap(obj oci_devops.DeployStageExecutionStep) map[
11151012
return result
11161013
}
11171014

1118-
func DeploymentExecutionProgressToMap(obj *oci_devops.DeploymentExecutionProgress) map[string]interface{} {
1119-
result := map[string]interface{}{}
1120-
deployStageExecutionProgressInfo := []interface{}{}
1121-
1122-
for _, item := range obj.DeployStageExecutionProgress {
1123-
deployStageExecutionProgressInfo = append(deployStageExecutionProgressInfo, DeploymentStageExecutionProgressToMap(item))
1124-
}
1125-
1126-
result["deploy_stage_execution_progress"] = deployStageExecutionProgressInfo
1127-
1128-
if obj.TimeFinished != nil {
1129-
result["time_finished"] = obj.TimeFinished.String()
1130-
}
1131-
1132-
if obj.TimeStarted != nil {
1133-
result["time_started"] = obj.TimeStarted.String()
1134-
}
1135-
1136-
return result
1137-
}
1138-
1139-
func DeploymentStageExecutionProgressToMap(obj oci_devops.DeployStageExecutionProgress) map[string]interface{} {
1140-
result := map[string]interface{}{}
1141-
1142-
deployStageExecutionProgressDetails := []interface{}{}
1143-
1144-
for _, item := range obj.GetDeployStageExecutionProgressDetails() {
1145-
deployStageExecutionProgressDetails = append(deployStageExecutionProgressDetails, DeployStageExecutionProgressDetailsToMap(item))
1146-
}
1147-
1148-
result["deploy_stage_execution_progress_details"] = deployStageExecutionProgressDetails
1149-
1150-
if obj.GetDeployStageDisplayName() != nil {
1151-
result["deploy_stage_display_name"] = string(*obj.GetDeployStageDisplayName())
1152-
}
1153-
1154-
if obj.GetDeployStageId() != nil {
1155-
result["deploy_stage_id"] = string(*obj.GetDeployStageId())
1156-
}
1157-
1158-
if obj.GetTimeFinished() != nil {
1159-
result["time_finished"] = obj.GetTimeFinished().String()
1160-
}
1161-
1162-
if obj.GetTimeStarted() != nil {
1163-
result["time_started"] = obj.GetTimeStarted().String()
1164-
}
1165-
1166-
if obj.GetDeployStagePredecessors() != nil {
1167-
result["deploy_stage_predecessors"] = obj.GetDeployStagePredecessors
1168-
}
1169-
1170-
result["status"] = obj.GetStatus()
1171-
1172-
return result
1173-
}
1174-
11751015
func (s *DevopsDeploymentResourceCrud) mapToDeployStageOverrideArgument(fieldKeyFormat string) (oci_devops.DeployStageOverrideArgument, error) {
11761016
result := oci_devops.DeployStageOverrideArgument{}
11771017

@@ -1311,6 +1151,30 @@ func DeploymentArgumentCollectionToMap(obj *oci_devops.DeploymentArgumentCollect
13111151
return result
13121152
}
13131153

1154+
func DeploymentExecutionProgressToMap(obj *oci_devops.DeploymentExecutionProgress) map[string]interface{} {
1155+
result := map[string]interface{}{}
1156+
1157+
deployStageExecutionProgress := map[string]interface{}{}
1158+
for key, value := range obj.DeployStageExecutionProgress {
1159+
bytes, err := json.Marshal(value)
1160+
if err != nil {
1161+
continue
1162+
}
1163+
deployStageExecutionProgress[key] = string(bytes)
1164+
}
1165+
result["deploy_stage_execution_progress"] = deployStageExecutionProgress
1166+
1167+
if obj.TimeFinished != nil {
1168+
result["time_finished"] = obj.TimeFinished.String()
1169+
}
1170+
1171+
if obj.TimeStarted != nil {
1172+
result["time_started"] = obj.TimeStarted.String()
1173+
}
1174+
1175+
return result
1176+
}
1177+
13141178
func DevopsDeploymentSummaryToMap(obj oci_devops.DeploymentSummary) map[string]interface{} {
13151179
result := map[string]interface{}{}
13161180
switch v := (obj).(type) {

0 commit comments

Comments
 (0)