Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove scm metdata in push #15639

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions cdap-proto/src/main/java/io/cdap/cdap/proto/ApplicationDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,51 @@ public static ApplicationDetail fromSpec(ApplicationSpecification spec,
change, sourceControlMeta,
spec.getConfiguration(), datasets, programs, plugins, summary, ownerPrincipal);
}

public static Builder builder(ApplicationDetail detail) {
return new Builder(detail);
}

/**
* Builder for ApplicationDetail.
*/
public static class Builder {
private final String name;
private final String appVersion;
private final String description;
@Nullable
private final ChangeDetail change;
@Nullable
private SourceControlMeta sourceControlMeta;
private final String configuration;
private final List<DatasetDetail> datasets;
private final List<ProgramRecord> programs;
private final List<PluginDetail> plugins;
private final ArtifactSummary artifact;
private final String ownerPrincipal;

private Builder(ApplicationDetail detail) {
this.name = detail.getName();
this.appVersion = detail.getAppVersion();
this.description = detail.getDescription();
this.change = detail.getChange();
this.sourceControlMeta = detail.getSourceControlMeta();
this.configuration = detail.getConfiguration();
this.datasets = detail.getDatasets();
this.programs = detail.getPrograms();
this.plugins = detail.getPlugins();
this.artifact = detail.getArtifact();
this.ownerPrincipal = detail.getOwnerPrincipal();
}

public Builder setSourceControlMeta(SourceControlMeta sourceControlMeta) {
this.sourceControlMeta = sourceControlMeta;
return this;
}

public ApplicationDetail build() {
return new ApplicationDetail(name, appVersion, description, change, sourceControlMeta,
configuration, datasets, programs, plugins, artifact, ownerPrincipal);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ private void writeAppDetail(RepositoryManager repositoryManager, ApplicationDeta
// Opens the file for writing, creating the file if it doesn't exist,
// or truncating an existing regular-file to a size of 0
try (FileWriter writer = new FileWriter(filePathToWrite.toString())) {
GSON.toJson(appToPush, writer);
// remove scm metadata
ApplicationDetail detailWithoutScm = ApplicationDetail.builder(appToPush)
.setSourceControlMeta(null).build();
GSON.toJson(detailWithoutScm, writer);
} catch (IOException e) {
throw new ConfigFileWriteException(
String.format("Failed to write application config to path %s", appRelativePath), e
Expand Down
Loading