File tree 1 file changed +31
-1
lines changed
1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -79,6 +79,36 @@ function removeIgnoredAttributes(taskDef) {
79
79
return taskDef ;
80
80
}
81
81
82
+ function maintainValidObjects ( taskDef ) {
83
+ if ( validateProxyConfigurations ( taskDef ) ) {
84
+ taskDef . proxyConfiguration . properties . forEach ( ( property , index , arr ) => {
85
+ if ( ! ( 'value' in property ) ) {
86
+ arr [ index ] . value = '' ;
87
+ }
88
+ if ( ! ( 'name' in property ) ) {
89
+ arr [ index ] . name = '' ;
90
+ }
91
+ } ) ;
92
+ }
93
+
94
+ if ( taskDef && taskDef . containerDefinitions ) {
95
+ taskDef . containerDefinitions . forEach ( ( container ) => {
96
+ if ( container . environment ) {
97
+ container . environment . forEach ( ( property , index , arr ) => {
98
+ if ( ! ( 'value' in property ) ) {
99
+ arr [ index ] . value = '' ;
100
+ }
101
+ } ) ;
102
+ }
103
+ } ) ;
104
+ }
105
+ return taskDef ;
106
+ }
107
+
108
+ function validateProxyConfigurations ( taskDef ) {
109
+ return 'proxyConfiguration' in taskDef && taskDef . proxyConfiguration . type && taskDef . proxyConfiguration . type == 'APPMESH' && taskDef . proxyConfiguration . properties && taskDef . proxyConfiguration . properties . length > 0 ;
110
+ }
111
+
82
112
async function run ( ) {
83
113
try {
84
114
const agent = 'amazon-ecs-run-task-for-github-actions'
@@ -104,7 +134,7 @@ async function run() {
104
134
taskDefinitionFile :
105
135
path . join ( process . env . GITHUB_WORKSPACE , taskDefinitionFile ) ;
106
136
const fileContents = fs . readFileSync ( taskDefPath , 'utf8' ) ;
107
- const taskDefContents = removeIgnoredAttributes ( cleanNullKeys ( yaml . parse ( fileContents ) ) ) ;
137
+ const taskDefContents = maintainValidObjects ( removeIgnoredAttributes ( cleanNullKeys ( yaml . parse ( fileContents ) ) ) ) ;
108
138
109
139
let registerResponse ;
110
140
try {
You can’t perform that action at this time.
0 commit comments