Skip to content

Commit

Permalink
update metadataanalyzer with built-in aws profile
Browse files Browse the repository at this point in the history
Signed-off-by: Eileen Yu <[email protected]>
  • Loading branch information
Eileen-Yu committed Sep 4, 2024
1 parent 6206aea commit fe6fad8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .build-tools/pkg/metadataanalyzer/analyzer.template
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,30 @@ func getYamlMetadata(basePath string, pkg string) *map[string]string {

func checkMissingMetadata(yamlMetadata *map[string]string, componentMetadata mdutils.MetadataMap) []string {
missingMetadata := make([]string, 0)
if yamlMetadata == nil {
return missingMetadata
}

// use the built-in aws profile, don't need check in the metadata yaml file
usingAWSProfile := false
for key := range *yamlMetadata {
if strings.Contains(strings.ToLower(key), "aws") {
usingAWSProfile = true
break
}
}

// if there is no yaml metadata, then we are not missing anything yet
if yamlMetadata != nil && len(*yamlMetadata) > 0 {
if len(*yamlMetadata) > 0 {
for key, md := range componentMetadata {
if md.Ignored {
continue
}

if usingAWSProfile && (strings.ToLower(key) == "awsaccesskey" || strings.ToLower(key) == "awssecretkey" || strings.ToLower(key) == "awsregion") {
continue
}

lowerKey := strings.ToLower(key)
if _, ok := (*yamlMetadata)[lowerKey]; !ok {
missingMetadata = append(missingMetadata, key)
Expand Down

0 comments on commit fe6fad8

Please sign in to comment.