Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPD-621 Updates for CI #5

Merged
merged 10 commits into from
Mar 13, 2024
Merged

Conversation

nicolewhite
Copy link
Contributor

@nicolewhite nicolewhite commented Feb 20, 2024

ended up not using the context from @actions/github for this, didn't have a lot of stuff i needed so was easier to do it manually (most of this is copied from javascript-sdk)

will follow up w/ getting pull request info when it's a push event via https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#list-pull-requests-associated-with-a-commit. currently we'll only get pull request info on pull_request events

see https://github.com/autoblocksai/cli/actions/runs/7978053008/job/21782347111 for the context for this branch for an example:

Screenshot 2024-02-20 at 1 44 43 PM

@nicolewhite nicolewhite requested a review from a team as a code owner February 20, 2024 18:45
Copy link

linear bot commented Feb 20, 2024

adamnolte
adamnolte previously approved these changes Feb 22, 2024
@nicolewhite
Copy link
Contributor Author

gonna put this back in draft mode, gonna leave it open while i work on the other pieces

@nicolewhite nicolewhite marked this pull request as draft February 22, 2024 19:07
@nicolewhite nicolewhite force-pushed the nicole/epd-621-send-git-metadata-from-cli branch 4 times, most recently from f07840b to 1a3481a Compare March 5, 2024 01:19
Copy link

github-actions bot commented Mar 5, 2024

hello

@nicolewhite nicolewhite force-pushed the nicole/epd-621-send-git-metadata-from-cli branch 3 times, most recently from c8e389d to d167a04 Compare March 7, 2024 00:06
@nicolewhite nicolewhite changed the title EPD-621 Send git metadata EPD-621 Updates for CI Mar 7, 2024
@nicolewhite nicolewhite force-pushed the nicole/epd-621-send-git-metadata-from-cli branch from d167a04 to d29b6c9 Compare March 7, 2024 00:09
.github/workflows/e2e.yml Outdated Show resolved Hide resolved
Comment on lines +65 to +69
function pullRequestFromEvent(event: unknown): PullRequest | null {
const parsed = zPullRequestSchema.safeParse(event);
if (parsed.success) {
return parsed.data;
}
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

should we log the error here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no because failures are expected for events that aren't pull request events (like push and schedule)

@nicolewhite nicolewhite force-pushed the nicole/epd-621-send-git-metadata-from-cli branch 2 times, most recently from b3fb261 to c67382e Compare March 7, 2024 16:01
@nicolewhite nicolewhite force-pushed the nicole/epd-621-send-git-metadata-from-cli branch 3 times, most recently from 99be702 to 93f822d Compare March 7, 2024 21:35
@nicolewhite nicolewhite force-pushed the nicole/epd-621-send-git-metadata-from-cli branch from 93f822d to 20e5096 Compare March 7, 2024 23:10
@nicolewhite nicolewhite marked this pull request as ready for review March 12, 2024 16:46
}
if (!this.ciContext) {
try {
this.ciContext = await makeCIContext();
Copy link

@dmorton2297 dmorton2297 Mar 12, 2024

Choose a reason for hiding this comment

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

Was a bit confused on first read through about what this was doing and how it wasn't a function naming conflicts - but I see this works because the maxCIContext you are defining here is a instance member and what you are calling on line 114 is an import.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah I see, any rename suggestions are welcome 😁

Comment on lines +141 to +158
gitProvider: ciContext.gitProvider,
repositoryExternalId: ciContext.repoId,
repositoryName: ciContext.repoName,
repositoryHtmlUrl: ciContext.repoHtmlUrl,
branchExternalId: ciContext.branchId,
branchName: ciContext.branchName,
isDefaultBranch: ciContext.branchName === ciContext.defaultBranchName,
ciProvider: ciContext.ciProvider,
buildHtmlUrl: ciContext.buildHtmlUrl,
commitSha: ciContext.commitSha,
commitMessage: ciContext.commitMessage,
commitCommitterName: ciContext.commitCommitterName,
commitCommitterEmail: ciContext.commitCommitterEmail,
commitAuthorName: ciContext.commitAuthorName,
commitAuthorEmail: ciContext.commitAuthorEmail,
commitCommittedDate: ciContext.commitCommittedDate,
pullRequestNumber: ciContext.pullRequestNumber,
pullRequestTitle: ciContext.pullRequestTitle,

Choose a reason for hiding this comment

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

Do we get strong typing for what this endpoint 'builds' expects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No :( for that we'd need to publish types from our rest API via an open API spec or something

@@ -102,39 +85,104 @@ class RunManager {
}

private async post<T>(path: string, body?: unknown): Promise<T> {
const resp = await fetch(`https://api.autoblocks.ai${path}`, {
const subpath = this.isCI ? '/testing/ci' : '/testing/local';
const resp = await fetch(`https://api.autoblocks.ai${subpath}${path}`, {

Choose a reason for hiding this comment

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

Should we be storing this domain in a constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure I'll update

@nicolewhite nicolewhite requested a review from dmorton2297 March 13, 2024 03:26
@nicolewhite nicolewhite merged commit b398b88 into main Mar 13, 2024
6 checks passed
@nicolewhite nicolewhite deleted the nicole/epd-621-send-git-metadata-from-cli branch March 13, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants