Skip to content

Commit

Permalink
Added 'skip' options to goals. (fabric8io#1471)
Browse files Browse the repository at this point in the history
  • Loading branch information
Devang Gaur authored and bohmber committed Jan 10, 2019
1 parent 2f35a12 commit 0e26516
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ After this we will switch probably to real [Semantic Versioning 2.0.0](http://se
* Fix 690: Removes deprecated _legacyPortMapping_ property.
* Fix 1458: Support for from Image configuration in openshift docker build strategy
* Fix 1467: Wait timeout for build pod is too small
* Fix 732: Added 'skip' options to goals.

### 4.0.0-M2 (2018-12-14)
* Fix 10: Make VolumeConfiguration more flexible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,16 @@ public class ApplyMojo extends AbstractFabric8Mojo {
@Parameter(property = "fabric8.s2i.buildNameSuffix", defaultValue = "-s2i")
protected String s2iBuildNameSuffix;

@Parameter(property = "fabric8.skip.apply", defaultValue = "false")
protected boolean skipApply;

private ClusterAccess clusterAccess;
protected ApplyService applyService;

public void executeInternal() throws MojoExecutionException {
if (skipApply) {
return;
}

clusterAccess = new ClusterAccess(getClusterConfiguration());

Expand Down Expand Up @@ -649,4 +655,4 @@ protected MavenProject getRootProject() {
return project;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ public class BuildMojo extends io.fabric8.maven.docker.BuildMojo {
@Parameter(property = "fabric8.build.recreate", defaultValue = "none")
private String buildRecreate;

@Parameter(property = "docker.skip.build", defaultValue = "false")
protected boolean skipBuild;

@Component
private MavenProjectHelper projectHelper;

Expand Down Expand Up @@ -215,6 +218,10 @@ protected boolean isDockerAccessRequired() {

@Override
protected void executeInternal(ServiceHub hub) throws MojoExecutionException {
if (skipBuild) {
return;
}

try {
if (shouldSkipBecauseOfPomPackaging()) {
getLog().info("Disabling docker build for pom packaging");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,17 @@ public class PushMojo extends io.fabric8.maven.docker.PushMojo {
@Parameter(property = "fabric8.build.strategy" )
private OpenShiftBuildStrategy buildStrategy = OpenShiftBuildStrategy.s2i;

@Parameter(property = "docker.skip.push", defaultValue = "false")
protected boolean skipPush;

@Override
protected String getLogPrefix() {
return "F8> ";
}

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (skip) {
if (skip || skipPush) {
return;
}
super.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ public class ResourceMojo extends AbstractFabric8Mojo {
@Parameter(property = "kompose.dir", defaultValue = "${user.home}/.kompose/bin")
private File komposeBinDir;

@Parameter(property = "docker.skip.resource", defaultValue = "false")
protected boolean skipResource;

// Access for creating OpenShift binary builds
private ClusterAccess clusterAccess;

Expand Down Expand Up @@ -427,6 +430,10 @@ private static File writeResource(File resourceFileBase, Object entity, Resource
}

public void executeInternal() throws MojoExecutionException, MojoFailureException {
if (skipResource) {
return;
}

realResourceDir = ResourceDirCreator.getFinalResourceDir(resourceDir, environment);
realResourceDirOpenShiftOverride = ResourceDirCreator.getFinalResourceDir(resourceDirOpenShiftOverride, environment);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
package io.fabric8.maven.plugin.mojo.develop;

import io.fabric8.maven.plugin.mojo.build.ApplyMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Execute;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.plugins.annotations.Parameter;

/**
* This goal forks the install goal then applies the generated kubernetes resources to the current cluster.
Expand All @@ -32,4 +34,16 @@

@Mojo(name = "deploy", requiresDependencyResolution = ResolutionScope.COMPILE, defaultPhase = LifecyclePhase.VALIDATE)
@Execute(phase = LifecyclePhase.INSTALL)
public class DeployMojo extends ApplyMojo { }
public class DeployMojo extends ApplyMojo {
@Parameter(property = "docker.skip.deploy", defaultValue = "false")
protected boolean skipDeploy;

@Override
public void executeInternal() throws MojoExecutionException {
if (skipDeploy) {
return;
}

super.executeInternal();
}
}

0 comments on commit 0e26516

Please sign in to comment.