Skip to content

Commit

Permalink
feat: create git repository branch if it does not exist (#153)
Browse files Browse the repository at this point in the history
This change updates the Register Repository Page to request Porch to create the git repository branch if it does not exist.
  • Loading branch information
ChristopherFry authored Sep 26, 2022
1 parent 391d37e commit d74c16e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,12 @@ export const RegisterRepositoryPage = () => {
let ociDetails: RepositoryOciDetails | undefined = undefined;

if (state.type === RepositoryType.GIT) {
const createBranch = true;

gitDetails = getRepositoryGitDetails(
state.repoUrl,
state.repoBranch || 'main',
createBranch,
state.repoDir || '/',
secretRef,
);
Expand Down
1 change: 1 addition & 0 deletions plugins/cad/src/types/Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export enum RepositoryContent {
export type RepositoryGitDetails = {
repo: string;
branch: string;
createBranch?: boolean;
directory: string;
secretRef?: RepositorySecretRef;
};
Expand Down
2 changes: 2 additions & 0 deletions plugins/cad/src/utils/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,14 @@ export const getRepositoryResource = (
export const getRepositoryGitDetails = (
repo: string,
branch: string,
createBranch: boolean,
directory: string,
secretRef: RepositorySecretRef | undefined,
): RepositoryGitDetails => {
const gitDetails: RepositoryGitDetails = {
repo,
branch,
createBranch,
directory,
secretRef,
};
Expand Down

0 comments on commit d74c16e

Please sign in to comment.