Skip to content

Commit

Permalink
fix: workaround decorator ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
iocanel committed Jan 24, 2023
1 parent a013f38 commit ea65e52
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package io.quarkus.kubernetes.deployment;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import io.dekorate.kubernetes.decorator.Decorator;
import io.dekorate.openshift.decorator.ApplyDeploymentTriggerDecorator;

Expand All @@ -11,6 +15,13 @@ public ChangeDeploymentTriggerDecorator(String containerName, String imageStream

@Override
public Class<? extends Decorator>[] after() {
return new Class[] { ApplyDeploymentTriggerDecorator.class, RemoveDeploymentTriggerDecorator.class };
//There is a series of issues in dekorate that breaks ordering of the ApplyDeploymentTriggerDecorator.
//The problem is that the ApplyDeploymentTrigger decorator depends any a lot of irrelevant Decorators
//So, this one needs to inherit the same decorator or else we can't guarantee that its executed after
//the ApplyDeploymentTriggerDecorator.
List<Class<? extends Decorator>> classes = new ArrayList<>(Arrays.asList(super.after()));
classes.add(ApplyDeploymentTriggerDecorator.class);
classes.add(RemoveBuilderImageResourceDecorator.class);
return classes.toArray(new Class[classes.size()]);
}
}

0 comments on commit ea65e52

Please sign in to comment.