Skip to content

Conversation

@brendankenny
Copy link
Contributor

Use the github API to fetch the latest commit message from the Chromium mirror.

There's not really any way to get commit info from a remote git repo without cloning, and the Github API seems more likely to be stable long-term than any feed on googlesource.com.

We may have to update the branch name to main in the github API url when the chromium/src migration occurs: https://groups.google.com/a/chromium.org/g/infra-announce/c/-uMWoep7RNA

@brendankenny brendankenny requested a review from a team as a code owner March 11, 2021 02:10
@brendankenny brendankenny requested review from connorjclark and removed request for a team March 11, 2021 02:10
@google-cla google-cla bot added the cla: yes label Mar 11, 2021
const commitMessage = JSON.parse(latestCommit).commit.message;
const commitPosition = /Cr-Commit-Position: refs\/heads\/master@\{#([0-9]+)\}/.exec(commitMessage)[1];

return commitPosition;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could do something like return commitPosition - commitPosition % 1000; or something if we still want this to only update periodically

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could do something like return commitPosition - commitPosition % 1000; or something if we still want this to only update periodically

This seems unnecessary for now unless anyone really thinks they want it. This is often a few seconds even with a download and unzip

Copy link
Collaborator

@connorjclark connorjclark Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is often a few seconds ...

Not if you're on bad wifi like I currently am :)

what's the ~time delta for 1000 revisions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the ~time delta for 1000 revisions?

there's about 420 revisions per weekday.

🕶️

const PLATFORM = getPlatform();
const LH_ROOT = `${__dirname}/../..`;
const CACHE_PATH = path.resolve(LH_ROOT, '.tmp', 'chromium-web-tests', 'content-shells');
const COMMIT_POSITION_UPDATE_PERIOD = 420;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants