Skip to content

Commit ff3df53

Browse files
Merge pull request #41 from kata-containers/sprt/fix-502
script: Attempt to fix 502 errors
2 parents b086799 + b96d6b2 commit ff3df53

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,13 @@ Follow these steps to set up the development environment for the Kata Containers
7676

7777
Create the .env file:
7878
```bash
79-
NODE_ENV=development
8079
TOKEN=<GITHUB_PAT_OR_OTHER_VALID_TOKEN>
8180
```
8281

8382
Create the folder /localData. Then, run:
8483

8584
```bash
86-
node scripts/fetch-ci-nightly-data.js > localData/job_stats.json
85+
NODE_ENV=development node scripts/fetch-ci-nightly-data.js > localData/job_stats.json
8786
npm run dev # On Windows, run `npm run win-dev` instead.
8887
```
8988
The app will be available at [http://localhost:3000](http://localhost:3000).
@@ -109,4 +108,4 @@ env:
109108
NEXT_PUBLIC_BASE_PATH: ${{ vars.NEXT_PUBLIC_BASE_PATH }}
110109
```
111110
If the variable is undefined, it will use "" for the basePath and assume the site is being served at root.
112-
This makes it easier for people to fork the repo and deploy with GitHub pages such that they can have a preview for their PR.
111+
This makes it easier for people to fork the repo and deploy with GitHub pages such that they can have a preview for their PR.

scripts/fetch-ci-nightly-data.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@
1111
// entry is information about a job and how it has performed over the last
1212
// few runs (e.g. pass or fail).
1313
//
14-
// To run locally:
15-
// node --require dotenv/config scripts/fetch-ci-nightly-data.js
16-
//
17-
// .env file with:
18-
// NODE_ENV=development
19-
// TOKEN=token <GITHUB_PAT_OR_OTHER_VALID_TOKEN>
14+
const dotenv = require("dotenv");
2015

2116
// Set token used for making Authorized GitHub API calls.
2217
// In dev, set by .env file; in prod, set by GitHub Secret.
2318
if(process.env.NODE_ENV === "development"){
24-
require('dotenv').config();
19+
dotenv.config();
2520
}
2621
const TOKEN = process.env.TOKEN;
2722

@@ -42,7 +37,7 @@ const main_branch_url = "https://api.github.com/repos/" +
4237
"kata-containers/kata-containers/branches/main";
4338

4439
// The number of jobs to fetch from the github API on each paged request.
45-
const jobs_per_request = 100;
40+
const jobs_per_request = 50;
4641

4742
// Count of the number of fetches.
4843
let fetch_count = 0;
@@ -92,7 +87,7 @@ function get_job_data(run) {
9287
});
9388

9489
if (!response.ok) {
95-
throw new Error(`Failed to fetch jobs: ${response.status}: ` +
90+
throw new Error(`Failed to fetch jobs from ${jobs_url}: ${response.status}: ` +
9691
`${response.statusText}`);
9792
}
9893
const json = await response.json();

0 commit comments

Comments
 (0)