Skip to content

Create a Custom Check

Info

You can use any standard library check as reference for how to build new scorechecks

  1. Create a new check repo based on compscore/check-template
  2. Clone newly created repo
    git clone github.com/<organization>/<repository>.git
    cd <repository>
    
  3. Create go package
    go mod init github.com/<organization>/<repository>
    go mod tidy
    
  4. Write custom scorecheck implementation
    # main.go
    package <repository>
    ...
    func Run(ctx context.Context, target string, command string, expectedOutput string, username string, password string, options map[string]interface{}) (bool, string) {
     <scorecheck code>
     return <check success>, <check error message>
    }
    
  5. Commit, Push, and Tag Code
    git add .
    git commit -m "<commit message>"
    git push
    git tag v1.0.0 # or newest semantic version
    git push --tags
    
  6. Import code into Compscore Server
    # config.yml
    ---
    checks:
      - name: <name of check>
        release:
          org: <organization>
          repo: <repository>
          tag: latest # or tag of commit to use