github.com/web-platform-tests/wpt.fyi@v0.0.0-20240530210107-70cf978996f1/scripts/README.md (about)

     1  ## Build Test History
     2  This script exists as a cloud function in GCP and will need to be redeployed
     3  after subsequent changes to the file. The `BUCKET_NAME`, `PROJECT_NAME`,
     4  and `RUNS_API_URL` constants will need to be changed based on which environment
     5  is being redeployed.
     6  
     7  ### Staging:
     8  ```py
     9  BUCKET_NAME = 'wpt-recent-statuses-staging'
    10  PROJECT_NAME = 'wptdashboard-staging'
    11  RUNS_API_URL = 'https://staging.wpt.fyi/api/runs'
    12  ```
    13  
    14  ### Production:
    15  ```py
    16  BUCKET_NAME = 'wpt-recent-statuses'
    17  PROJECT_NAME = 'wptdashboard'
    18  RUNS_API_URL = 'https://wpt.fyi/api/runs'
    19  ```
    20  
    21  
    22  ### Regenerating Test History Data
    23  
    24  If, for some reason, the test history data needs to be regenerated, it is
    25  required that all TestHistoryEntry entities first be deleted from Datastore
    26  beforehand. A user with GCP Datastore write access can invoke the following
    27  command.
    28  
    29  **NOTE**: The entire process of deletion and regeneration of entities
    30  will take a considerable amount of time (hours).
    31  
    32  ```sh
    33  python scripts/build_test_history.py -v --delete-history-entities
    34  ```
    35  
    36  Additionally, the `Date` property of the
    37  `MostRecentHistoryProcessed` entity in Datastore must be changed to the date
    38  at which the first test history should be processed. The date can be provided
    39  in the CLI in ISO format.
    40  
    41  ```sh
    42  # Set history processing start date to the beginning of 2023
    43  python scripts/build_test_history.py --set-history-start-date=2023-01-01T00:00:00.000Z
    44  ```
    45  
    46  Once all entities have been deleted, new JSON files will need to be generated
    47  that are used to track the most recent test statuses that are compared against
    48  new tests to detect deltas.
    49  
    50  **NOTE**: This command will take significant time to process the first
    51  entities as well, and the command must finish the invocation. If the command
    52  is stopped early, entities will again need to be deleted and this command
    53  will need to be re-invoked.
    54  
    55  ```sh
    56  python scripts/build_test_history.py --generate-new-statuses-json
    57  ```