From ad54a59dc82b699c8db4c5e7a13648a8cd77ebaa Mon Sep 17 00:00:00 2001 From: Sonja Popovic Date: Wed, 26 Feb 2025 12:46:52 +0100 Subject: [PATCH 1/3] MWPW-167901-follow-up:remove hlx4 references from code --- eds/scripts/utils.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/eds/scripts/utils.js b/eds/scripts/utils.js index b74d076..ae51a11 100644 --- a/eds/scripts/utils.js +++ b/eds/scripts/utils.js @@ -36,8 +36,6 @@ export const [setLibs, getLibs] = (() => { })(); export const prodHosts = [ - 'main--dx-partners--adobecom.hlx.page', - 'main--dx-partners--adobecom.hlx.live', 'main--dx-partners--adobecom.aem.page', 'main--dx-partners--adobecom.aem.live', 'partners.adobe.com', From 762acf6383a05dd517cf5ba8836082ee8d1cbec0 Mon Sep 17 00:00:00 2001 From: Sonja Popovic Date: Thu, 27 Feb 2025 10:46:46 +0100 Subject: [PATCH 2/3] logs for debug --- nala/libs/baseurl.js | 4 ++++ nala/utils/global.setup.js | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/nala/libs/baseurl.js b/nala/libs/baseurl.js index e7f3811..e2c5940 100644 --- a/nala/libs/baseurl.js +++ b/nala/libs/baseurl.js @@ -2,7 +2,11 @@ import pkg from 'axios'; const { head } = pkg; export async function isBranchURLValid(url) { try { + console.log('before req, url:', url); const response = await head(url); + console.log('response', response); + console.log('response status', response.status); + console.log('response stringify', JSON.stringify(response)); if (response.status === 200) { console.info(`\nURL (${url}) returned a 200 status code. It is valid.`); return true; diff --git a/nala/utils/global.setup.js b/nala/utils/global.setup.js index c858efe..f242152 100644 --- a/nala/utils/global.setup.js +++ b/nala/utils/global.setup.js @@ -8,6 +8,7 @@ const STAGE_URL = 'https://partners.stage.adobe.com'; const LOCALHOST_URL = 'http://localhost:3000'; async function getGitHubPRBranchLiveUrl() { + console.log('in getgithubprbranchlive url'); // get the pr number const prReference = process.env.GITHUB_REF; const prNumber = prReference.split('/')[2]; @@ -25,10 +26,10 @@ async function getGitHubPRBranchLiveUrl() { // Get the org and repo from the environment variables const prFromOrg = process.env.prOrg; const prFromRepoName = process.env.prRepo; - const prBranchLiveUrl = `https://${prBranch}--${prFromRepoName}--${prFromOrg}.aem.live`; - +console.log('pr branch live url', prBranchLiveUrl); try { + console.log('in first try'); if (await isBranchURLValid(prBranchLiveUrl)) { process.env.PR_BRANCH_LIVE_URL = prBranchLiveUrl; } @@ -49,6 +50,7 @@ async function getGitHubPRBranchLiveUrl() { } async function getGitHubMiloLibsBranchLiveUrl() { + console.log('in get github milo libs branch live url'); const repository = process.env.GITHUB_REPOSITORY; let prBranchLiveUrl; @@ -58,6 +60,7 @@ async function getGitHubMiloLibsBranchLiveUrl() { miloLibs = process.env.MILO_LIBS; try { + console.log('in try before is branch url valid'); if (await isBranchURLValid(prBranchLiveUrl)) { process.env.PR_BRANCH_LIVE_URL = prBranchLiveUrl; } @@ -65,6 +68,7 @@ async function getGitHubMiloLibsBranchLiveUrl() { console.info('PR Branch live url : ', prBranchLiveUrl); console.info('Milo Libs : ', miloLibs); } catch (err) { + console.log('in catch'); console.error(`Error => Error in setting PR Branch test URL : ${prBranchLiveUrl}`); console.info(`Note: PR branch test url ${prBranchLiveUrl} is not valid, Exiting test execution.`); process.exit(1); From fea4a8138603d5220f98dbd0c510b94fcc0ef569 Mon Sep 17 00:00:00 2001 From: Sonja Popovic Date: Thu, 27 Feb 2025 11:59:51 +0100 Subject: [PATCH 3/3] MWPW-167901- add authorization for branch url check on github test run, since aem.live is protected --- nala/libs/baseurl.js | 9 +++------ nala/utils/global.setup.js | 8 +------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/nala/libs/baseurl.js b/nala/libs/baseurl.js index e2c5940..fd6c41d 100644 --- a/nala/libs/baseurl.js +++ b/nala/libs/baseurl.js @@ -1,12 +1,9 @@ import pkg from 'axios'; const { head } = pkg; -export async function isBranchURLValid(url) { +export async function isBranchURLValid(url, includeAuthorization = false) { try { - console.log('before req, url:', url); - const response = await head(url); - console.log('response', response); - console.log('response status', response.status); - console.log('response stringify', JSON.stringify(response)); + const headers = includeAuthorization ? { Authorization: `token ${process.env.MILO_AEM_API_KEY}` } : {}; + const response = await head(url, { headers }); if (response.status === 200) { console.info(`\nURL (${url}) returned a 200 status code. It is valid.`); return true; diff --git a/nala/utils/global.setup.js b/nala/utils/global.setup.js index f242152..66529e0 100644 --- a/nala/utils/global.setup.js +++ b/nala/utils/global.setup.js @@ -8,7 +8,6 @@ const STAGE_URL = 'https://partners.stage.adobe.com'; const LOCALHOST_URL = 'http://localhost:3000'; async function getGitHubPRBranchLiveUrl() { - console.log('in getgithubprbranchlive url'); // get the pr number const prReference = process.env.GITHUB_REF; const prNumber = prReference.split('/')[2]; @@ -27,10 +26,8 @@ async function getGitHubPRBranchLiveUrl() { const prFromOrg = process.env.prOrg; const prFromRepoName = process.env.prRepo; const prBranchLiveUrl = `https://${prBranch}--${prFromRepoName}--${prFromOrg}.aem.live`; -console.log('pr branch live url', prBranchLiveUrl); try { - console.log('in first try'); - if (await isBranchURLValid(prBranchLiveUrl)) { + if (await isBranchURLValid(prBranchLiveUrl, true)) { process.env.PR_BRANCH_LIVE_URL = prBranchLiveUrl; } console.info('PR Repository : ', repository); @@ -50,7 +47,6 @@ console.log('pr branch live url', prBranchLiveUrl); } async function getGitHubMiloLibsBranchLiveUrl() { - console.log('in get github milo libs branch live url'); const repository = process.env.GITHUB_REPOSITORY; let prBranchLiveUrl; @@ -60,7 +56,6 @@ async function getGitHubMiloLibsBranchLiveUrl() { miloLibs = process.env.MILO_LIBS; try { - console.log('in try before is branch url valid'); if (await isBranchURLValid(prBranchLiveUrl)) { process.env.PR_BRANCH_LIVE_URL = prBranchLiveUrl; } @@ -68,7 +63,6 @@ async function getGitHubMiloLibsBranchLiveUrl() { console.info('PR Branch live url : ', prBranchLiveUrl); console.info('Milo Libs : ', miloLibs); } catch (err) { - console.log('in catch'); console.error(`Error => Error in setting PR Branch test URL : ${prBranchLiveUrl}`); console.info(`Note: PR branch test url ${prBranchLiveUrl} is not valid, Exiting test execution.`); process.exit(1);