Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: begin referencing status.lastPromotedImage #944

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion gitops/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,10 @@ func PrepareSnapshot(ctx context.Context, adapterClient client.Client, applicati
var snapshotComponents []applicationapiv1alpha1.SnapshotComponent
for _, applicationComponent := range *applicationComponents {
applicationComponent := applicationComponent // G601
containerImage := applicationComponent.Spec.ContainerImage
containerImage := applicationComponent.Status.LastPromotedImage
if containerImage == "" {
containerImage = applicationComponent.Spec.ContainerImage
}

var componentSource *applicationapiv1alpha1.ComponentSource
if applicationComponent.Name == component.Name {
Expand Down
5 changes: 4 additions & 1 deletion internal/controller/component/component_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ func (a *Adapter) EnsureComponentIsCleanedUp() (controller.OperationResult, erro
for _, individualComponent := range *applicationComponents {
component := individualComponent
if a.component.Name != component.Name {
containerImage := component.Spec.ContainerImage
containerImage := component.Status.LastPromotedImage
if containerImage == "" {
containerImage = component.Spec.ContainerImage
}
componentSource := gitops.GetComponentSourceFromComponent(&component)
snapshotComponents = append(snapshotComponents, applicationapiv1alpha1.SnapshotComponent{
Name: component.Name,
Expand Down
5 changes: 4 additions & 1 deletion internal/controller/snapshot/snapshot_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,10 @@ func (a *Adapter) prepareGroupSnapshot(application *applicationapiv1alpha1.Appli
a.logger.Info("can't find snapshot with open pull/merge request for component, try to find snapshotComponent from Global Candidate List", "component", applicationComponent.Name)
// if there is no component snapshot found for open PR/MR, we get snapshotComponent from gcl
componentSource := gitops.GetComponentSourceFromComponent(&applicationComponent)
containerImage := applicationComponent.Spec.ContainerImage
containerImage := applicationComponent.Status.LastPromotedImage
if containerImage == "" {
containerImage = applicationComponent.Spec.ContainerImage
}
if containerImage == "" {
a.logger.Info("component cannot be added to snapshot for application due to missing containerImage", "component.Name", applicationComponent.Name)
continue
Expand Down
Loading