Skip to content

Commit f4594d4

Browse files
authored
Revert "fix: clone functionality to include submodules (#1413)" (#1549)
This reverts commit a5c0016. Please ensure your pull request adheres to the following guidelines: - [ ] make sure to link the related issues in this description - [ ] when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes ## Related Issues Thanks for contributing!
1 parent 9456b7c commit f4594d4

2 files changed

Lines changed: 6 additions & 24 deletions

File tree

packages/spacecat-shared-cloud-manager-client/src/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,7 @@ export default class CloudManagerClient {
260260
* Builds authenticated git arguments for a remote command (clone, push, or pull).
261261
*
262262
* Both repo types use http.extraheader for authentication:
263-
* - Standard repos: Basic auth header via extraheader scoped to the org prefix
264-
* (scheme + host + '/' + orgName + '/'), so the header covers all repos and submodules
265-
* belonging to that customer org without granting access to other orgs on the same host
263+
* - Standard repos: Basic auth header via extraheader on the repo URL
266264
* - BYOG repos: Bearer token + API key + IMS org ID via extraheader on the CM Repo URL
267265
*
268266
* @param {string} command - The git command ('clone', 'push', or 'pull')
@@ -278,11 +276,8 @@ export default class CloudManagerClient {
278276
if (repoType === CM_REPO_TYPE.STANDARD) {
279277
const credentials = this.#getStandardRepoCredentials(programId);
280278
const basicAuth = Buffer.from(credentials).toString('base64');
281-
const parsedUrl = new URL(repoUrl);
282-
const orgName = parsedUrl.pathname.split('/')[1];
283-
const repoOrgPrefix = `${parsedUrl.origin}/${orgName}/`;
284279
return [
285-
'-c', `http.${repoOrgPrefix}.extraheader=Authorization: Basic ${basicAuth}`,
280+
'-c', `http.${repoUrl}.extraheader=Authorization: Basic ${basicAuth}`,
286281
command, repoUrl,
287282
];
288283
}
@@ -321,7 +316,7 @@ export default class CloudManagerClient {
321316
this.log.info(`Cloning CM repository: program=${programId}, repo=${repositoryId}, type=${repoType}`);
322317

323318
const args = await this.#buildAuthGitArgs('clone', programId, repositoryId, { imsOrgId, repoType, repoUrl });
324-
this.#execGit([...args, '--recurse-submodules', clonePath]);
319+
this.#execGit([...args, clonePath]);
325320
this.log.info(`Repository cloned to ${clonePath}`);
326321
this.#logTmpDiskUsage('clone');
327322

packages/spacecat-shared-cloud-manager-client/test/cloud-manager-client.test.js

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -278,27 +278,14 @@ describe('CloudManagerClient', () => {
278278
const cloneArgs = getGitArgs(execFileSyncStub.firstCall);
279279
const cloneArgsStr = getGitArgsStr(execFileSyncStub.firstCall);
280280
expect(cloneArgs).to.include('clone');
281-
expect(cloneArgsStr).to.include('http.https://git.cloudmanager.adobe.com/myorg/.extraheader=Authorization: Basic c3RkdXNlcjpzdGR0b2tlbjEyMw==');
281+
expect(cloneArgsStr).to.include(`http.${TEST_STANDARD_REPO_URL}.extraheader=Authorization: Basic c3RkdXNlcjpzdGR0b2tlbjEyMw==`);
282282
expect(cloneArgsStr).to.include(TEST_STANDARD_REPO_URL);
283283
expect(cloneArgs).to.include(EXPECTED_CLONE_PATH);
284284
// No credentials in the URL itself
285285
expect(cloneArgsStr).to.not.include('stduser:stdtoken123@');
286286
expect(cloneArgsStr).to.not.include('Bearer');
287287
});
288288

289-
it('includes --recurse-submodules in the clone arguments', async () => {
290-
const client = CloudManagerClient.createFrom(createContext());
291-
292-
await client.clone(
293-
TEST_PROGRAM_ID,
294-
TEST_REPO_ID,
295-
{ imsOrgId: TEST_IMS_ORG_ID },
296-
);
297-
298-
const gitArgs = getGitArgs(execFileSyncStub.firstCall);
299-
expect(gitArgs).to.include('--recurse-submodules');
300-
});
301-
302289
it('throws when standard credentials not found for programId', async () => {
303290
const client = CloudManagerClient.createFrom(
304291
createContext({ CM_STANDARD_REPO_CREDENTIALS: TEST_STANDARD_CREDENTIALS }),
@@ -797,7 +784,7 @@ describe('CloudManagerClient', () => {
797784
const pushArgs = getGitArgs(execFileSyncStub.firstCall);
798785
const pushArgStr = getGitArgsStr(execFileSyncStub.firstCall);
799786
expect(pushArgStr).to.include('push');
800-
expect(pushArgStr).to.include('http.https://git.cloudmanager.adobe.com/myorg/.extraheader=Authorization: Basic c3RkdXNlcjpzdGR0b2tlbjEyMw==');
787+
expect(pushArgStr).to.include(`http.${TEST_STANDARD_REPO_URL}.extraheader=Authorization: Basic c3RkdXNlcjpzdGR0b2tlbjEyMw==`);
801788
expect(pushArgStr).to.include(TEST_STANDARD_REPO_URL);
802789
expect(pushArgStr).to.not.include('stduser:stdtoken123@');
803790
expect(pushArgStr).to.not.include('Bearer');
@@ -859,7 +846,7 @@ describe('CloudManagerClient', () => {
859846

860847
const pullArgStr = getGitArgsStr(execFileSyncStub.firstCall);
861848
expect(pullArgStr).to.include('pull');
862-
expect(pullArgStr).to.include('http.https://git.cloudmanager.adobe.com/myorg/.extraheader=Authorization: Basic c3RkdXNlcjpzdGR0b2tlbjEyMw==');
849+
expect(pullArgStr).to.include(`http.${TEST_STANDARD_REPO_URL}.extraheader=Authorization: Basic c3RkdXNlcjpzdGR0b2tlbjEyMw==`);
863850
expect(pullArgStr).to.include(TEST_STANDARD_REPO_URL);
864851
expect(pullArgStr).to.not.include('stduser:stdtoken123@');
865852
expect(pullArgStr).to.not.include('Bearer');

0 commit comments

Comments
 (0)