Skip to content

Commit

Permalink
VACMS-15883: Don't log every file download message. (#1767)
Browse files Browse the repository at this point in the history
* VACMS-15883: Don't log every file download message.

* Turn on DEBUG.

* Tweak.
  • Loading branch information
ndouglas authored Oct 30, 2023
1 parent 2206354 commit 51b6a6d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/content-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ jobs:
ARCHIVE_END_TIME: ${{ steps.export-archive-end-time.outputs.ARCHIVE_END_TIME }}
env:
CHROMEDRIVER_FILEPATH: /usr/local/share/chrome_driver/chromedriver

steps:
- name: Export build start time
id: export-build-start-time
Expand Down Expand Up @@ -209,6 +208,7 @@ jobs:
timeout-minutes: 40
env:
NODE_ENV: production
DEBUG: ${{ secrets.ACTIONS_RUNNER_DEBUG }}

- name: Export content build end time
id: export-content-build-end
Expand Down Expand Up @@ -534,7 +534,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
with:
Expand Down Expand Up @@ -594,7 +594,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@e1e17a757e536f70e52b5a12b2e8d1d1c60e04ef # v2.0.0
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ jobs:
run: yarn build --buildtype=${{ matrix.buildtype }} --asset-source=local --drupal-address=${{ env.DRUPAL_ADDRESS }} --drupal-user=${{ env.DRUPAL_USERNAME }} --drupal-password="${{ env.DRUPAL_PASSWORD }}" --pull-drupal --drupal-max-parallel-requests=15 --no-drupal-proxy --verbose
env:
NODE_ENV: production
DEBUG: ${{ secrets.ACTIONS_RUNNER_DEBUG }}

- name: Check broken links
id: get-broken-link-info
Expand Down
10 changes: 7 additions & 3 deletions src/site/stages/build/plugins/download-drupal-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async function downloadFile(
downloadResults,
everythingDownloaded,
downloaderIndex,
verbose = false,
) {
const asset = assetsToDownload.shift();
if (!asset) {
Expand All @@ -36,7 +37,7 @@ async function downloadFile(
// eslint-disable-next-line no-plusplus
while (retries--) {
try {
if (global.verbose) {
if (verbose) {
const startDate = new Date().toISOString();
log(
`${startDate}: index ${downloaderIndex}: Starting download ${asset.src}`,
Expand Down Expand Up @@ -82,7 +83,7 @@ async function downloadFile(
// eslint-disable-next-line no-plusplus
downloadResults.downloadCount++;

if (global.verbose) {
if (verbose) {
const endDate = new Date().toISOString();
log(
`${endDate}: index ${downloaderIndex}: Finished downloading ${asset.src}`,
Expand All @@ -96,7 +97,7 @@ async function downloadFile(
// Should get caught by the broken link checker, though
// eslint-disable-next-line no-plusplus
downloadResults.errorCount++;
if (global.verbose) {
if (verbose) {
log(`File download failed: ${response.statusText}: ${asset.src}`);
} else {
process.stdout.write(chalk.red('.'));
Expand All @@ -120,6 +121,7 @@ async function downloadFile(
downloadResults,
everythingDownloaded,
downloaderIndex,
verbose,
);
} else {
// Some downloads must still be in progress, but there are no files left to begin downloading
Expand Down Expand Up @@ -151,6 +153,7 @@ function downloadDrupalAssets(options) {
};

const downloadersCount = 5;
const verbose = global.verbose && process.env.DEBUG === 'true';

await new Promise(everythingDownloaded => {
// eslint-disable-next-line no-plusplus
Expand All @@ -163,6 +166,7 @@ function downloadDrupalAssets(options) {
downloadResults,
everythingDownloaded,
i,
verbose,
);
}
});
Expand Down

0 comments on commit 51b6a6d

Please sign in to comment.