Skip to content

Commit

Permalink
Fix RemoveDeploymentTriggerDecorator order
Browse files Browse the repository at this point in the history
  • Loading branch information
Sgitario committed Feb 2, 2023
1 parent fcb7e7b commit e820786
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public ChangeDeploymentTriggerDecorator(String containerName, String imageStream

@Override
public Class<? extends Decorator>[] after() {
return new Class[] { ApplyDeploymentTriggerDecorator.class, RemoveDeploymentTriggerDecorator.class };
return new Class[] { ApplyDeploymentTriggerDecorator.class };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public List<DecoratorBuildItem> createDecorators(ApplicationInfoBuildItem applic
String imageStreamWithTag = name + ":" + i.getTag();
result.add(new DecoratorBuildItem(OPENSHIFT, new ApplyContainerImageDecorator(name, imageStreamWithTag)));
// remove the default trigger which has a wrong version
result.add(new DecoratorBuildItem(OPENSHIFT, new RemoveDeploymentTriggerDecorator()));
result.add(new DecoratorBuildItem(OPENSHIFT, new RemoveDeploymentTriggerDecorator(name)));
// re-add the trigger with the correct version
result.add(new DecoratorBuildItem(OPENSHIFT, new ChangeDeploymentTriggerDecorator(name, imageStreamWithTag)));
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@

import io.dekorate.kubernetes.decorator.Decorator;
import io.dekorate.kubernetes.decorator.NamedResourceDecorator;
import io.dekorate.openshift.decorator.ApplyDeploymentTriggerDecorator;
import io.fabric8.kubernetes.api.model.ObjectMeta;
import io.fabric8.openshift.api.model.DeploymentConfigSpecFluent;

public class RemoveDeploymentTriggerDecorator extends NamedResourceDecorator<DeploymentConfigSpecFluent<?>> {

public RemoveDeploymentTriggerDecorator(String name) {
super(name);
}

@Override
public void andThenVisit(DeploymentConfigSpecFluent<?> deploymentConfigSpec, ObjectMeta objectMeta) {
deploymentConfigSpec.withTriggers(Collections.emptyList());
}

@Override
public Class<? extends Decorator>[] after() {
return new Class[] { ApplyDeploymentTriggerDecorator.class };
public Class<? extends Decorator>[] before() {
return new Class[] { ChangeDeploymentTriggerDecorator.class };
}
}

0 comments on commit e820786

Please sign in to comment.