public BuildSourceFluentImpl(BuildSource instance){ this.withBinary(instance.getBinary()); this.withContextDir(instance.getContextDir()); this.withDockerfile(instance.getDockerfile()); this.withGit(instance.getGit()); this.withImages(instance.getImages()); this.withSecrets(instance.getSecrets()); this.withSourceSecret(instance.getSourceSecret()); this.withType(instance.getType()); }
public BuildSourceBuilder( BuildSourceFluent<?> fluent ){ this(fluent, new BuildSource()); } public BuildSourceBuilder( BuildSourceFluent<?> fluent , BuildSource instance ){
public BuildSourceBuilder( BuildSourceFluent<?> fluent , BuildSource instance ){ this.fluent = fluent; fluent.withContextDir(instance.getContextDir()); fluent.withGit(instance.getGit()); fluent.withSourceSecret(instance.getSourceSecret()); fluent.withType(instance.getType()); } public BuildSourceBuilder( BuildSource instance ){
/** * 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); }
source.getGit() != null && source.getGit().getUri() != null) { if (jenkinsfilePath == null) { jenkinsfilePath = DEFAULT_JENKINS_FILEPATH; if (!isEmpty(source.getContextDir())) { jenkinsfilePath = new File(source.getContextDir(), jenkinsfilePath).getPath(); GitBuildSource gitSource = source.getGit(); String branchRef = gitSource.getRef(); List<BranchSpec> branchSpecs = Collections.emptyList();
throw new NotFoundException("No BuildConfig source for " + remoteRepository); GitBuildSource gitSource = source.getGit(); if (gitSource == null) { throw new NotFoundException("No BuildConfig git source for " + remoteRepository); LocalObjectReference sourceSecret = source.getSourceSecret(); if (sourceSecret != null) { sourceSecretName = sourceSecret.getName();
/** * 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); }
public static GitBuildSource gitBuildSource(BuildConfig buildConfig) { GitBuildSource git = null; BuildConfigSpec spec = buildConfig.getSpec(); if (spec != null) { BuildSource source = spec.getSource(); if (source != null) { git = source.getGit(); } } return git; }
String scriptPath = cpsScmFlowDefinition.getScriptPath(); if (scriptPath != null && scriptPath.trim().length() > 0) { String bcContextDir = buildConfig.getSpec().getSource().getContextDir(); if (StringUtils.isNotBlank(bcContextDir) && scriptPath.startsWith(bcContextDir)) { scriptPath = scriptPath.replaceFirst("^" + bcContextDir + "/?", "");
private void validateSourceType(String buildName, BuildConfigSpec spec) { BuildSource source = spec.getSource(); if (source != null) { String sourceType = source.getType(); if (!Objects.equals("Binary", sourceType)) { log.warn("BuildServiceConfig %s is not of type: 'Binary' but is '%s' !", buildName, sourceType); } } }
public BuildSourceBuilder( BuildSourceFluent<?> fluent , BuildSource instance ){ this.fluent = fluent; fluent.withContextDir(instance.getContextDir()); fluent.withGit(instance.getGit()); fluent.withSourceSecret(instance.getSourceSecret()); fluent.withType(instance.getType()); } public BuildSourceBuilder( BuildSource instance ){
public BuildCause(Build build) { if (build == null || build.getMetadata() == null) { return; } ObjectMeta meta = build.getMetadata(); uid = meta.getUid(); namespace = meta.getNamespace(); name = meta.getName(); if (build.getSpec() != null) { if (build.getSpec().getSource() != null && build.getSpec().getSource().getGit() != null) { GitBuildSource git = build.getSpec().getSource().getGit(); gitUri = git.getUri(); } if (build.getSpec().getRevision() != null && build.getSpec().getRevision().getGit() != null) { commit = build.getSpec().getRevision().getGit().getCommit(); } } }
public BuildConfigProjectProperty(BuildConfig bc) { this( bc.getMetadata().getNamespace(), bc.getMetadata().getName(), bc.getMetadata().getUid(), bc.getMetadata().getResourceVersion(), bc.getSpec().getSource().getContextDir() ); }
public BuildSourceBuilder(BuildSource instance,Boolean validationEnabled){ this.fluent = this; this.withBinary(instance.getBinary()); this.withContextDir(instance.getContextDir()); this.withDockerfile(instance.getDockerfile()); this.withGit(instance.getGit()); this.withImages(instance.getImages()); this.withSecrets(instance.getSecrets()); this.withSourceSecret(instance.getSourceSecret()); this.withType(instance.getType()); this.validationEnabled = validationEnabled; }
public BuildSourceBuilder( BuildSource instance ){ this.fluent = this; this.withContextDir(instance.getContextDir()); this.withGit(instance.getGit()); this.withSourceSecret(instance.getSourceSecret()); this.withType(instance.getType()); }
public BuildSourceBuilder( BuildSourceFluent<?> fluent ){ this(fluent, new BuildSource()); } public BuildSourceBuilder( BuildSourceFluent<?> fluent , BuildSource instance ){
contextDir = buildConfig.getSpec().getSource().getContextDir();
public BuildSourceBuilder(BuildSourceFluent<?> fluent,BuildSource instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withBinary(instance.getBinary()); fluent.withContextDir(instance.getContextDir()); fluent.withDockerfile(instance.getDockerfile()); fluent.withGit(instance.getGit()); fluent.withImages(instance.getImages()); fluent.withSecrets(instance.getSecrets()); fluent.withSourceSecret(instance.getSourceSecret()); fluent.withType(instance.getType()); this.validationEnabled = validationEnabled; } public BuildSourceBuilder(BuildSource instance){
public BuildSourceBuilder( BuildSource instance ){ this.fluent = this; this.withContextDir(instance.getContextDir()); this.withGit(instance.getGit()); this.withSourceSecret(instance.getSourceSecret()); this.withType(instance.getType()); }
public BuildSourceBuilder(){ this(new BuildSource()); } public BuildSourceBuilder( BuildSourceFluent<?> fluent ){