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

CLI: Plugins #9

Open
webbertakken opened this issue May 22, 2022 · 0 comments
Open

CLI: Plugins #9

webbertakken opened this issue May 22, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@webbertakken
Copy link
Member

webbertakken commented May 22, 2022

Context
Introduce a simple plugins system in the CLI that can be extended.

Plugins themselves are centrally maintained (as part of the CLI itself?).

Rationale

Currently if someone wants SonarQube to run, they have to spend several hours or days to implement it properly.

Each team is doing this separately, which is bascially a waste of everyones time and in practice it means that new developers will not have cool tools like this integrated.

Using centrally maintained plugins allows the community to together come up with the best approaches for each plugin.

Technical details

The interface of an action could look something like this:

- uses: unity-builder
  with:
    plugins:
      sonar: { my, config, params } # specific to sonar

A plugin definition, maintained by the community could look something like this

class BlenderAddOn {
  static get name() {
    return 'blender';
  }

  static get version() {
    return '1'
  }

  static get dockerCacheKey() {
    return `${BlenderAddOn.name}.${BlenderAddOn.version}`
  }

  static getAptGetPackages() {
    'my-package my-other-package'
  }

  static getRawDockerInstructions() {
    return `
      RUN echo 'test'
      RUN echo 'another layer'
    `
  }

  static runBefore() {
    if (someOS) {
      // install blender on VM instead of in docker
    }
  }

  static runAfter() {
    // cleanup
  }
}

It's not just an extension of the Dockerfile, but also other logic: a plugin is something that goes into a registry. And each part of the logic asks the registry if there is a piece to be injected in the logic that it is responsible for.

For example:

  • Docker build (docker.ts) will use getAptGetPackages and inject it into docker as an argument. It'll do this for all active plugins.
  • After it detects that your repository is dirty or not for example, some code, probably in pre-flight.ts or something, would call runBefore
@webbertakken webbertakken added the enhancement New feature or request label May 22, 2022
@webbertakken webbertakken self-assigned this May 22, 2022
This was referenced Sep 1, 2022
@webbertakken webbertakken transferred this issue from game-ci/unity-builder Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant