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

Adds org back to git config map #78

Merged
merged 1 commit into from
Dec 16, 2020
Merged
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
4 changes: 2 additions & 2 deletions src/services/git-secret/git-parameters.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class GetGitParametersImpl implements GetGitParameters {

async getGitParameters(options: GitParametersOptions = {}, notifyStatus?: (s: string) => void): Promise<GitParams> {

const parsedGitUrl: {url: string; host: string; owner: string; repo: string} = await this.getGitConfig(options.remote, options.workingDir);
const parsedGitUrl: {url: string; host: string; owner: string; repo: string; protocol: string} = await this.getGitConfig(options.remote, options.workingDir);
const currentBranch: string = await this.getCurrentBranch(options.workingDir);

console.log(` Project git repo: ${parsedGitUrl.url}`);
Expand Down Expand Up @@ -53,7 +53,7 @@ export class GetGitParametersImpl implements GetGitParameters {
return result;
}

async getGitConfig(remote: string = 'origin', workingDir: string = process.cwd()): Promise<{url: string; host: string; owner: string; repo: string}> {
async getGitConfig(remote: string = 'origin', workingDir: string = process.cwd()): Promise<{url: string; host: string; owner: string; repo: string; protocol: string}> {
return parseGitUrl(await this.getRemoteGitUrl(remote, workingDir));
}

Expand Down
1 change: 1 addition & 0 deletions src/services/git-secret/git-params.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
export class GitParams {
name: string;
url: string;
protocol?: string;
owner: string;
repo: string;
username: string;
Expand Down
5 changes: 4 additions & 1 deletion src/services/git-secret/git-secret.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ export class GitSecretImpl implements GitSecret {
}

buildGitConfigBody(configName: string, gitParams: GitParams): ConfigMap {
const ownerOrg = _.get(gitParams, 'owner', _.get(gitParams, 'org'));
const data = Object.assign(_.pick(gitParams, ['url', 'host', 'repo', 'branch', 'protocol']), {org: ownerOrg, owner: ownerOrg});

return {
apiVersion: 'v1',
kind: 'ConfigMap',
Expand All @@ -102,7 +105,7 @@ export class GitSecretImpl implements GitSecret {
type: 'git',
},
},
data: _.pick(gitParams, ['url', 'host', 'org', 'repo', 'branch']),
data,
};
}
}