Skip to content

Commit

Permalink
fix: handle delete of docker env value
Browse files Browse the repository at this point in the history
  • Loading branch information
blumamir committed Dec 6, 2024
1 parent a9d05b0 commit a50adef
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions common/envOverwrite/overwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,24 @@ func GetPatchedEnvValue(envName string, observedValue string, currentSdk *common

// check if we already processed this env since it's annotation
if annotationOriginalValueFound {

desiredFullValueWithObserved := observedValue
if !strings.Contains(observedValue, desiredOdigosPart) {
desiredFullValueWithObserved = observedValue + envMetadata.delim + desiredOdigosPart
}

if currentContainerManifestValue == nil {
return &desiredOdigosPart, nil
// if the value is from dockerfile, we need to add observed value to it
if annotationOriginalValue == nil {
return &desiredFullValueWithObserved, nil
} else {
return &desiredOdigosPart, nil
}
}

// this part checks if the value in the env is what odigos would use,
// and if it is, don't make any changes
desiredFullValue := observedValue + envMetadata.delim + desiredOdigosPart
if desiredFullValue == *currentContainerManifestValue {
if desiredFullValueWithObserved == *currentContainerManifestValue {
return currentContainerManifestValue, annotationOriginalValue
}

Expand Down

0 comments on commit a50adef

Please sign in to comment.