|
@@ -78,7 +78,37 @@ const BuildSettingsTab: React.FC<Props> = ({ chart, isPreviousVersion }) => {
|
|
|
() => chart?.git_action_config?.git_branch
|
|
() => chart?.git_action_config?.git_branch
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- const saveNewBranch = async (newBranch: string) => {};
|
|
|
|
|
|
|
+ const saveNewBranch = async (newBranch: string) => {
|
|
|
|
|
+ if (!newBranch?.length) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (newBranch === chart?.git_action_config?.git_branch) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const newGitActionConfig: FullActionConfigType = {
|
|
|
|
|
+ ...chart.git_action_config,
|
|
|
|
|
+ git_branch: newBranch,
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ api.updateGitActionConfig(
|
|
|
|
|
+ "<token>",
|
|
|
|
|
+ {
|
|
|
|
|
+ git_action_config: newGitActionConfig,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ project_id: currentProject.id,
|
|
|
|
|
+ cluster_id: currentCluster.id,
|
|
|
|
|
+ release_name: chart.name,
|
|
|
|
|
+ namespace: chart.namespace,
|
|
|
|
|
+ }
|
|
|
|
|
+ );
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ throw error;
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
const saveBuildConfig = async (config: BuildConfig) => {
|
|
const saveBuildConfig = async (config: BuildConfig) => {
|
|
|
if (config === null) {
|
|
if (config === null) {
|
|
@@ -214,6 +244,7 @@ const BuildSettingsTab: React.FC<Props> = ({ chart, isPreviousVersion }) => {
|
|
|
setButtonStatus("loading");
|
|
setButtonStatus("loading");
|
|
|
try {
|
|
try {
|
|
|
await saveBuildConfig(buildConfig);
|
|
await saveBuildConfig(buildConfig);
|
|
|
|
|
+ await saveNewBranch(currentBranch);
|
|
|
await saveEnvVariables(envVariables);
|
|
await saveEnvVariables(envVariables);
|
|
|
setButtonStatus("successful");
|
|
setButtonStatus("successful");
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
@@ -228,6 +259,7 @@ const BuildSettingsTab: React.FC<Props> = ({ chart, isPreviousVersion }) => {
|
|
|
setButtonStatus("loading");
|
|
setButtonStatus("loading");
|
|
|
try {
|
|
try {
|
|
|
await saveBuildConfig(buildConfig);
|
|
await saveBuildConfig(buildConfig);
|
|
|
|
|
+ await saveNewBranch(currentBranch);
|
|
|
await saveEnvVariables(envVariables);
|
|
await saveEnvVariables(envVariables);
|
|
|
await triggerWorkflow();
|
|
await triggerWorkflow();
|
|
|
setButtonStatus("successful");
|
|
setButtonStatus("successful");
|