Skip to content
This repository has been archived by the owner on Mar 18, 2024. It is now read-only.

feat(events): new event stream for build command #1446

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Rocko1204
Copy link
Contributor

@Rocko1204 Rocko1204 commented Dec 12, 2023

Summary generated by Reviewpad on 12 Dec 23 05:41 UTC

This pull request includes changes to multiple files. Here is a summary of the changes:

  1. build.ts in the orchestrator directory:

    • Added a new property jobId to the Build class.
    • Other existing properties remain unchanged.
  2. CreateDataPackageImpl.ts:

    • Added import statement for BuildStreamService from '../../eventStream/build'.
    • Added calls to BuildStreamService.sendPackageError() with error messages.
  3. build.json:

    • Added a new property jobIdFlagDescription.
  4. CreateDiffPackageImpl.ts:

    • Imported BuildStreamService from the build event stream.
    • Used BuildStreamService to send a package error message and throw an error.
  5. PackageDependencyDisplayer.ts:

    • Added an import statement for BuildStreamService.
    • Made changes to the printPackageDependencies method.
  6. CreatePackage.ts:

    • Added an import statement for BuildStreamService.
    • Added calls to BuildStreamService.buildPackageStatus() and BuildStreamService.sendPackageError().
  7. BuildImpl.ts:

    • Added import statement for BuildStreamService.
    • Made various changes to the BuildImpl class.
  8. hooks.ts:

    • Added a new file with code for logging events and sending webhooks.
  9. Other files:

    • Contains various changes related to types, interfaces, and imports.

Please review these changes and let me know if you have any questions.

Hi @azlam-abdulsalam

This is the pull request for the new event stream. (build and release command)

There are 2 options:

  1. Send the events to (a new object on) devhub

To activate this method you need to first install the package 04t2o000001B1kiAAC. This package contains a new object called SfPowerscriptsEvent__c and a permission set to access the new fields. And it has a scheduled apex class where you can delete old records from the event object. (default value older then 15 days)

Then you have to set the new (optional) flag --jobid (-j) to send the events to the devhub.

  1. Send the events as webhook

To activate this method you need to set the ENV variables

EVENT_STREAM_WEBHOOK_URL
EVENT_STREAM_WEBHOOK_TOKEN

optional(NODE_TLS_REJECT_UNAUTHORIZED=0) (required when you have no ssl certificates for the hook)

At the end we create always a new json in the .sfpowerscripts folder with the name ,,eventStreamBuild.json'' OR ,,eventStreamRelease.json''.
This file has all infos from part1/2 as well.

Checklist

All items have to be completed before a PR is merged

  • Adhere to Contribution Guidelines
  • Updates to Decision Records considered?
  • Updates to documentation at DX@Scale Guide considered?
  • Tested changes?
  • Unit Tests new and existing passing locally?

Copy link

reviewpad bot commented Dec 12, 2023

Reviewpad Report

⚠️ Warnings

  • Please link an issue to the pull request

Copy link

codecov bot commented Dec 12, 2023

Codecov Report

Attention: 158 lines in your changes are missing coverage. Please review.

Comparison is base (94042a5) 46.83% compared to head (6b1dd48) 45.04%.

Files Patch % Lines
packages/core/src/eventStream/build.ts 3.36% 114 Missing and 1 partial ⚠️
packages/core/src/eventStream/hooks.ts 14.28% 30 Missing ⚠️
.../core/src/package/packageCreators/CreatePackage.ts 11.11% 8 Missing ⚠️
...c/package/packageCreators/CreateDiffPackageImpl.ts 25.00% 3 Missing ⚠️
...c/package/packageCreators/CreateDataPackageImpl.ts 33.33% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1446      +/-   ##
==========================================
- Coverage   46.83%   45.04%   -1.79%     
==========================================
  Files          70       73       +3     
  Lines        2667     2855     +188     
  Branches      300      315      +15     
==========================================
+ Hits         1249     1286      +37     
- Misses       1416     1539     +123     
- Partials        2       30      +28     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@azlam-abdulsalam azlam-abdulsalam marked this pull request as draft December 12, 2023 06:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
large Pull request is large waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants