Skip to content

Commit

Permalink
Google Java Format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions authored and doks5 committed Dec 14, 2023
1 parent 88d2b9f commit 1257409
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ public static DesiredDataJobDeployment mergeDeployments(
? newDeployment.getEnabled()
: oldDeployment.getEnabled());

resetVdkVersionIfPythonVersionChange(oldDeployment, mergedDeployment);

return mergedDeployment;
}

Expand All @@ -265,6 +267,13 @@ private static void checkDeploymentsCanBeMerged(
}
}

private static void resetVdkVersionIfPythonVersionChange(
DesiredDataJobDeployment oldDeployment, DesiredDataJobDeployment newDeployment) {
if (newDeployment.getPythonVersion() != null && !oldDeployment.getPythonVersion().equals(newDeployment.getPythonVersion())) {
newDeployment.setVdkVersion(null);
}
}

private static void mergeDeploymentResources(
DesiredDataJobDeployment mergedDeployment,
JobDeployment newDeployment,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public void patchDeployment(DataJob dataJob, JobDeployment jobDeployment) {
dataJob.getJobConfig().getTeam(), dataJob.getName(), deploymentStatus.get());
var mergedDeployment =
DeploymentModelConverter.mergeDeployments(oldDeployment, jobDeployment);
resetVdkVersionIfPythonVersionChange(oldDeployment, mergedDeployment);
validateFieldsCanBePatched(oldDeployment, mergedDeployment);

// we are setting sendNotification to false since it's not necessary. If something fails we'd
Expand Down Expand Up @@ -161,6 +162,7 @@ public void updateDeployment(
dataJob.getJobConfig().getTeam(), dataJob.getName(), deploymentStatus.get());
setPythonVersionIfNull(oldDeployment, jobDeployment);
jobDeployment = DeploymentModelConverter.mergeDeployments(oldDeployment, jobDeployment);
resetVdkVersionIfPythonVersionChange(oldDeployment, jobDeployment);
}

if (jobDeployment.getPythonVersion() == null) {
Expand Down Expand Up @@ -269,4 +271,10 @@ private void setPythonVersionIfNull(JobDeployment oldDeployment, JobDeployment n
newDeployment.setPythonVersion(supportedPythonVersions.getDefaultPythonVersion());
}
}

private void resetVdkVersionIfPythonVersionChange(JobDeployment oldDeployment, JobDeployment newDeployment) {
if (newDeployment.getPythonVersion() != null && !oldDeployment.getPythonVersion().equals(newDeployment.getPythonVersion())) {
newDeployment.setVdkVersion(null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;

import java.time.OffsetDateTime;
Expand Down

0 comments on commit 1257409

Please sign in to comment.