Skip to content

Conversation

@flipswitchingmonkey
Copy link
Contributor

No description provided.

@flipswitchingmonkey flipswitchingmonkey marked this pull request as ready for review April 18, 2023 16:44
@github-actions
Copy link
Contributor

Great PR! Please pay attention to the following items before merging:

Files matching packages/**:

  • If fixing bug, added test to cover scenario.
  • If addressing forum or Github issue, added link to description.

Files matching packages/**/*.ts:

  • Added unit tests to cover new or updated functionality.

Make sure to check off this list before asking for review.

@codecov
Copy link

codecov bot commented Apr 18, 2023

Codecov Report

Patch coverage: 55.96% and project coverage change: +0.17 🎉

Comparison is base (cd89489) 18.49% compared to head (d4aeac8) 18.67%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6006      +/-   ##
==========================================
+ Coverage   18.49%   18.67%   +0.17%     
==========================================
  Files        2563     2582      +19     
  Lines      116018   116479     +461     
  Branches    18118    18178      +60     
==========================================
+ Hits        21458    21751     +293     
- Misses      93930    94090     +160     
- Partials      630      638       +8     
Impacted Files Coverage Δ
packages/cli/src/License.ts 62.19% <0.00%> (ø)
packages/cli/src/Server.ts 0.00% <0.00%> (ø)
...ironment/versionControl/versionControlHelper.ee.ts 0.00% <0.00%> (ø)
packages/cli/src/sso/saml/saml.service.ee.ts 29.67% <0.00%> (ø)
...trol/middleware/versionControlEnabledMiddleware.ts 38.46% <38.46%> (ø)
...nments/versionControl/versionControl.service.ee.ts 66.66% <66.66%> (ø)
...nvironments/versionControl/versionControlHelper.ts 78.26% <78.26%> (ø)
...nts/versionControl/versionControl.controller.ee.ts 90.00% <90.00%> (ø)
...s/cli/src/environments/versionControl/constants.ts 100.00% <100.00%> (ø)
.../versionControl/types/versionControlPreferences.ts 100.00% <100.00%> (ø)

... and 31 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Apr 18, 2023
// set up the initial environment
if (isVersionControlLicensed()) {
try {
await Container.get(VersionControlService).init();
Copy link
Contributor

Choose a reason for hiding this comment

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

Correct me if I'm wrong, but you want o have the service being initialised in 2 different situations:

  1. When it's already set up, you just load or
  2. When setting up the feature (i.e. connecting a repo) then you init the service

I'm asking because conditional init could lead to issues like requiring a user restart after enabling a license for the feature to work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's true. Same for saml, which I will change as well.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

where: { key: VERSION_CONTROL_PREFERENCES_DB_KEY },
});
if (loadedPrefs) {
const prefs = jsonParse<VersionControlPreferences>(loadedPrefs.value);
Copy link
Contributor

Choose a reason for hiding this comment

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

To be 100% safe, you can add this in a try...catch block

loadedPrefs.value = settingsValue;
result = await Db.collections.Settings.save(loadedPrefs);
} else {
result = await Db.collections.Settings.save({
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not 100% sure, but considering the key is the primary key, I guess typeorm can correctly insert or update by simply calling save


export function isVersionControlLicensed() {
const license = Container.get(License);
return license.isVersionControlEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

This got a bit confusing, we're using licensed and enabled to clarify this. Maybe rename the License class method to isVersionControlLicensed and we use this naming convention, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. I used Enabled because it seems like that was the convention so far within the license class. Will rename it.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

2 similar comments
@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

};
}

async generateAndSaveKeyPair(keyType: 'ed25519' | 'rsa' = 'ed25519') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm guessing this function could check if a key already exists and throw an error in case it does - or at least in the future, check if there is a connected repo.

If a repo is connected, we want to prevent generating new keys at random WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is really just a temporary helper function for now - once it is used in the context of the actual saving of settings, it will be adjusted to check. Right now there is just nothing to check yet and I wanted to keeps this PR small and just contain the SSH key related functions.

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

1 similar comment
@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@flipswitchingmonkey flipswitchingmonkey merged commit 71ed1f4 into master Apr 19, 2023
@flipswitchingmonkey flipswitchingmonkey deleted the pay-380-add-ssh-key-packages branch April 19, 2023 15:46
MiloradFilipovic added a commit that referenced this pull request Apr 21, 2023
* master: (199 commits)
  feat(editor): Add disable template experiment (#5963)
  feat(core): Upgrade google-timezones-json to use the correct timezone for Sao Paulo (#6042)
  fix(Code Node): Update vm2 to address CVE-2023-30547 (#6039)
  docs: Add proprietary license text (no-changelog) (#6038)
  test(n8n Node): Unit tests (no-changelog)
  refactor: Accumulate `loadOptions` from all node versions to validate (no-changelog) (#6014)
  Update CHANGELOG.md
  feat: Add variables e2e tests (no-changelog) (#6027)
  fix(editor): Fix typo in SSO upgrade link (#6031)
  fix(editor): Add correct add variable button message when no variables created (no-changelog) (#6028)
  docs: Add api notice to credentials for google sheets nodes (no-changelog) (#6024)
  fix(Notion Node): Update credential test to not require user permissions (#6022)
  fix(editor): Clean up demo and template callouts from workflows page (#6023)
  fix(editor): Fix memory leak in Node Detail View by correctly unsubscribing from event buses (#6021)
  fix(editor): SettingsSidebar should disconnect from push when navigating away (#6025)
  fix(editor): Use fake timers in useDebounce.test.ts to make the test less flaky (no-changelog) (#6029)
  docs: Update the info URL for updating n8n (no-changelog) (#6018)
  fix(core): Improve domain and url matching for extractDomain and extractUrl (#6010)
  feat(core): Add SSH key generation (#6006)
  fix(editor): Update SSO upgrade link (#6016)
  ...

# Conflicts:
#	packages/editor-ui/src/components/WorkflowShareModal.ee.vue
#	packages/editor-ui/src/stores/workflows.ts
#	packages/editor-ui/src/views/NodeView.vue
sunilrr pushed a commit to fl-g6/qp-n8n that referenced this pull request Apr 24, 2023
* basic prefs and ssh key generation

* review change

* cleanup save

* lint fix
@janober
Copy link
Member

janober commented May 2, 2023

Got released with [email protected]

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

Labels

core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants