public BuildSourceBuilder( BuildSourceFluent<?> fluent ){ this(fluent, new BuildSource()); } public BuildSourceBuilder( BuildSourceFluent<?> fluent , BuildSource instance ){
public BuildSourceBuilder(){ this(new BuildSource()); } public BuildSourceBuilder( BuildSourceFluent<?> fluent ){
public BuildSourceBuilder( BuildSourceFluent<?> fluent ){ this(fluent, new BuildSource()); } public BuildSourceBuilder( BuildSourceFluent<?> fluent , BuildSource instance ){
public BuildSourceBuilder(){ this(new BuildSource()); } public BuildSourceBuilder( BuildSourceFluent<?> fluent ){
public BuildSourceBuilder(Boolean validationEnabled){ this(new BuildSource(), validationEnabled); } public BuildSourceBuilder(BuildSourceFluent<?> fluent){
public BuildSourceBuilder(BuildSourceFluent<?> fluent,Boolean validationEnabled){ this(fluent, new BuildSource(), validationEnabled); } public BuildSourceBuilder(BuildSourceFluent<?> fluent,BuildSource instance){
public BuildSource build(){ BuildSource buildable = new BuildSource(fluent.getContextDir(),fluent.getGit(),fluent.getSourceSecret(),fluent.getType()); validate(buildable); return buildable; }
public BuildSource build(){ BuildSource buildable = new BuildSource(fluent.getContextDir(),fluent.getGit(),fluent.getSourceSecret(),fluent.getType()); validate(buildable); return buildable; }
public BuildSource build(){ BuildSource buildable = new BuildSource(fluent.getBinary(),fluent.getContextDir(),fluent.getDockerfile(),fluent.getGit(),fluent.getImages(),fluent.getSecrets(),fluent.getSourceSecret(),fluent.getType()); validate(buildable); return buildable; }
/** * This method is public for easier unit testing */ public int processGitRepo(NamespaceName name, String gitUrl, String gitRef) throws IOException { BuildConfig buildConfig = new BuildConfig(); BuildConfigSpec buildConfigSpec = new BuildConfigSpec(); buildConfig.setSpec(buildConfigSpec); BuildSource buildSource = new BuildSource(); buildSource.setType("Git"); GitBuildSource gitSource = new GitBuildSource(); gitSource.setUri(gitUrl); if (Strings.isNullOrBlank(gitRef)) { gitRef = "master"; } gitSource.setRef(gitRef); buildSource.setGit(gitSource); buildConfigSpec.setSource(buildSource); return processGitRepo(name, buildConfig, gitSource, gitUrl); }
/** * Lazily creates the GitSource if need be then updates the git URL * @param buildConfig the BuildConfig to update * @param gitUrl the URL to the git repo * @param ref */ public static void updateGitSourceUrl(BuildConfig buildConfig, String gitUrl, String ref) { BuildConfigSpec spec = buildConfig.getSpec(); if (spec == null) { spec = new BuildConfigSpec(); buildConfig.setSpec(spec); } BuildSource source = spec.getSource(); if (source == null) { source = new BuildSource(); spec.setSource(source); } source.setType("Git"); GitBuildSource gitSource = source.getGit(); if (gitSource == null) { gitSource = new GitBuildSource(); source.setGit(gitSource); } gitSource.setUri(gitUrl); gitSource.setRef(ref); }