diff --git a/.changeset/pink-bees-shake.md b/.changeset/pink-bees-shake.md new file mode 100644 index 0000000000..2d87b7ef6c --- /dev/null +++ b/.changeset/pink-bees-shake.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-node': patch +--- + +Make sure that isomorphic git push commands are not proxied. diff --git a/plugins/scaffolder-node/src/actions/gitHelpers.test.ts b/plugins/scaffolder-node/src/actions/gitHelpers.test.ts index 7a61e592ec..664cc5c893 100644 --- a/plugins/scaffolder-node/src/actions/gitHelpers.test.ts +++ b/plugins/scaffolder-node/src/actions/gitHelpers.test.ts @@ -98,18 +98,11 @@ describe('initRepoAndPush', () => { }); }); - it('adds the appropriate remote', () => { - expect(mockedGit.addRemote).toHaveBeenCalledWith({ - dir: '/test/repo/dir/', - url: 'git@github.com:test/repo.git', - remote: 'origin', - }); - }); - it('pushes to the remote', () => { expect(mockedGit.push).toHaveBeenCalledWith({ dir: '/test/repo/dir/', remote: 'origin', + url: 'git@github.com:test/repo.git', }); }); }); diff --git a/plugins/scaffolder-node/src/actions/gitHelpers.ts b/plugins/scaffolder-node/src/actions/gitHelpers.ts index 9f2d5709a7..e24c0cf025 100644 --- a/plugins/scaffolder-node/src/actions/gitHelpers.ts +++ b/plugins/scaffolder-node/src/actions/gitHelpers.ts @@ -65,15 +65,11 @@ export async function initRepoAndPush(input: { author: authorInfo, committer: authorInfo, }); - await git.addRemote({ - dir, - url: remoteUrl, - remote: 'origin', - }); await git.push({ dir, remote: 'origin', + url: remoteUrl, }); return { commitHash }; diff --git a/plugins/scaffolder-node/src/scm/git.test.ts b/plugins/scaffolder-node/src/scm/git.test.ts index 1c07dfb917..4a472a675a 100644 --- a/plugins/scaffolder-node/src/scm/git.test.ts +++ b/plugins/scaffolder-node/src/scm/git.test.ts @@ -452,6 +452,8 @@ describe('Git', () => { 'user-agent': 'git/@isomorphic-git', }, onAuth: expect.any(Function), + corsProxy: '', + url: undefined, }); }); @@ -480,6 +482,8 @@ describe('Git', () => { 'user-agent': 'git/@isomorphic-git', }, onAuth: expect.any(Function), + corsProxy: '', + url: undefined, }); }); @@ -506,6 +510,8 @@ describe('Git', () => { 'user-agent': 'git/@isomorphic-git', }, onAuth: expect.any(Function), + corsProxy: '', + url: undefined, }); }); diff --git a/plugins/scaffolder-node/src/scm/git.ts b/plugins/scaffolder-node/src/scm/git.ts index e7bad693fe..760be73114 100644 --- a/plugins/scaffolder-node/src/scm/git.ts +++ b/plugins/scaffolder-node/src/scm/git.ts @@ -262,9 +262,10 @@ export class Git { dir: string; remote: string; remoteRef?: string; + url?: string; force?: boolean; }) { - const { dir, remote, remoteRef, force } = options; + const { dir, remote, url, remoteRef, force } = options; this.config.logger?.info( `Pushing directory to remote {dir=${dir},remote=${remote}}`, ); @@ -278,7 +279,9 @@ export class Git { force, headers: this.headers, remote, + url, onAuth: this.onAuth, + corsProxy: '', }); } catch (ex) { this.config.logger?.error(