Skip to content

Commit

Permalink
Fix RemoveDeploymentTriggerDecorator order
Browse files Browse the repository at this point in the history
The decorator RemoveDeploymentTriggerDecorator was not configured to be triggered before ChangeDeploymentTriggerDecorator, so sometimes the image stream tag was wrong.

Relates to failures in https://github.com/dekorateio/dekorate/actions/runs/4023231521/jobs/6913879180
  • Loading branch information
Sgitario committed Feb 1, 2023
1 parent 247fcb5 commit f9c4e60
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
package io.quarkus.kubernetes.deployment;

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

public class ChangeDeploymentTriggerDecorator extends ApplyDeploymentTriggerDecorator {

public ChangeDeploymentTriggerDecorator(String containerName, String imageStreamTag) {
super(containerName, imageStreamTag);
}

@Override
public Class<? extends Decorator>[] after() {
return new Class[] { ApplyDeploymentTriggerDecorator.class, RemoveDeploymentTriggerDecorator.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 @@ -10,11 +10,20 @@

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>[] before() {
return new Class[] { ChangeDeploymentTriggerDecorator.class };
}

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

0 comments on commit f9c4e60

Please sign in to comment.