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

feat(yaml): add yaml as valid file format #1

Open
wants to merge 33 commits into
base: main-enterprise
Choose a base branch
from

Conversation

dabcoder
Copy link
Owner

To keep discussing github#700

@dabcoder dabcoder marked this pull request as ready for review November 26, 2024 09:52
@anderssonjohan
Copy link

@dabcoder Nice! Can you also update the README and remove the comment about .yaml being ignored? 🙏

@dabcoder
Copy link
Owner Author

dabcoder commented Dec 19, 2024

Thanks for the feedback @anderssonjohan. I can certainly update the README.
Test wise, as far as I can see the getRepoConfigs method does not return anything that can be unit tested (unless I am mistaken), and I am also unsure how to test the childPluginsList method (test the content of the childPlugins array?). Let me know if you have any pointers in that area.
EDIT: getRepoConfigs does return an Object.

Bumps [azure/aks-set-context](https://github.com/azure/aks-set-context) from 3 to 4.
- [Release notes](https://github.com/azure/aks-set-context/releases)
- [Changelog](https://github.com/Azure/aks-set-context/blob/main/CHANGELOG.md)
- [Commits](Azure/aks-set-context@v3...v4)

---
updated-dependencies:
- dependency-name: azure/aks-set-context
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@anderssonjohan
Copy link

@dabcoder If I were you I would start by isolating the code under test into a helper function and test that. Then you only have to test the changed logic and not everything around it.

  1. Extract function, something like:
function getRepoOverrideConfig(repoConfigs, repository) {
  return repoConfigs[`${repository.repo}.yml`];
}
  1. Write failing test
const repoConfigs = { "repository.yaml": "yaml file was picked" };
const repo = { repo: "repository" };

expect(getRepoOverrideConfig(repoConfigs, repo).toEqual("yaml file was picked");
  1. Update the helper with your suggested changes
  2. Write a test for current behavior
const repoConfigs = { "repository.yml": "yml file was picked" };
const repo = { repo: "repository" };

expect(getRepoOverrideConfig(repoConfigs, repo).toEqual("yml file was picked");
  1. Document the precedence with a test
const repoConfigs = { "repository.yaml": "yaml file was picked", "repository.yml": "yml file was picked" };
const repo = { repo: "repository" };

expect(getRepoOverrideConfig(repoConfigs, repo).toEqual("yml file was picked");

dependabot bot and others added 10 commits December 19, 2024 12:24
Bumps [azure/k8s-create-secret](https://github.com/azure/k8s-create-secret) from 4 to 5.
- [Release notes](https://github.com/azure/k8s-create-secret/releases)
- [Changelog](https://github.com/Azure/k8s-create-secret/blob/main/CHANGELOG.md)
- [Commits](Azure/k8s-create-secret@v4...v5)

---
updated-dependencies:
- dependency-name: azure/k8s-create-secret
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [azure/login](https://github.com/azure/login) from 1 to 2.
- [Release notes](https://github.com/azure/login/releases)
- [Commits](Azure/login@v1...v2)

---
updated-dependencies:
- dependency-name: azure/login
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add glob matching to include/exclude in diffable

* Update the README

---------

Co-authored-by: Adrian Veliz <[email protected]>
Bumps [Azure/k8s-deploy](https://github.com/azure/k8s-deploy) from 4.10 to 5.
- [Release notes](https://github.com/azure/k8s-deploy/releases)
- [Changelog](https://github.com/Azure/k8s-deploy/blob/main/CHANGELOG.md)
- [Commits](Azure/k8s-deploy@v4.10...v5)

---
updated-dependencies:
- dependency-name: Azure/k8s-deploy
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
@dabcoder
Copy link
Owner Author

● Settings Tests › getRepoOverrideConfig › repository defined in a file using the .yaml extension › Picks up a repository defined in file using the .yaml extension

    TypeError: Cannot read properties of undefined (reading 'repository.yml')

      415 |
      416 |   getRepoOverrideConfig(repoName) {
    > 417 |     return this.repoConfigs[`${repoName}.yml`] || this.repoConfigs[`${repoName}.yaml`] || {}
          |                            ^
      418 |   }
      419 |
      420 |   validate (section, baseConfig, overrideConfig) {

      at Settings.getRepoOverrideConfig (lib/settings.js:417:28)
      at Object.getRepoOverrideConfig (test/unit/lib/settings.test.js:156:37)

  ● Settings Tests › getRepoOverrideConfig › repository defined in a file using the .yml extension › Picks up a repository defined in file using the .yml extension

    TypeError: Cannot read properties of undefined (reading 'repository.yml')

      415 |
      416 |   getRepoOverrideConfig(repoName) {
    > 417 |     return this.repoConfigs[`${repoName}.yml`] || this.repoConfigs[`${repoName}.yaml`] || {}
          |                            ^
      418 |   }
      419 |
      420 |   validate (section, baseConfig, overrideConfig) {

      at Settings.getRepoOverrideConfig (lib/settings.js:417:28)
      at Object.getRepoOverrideConfig (test/unit/lib/settings.test.js:175:37)

@anderssonjohan
Copy link

@dabcoder You're passing the repoConfigs as the config object but they are not read from the config. They are loaded here:

this.repoConfigs = await this.getRepoConfigs(repo)

You can probably fix it by:

settings = createSettings({}).repoConfigs = ...

dependabot bot and others added 10 commits December 21, 2024 16:54
Bumps [@travi/any](https://github.com/travi/any) from 2.1.10 to 3.1.2.
- [Release notes](https://github.com/travi/any/releases)
- [Commits](travi/any@v2.1.10...v3.1.2)

---
updated-dependencies:
- dependency-name: "@travi/any"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
Bumps [@eslint/eslintrc](https://github.com/eslint/eslintrc) from 2.1.4 to 3.1.0.
- [Release notes](https://github.com/eslint/eslintrc/releases)
- [Changelog](https://github.com/eslint/eslintrc/blob/main/CHANGELOG.md)
- [Commits](eslint/eslintrc@v2.1.4...v3.1.0)

---
updated-dependencies:
- dependency-name: "@eslint/eslintrc"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
Bumps [eslint-plugin-promise](https://github.com/eslint-community/eslint-plugin-promise) from 6.1.1 to 6.6.0.
- [Release notes](https://github.com/eslint-community/eslint-plugin-promise/releases)
- [Changelog](https://github.com/eslint-community/eslint-plugin-promise/blob/main/CHANGELOG.md)
- [Commits](eslint-community/eslint-plugin-promise@v6.1.1...v6.6.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-promise
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
* add initial code for preventing multiple suborg config for repos

* detect conflict even when a single suborg config is changed

* remove duplicate errors

* dont add nulls and undefined to results

* Update ESLint config for browser and standard
…b#686)

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* feat: add JSON schema doc for settings

* add script to generate dereferenced schema

---------

Co-authored-by: Jonathan Morley <[email protected]>
…erability (github#720)

* Update vulnerable dependency

Signed-off-by: Brett Logan <[email protected]>

* Pin non-immutable Actions in deploy-k8s

Signed-off-by: Brett Logan <[email protected]>

* Pin non-immutable Actions in rc-release

Signed-off-by: Brett Logan <[email protected]>

* Pin non-immutable Actions in create-pre-release

Signed-off-by: Brett Logan <[email protected]>

* Pin non-immutable Actions in create-release

Signed-off-by: Brett Logan <[email protected]>

* Remove dead reusable workflow

Signed-off-by: Brett Logan <[email protected]>

* Add workflow permissions

Signed-off-by: Brett Logan <[email protected]>

---------

Signed-off-by: Brett Logan <[email protected]>
* fix: update eslint ecmaVersion to 13

Linting failed in deploymentConfig.js due to the static fields. Eslint supports this from ecmaVersion 13.

* reapply eslint to tests, still supporting jest

The full test suite failed because it tried to lint the tests, while the running linter did not do the same. Enabling linting gave errors due to jest having undef stuff, but overriding these files for jest env keeps the linting without these errors.

* removed unused vars in index.js

Removed to stop having eslint errors.

* fix eslint errors, except environments

Updated with `npx standard --fix`.

Skipping environments.js and environments.test.js as they had a lot of
errors, handling those in a separate commit.

* fix eslint errors for environments

Updated with `npx standard --fix`.

* fix eslint casing errors for environments

This was done manually as no autofix was available.

* Enteprise sourcetype rulesets should not be handled at the org level

* Securtiy manager teams should not be handled as other teams

---------

Co-authored-by: Torgeir S <[email protected]>
* Bump probot from 12.3.4 to 13.3.8

Bumps [probot](https://github.com/probot/probot) from 12.3.4 to 13.3.8.
- [Release notes](https://github.com/probot/probot/releases)
- [Commits](probot/probot@v12.3.4...v13.3.8)

---
updated-dependencies:
- dependency-name: probot
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* resolve conflicts

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
Co-authored-by: Åkesson Karl-Petter <[email protected]>
Co-authored-by: Yadhav Jayaraman <[email protected]>
PendaGTP and others added 2 commits January 2, 2025 18:35
The full-sync script now properly creates new repositories defined in the
configuration instead of only updating existing ones.
This fixes the different behavior between webhook-based sync and full-sync runs.

Co-authored-by: Yadhav Jayaraman <[email protected]>
@dabcoder
Copy link
Owner Author

dabcoder commented Jan 6, 2025

@anderssonjohan, thanks, appreciate the feedback. I think I got it to work with 33458eb.

dabcoder and others added 7 commits January 7, 2025 09:58
This boolean was reversed when filtering existing variables,
so it consistently sent a POST request to existing vars.

Signed-off-by: Kyle Harding <[email protected]>
Bumps [nock](https://github.com/nock/nock) from 13.5.4 to 13.5.6.
- [Release notes](https://github.com/nock/nock/releases)
- [Changelog](https://github.com/nock/nock/blob/main/CHANGELOG.md)
- [Commits](nock/nock@v13.5.4...v13.5.6)

---
updated-dependencies:
- dependency-name: nock
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
Bumps [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import) from 2.29.1 to 2.31.0.
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](import-js/eslint-plugin-import@v2.29.1...v2.31.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
Bumps [standard](https://github.com/standard/standard) from 17.1.0 to 17.1.2.
- [Release notes](https://github.com/standard/standard/releases)
- [Changelog](https://github.com/standard/standard/blob/master/CHANGELOG.md)
- [Commits](standard/standard@v17.1.0...v17.1.2)

---
updated-dependencies:
- dependency-name: standard
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
Bumps [eta](https://github.com/eta-dev/eta) from 3.4.0 to 3.5.0.
- [Release notes](https://github.com/eta-dev/eta/releases)
- [Changelog](https://github.com/eta-dev/eta/blob/main/jsr.release.js)
- [Commits](eta-dev/eta@v3.4.0...v3.5.0)

---
updated-dependencies:
- dependency-name: eta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yadhav Jayaraman <[email protected]>
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.

8 participants