GitHunt
BA

Badgerati/Grape

Grape

  • All job steps are defined using a Grapefile - which is just powershell (see picassio2). The only config is:
    • job name/description
    • job parameters
    • schedule (or multi-branch)
    • git repo (and branch)
    • Grapefile name/path (or blank for default ".\Grapefile")

PAGES

= 12 random chars = job name: lowercase and hyphenated/underscored
= 12 random chars = branch name: lowercase and hyphenated (slashes are hyphens)

/ <- dashboard
/manage <- manage settings of grape

/jobs/ <- dashboard
/jobs/new <- create a new job

/jobs/ <- overview of a job, including last runs, average time
/jobs//run <- start a new run of the job / supply parameters / scan repo for updated branches to build
/jobs//runs/ <- overview of the run

/jobs//branches <- list of branches for the multi-branch job
/jobs//branches/ <- overview of a branch, including last runs
/jobs//branches//run <- start a run of the branch
/jobs//branches//runs/ <- overview of the run

API

/api/jobs <- POST <- create new job
- GET <- returns a list of jobs, with some filter/limit

/api/jobs/ <- GET <- returns job details, and last x runs or x branches
- DELETE <- deletes the job
- PUT <- updates the job

/api/jobs//runs <- POST <- starts a new run for the job, or scan a repo for updated/new branches

/api/jobs//runs/ <- GET <- returns run details
- DELETE <- if running, forces the run to stop

/api/jobs//branches/ <- GET <- returns branch details, and last x runs

/api/jobs//branches//runs <- POST <- starts a new run for the branch

/api/jobs//branches//runs/ <- GET <- returns run details
- DELETE <- if running, forces the run to stop

DIRECTORY STRUCTURE

./config.json
./grape.ps1

./jobs//config.json
/runs.json
/branches.json
/runs//config.json
/output.txt
/branches//config.json
/runs.json
/runs//config.json
/output.txt
/jobs.json

./workspaces//
// (split by runId on a normal job if multiple can run at once - otherwise all runs share one workspace [top level])
// (all multi-branch jobs are parallel so all split by runId)
??/workspaces.json

./queue/queue.json

OBJECTS

-- "jobs.json" object - only needs the quick info for loading a page

"jobs": [
    {
        "id": "<jobId>",
        "name": "core website",
        "status": "success", // or queued, running, failed, disabled, aborted, or none
        "duration": "<milliseconds>", // average duration
        "run": {
            "last": "2018-04-24 19:27:02.000",
            "next": "",
            "runId": 0
        }
    }
]

-- "config.json" for a job - more info, like grapefile etc

{
    "id": "<jobId>",
    "name": "core website",
    "description": "",
    "created": "",
    "updated": "",
    "type": "scm", // scm for git/svn, or dir for copying a directory
    "status": "success",
    "duration": "<milliseconds>", // average
    "grapefile": "", // path to file, or blank for ./Grapefile default
    "repo": {
        "type": "git",
        "multi": false,
        "url": "",
        "branch": "", // if type is multi, this is empty
    },
    "dir": {
        "path": ""
    },
    "run": {
        "parallel": false,
        "schedule": "", // cronjob format, or empty if no schedule
        "last": "2018-04-24 19:27:02.000",
        "next": "2018-04-24 19:28:02.000",
        "nextRunId": 1
    }
}

-- "runs.json"

"runs": [
    {
        "id": 1,
        "name": "",
        "duration": "<milliseconds>",
        "status": "success"
    }
]

-- "config.json" for a run

{
    "id": 1,
    "name": "",
    "description": "",
    "created": "",
    "start": "<date>",
    "end": "<date>",
    "duration": "<milliseconds>",
    "status": "success"
}

-- "queue.json"

"queue": [
    {
        "jobId": "",
        "runId": "",
        "running": false,
        "run": {
            "scheduled": "",
            "queued": "<date/time queued>",
            "started": "<date/time started>"
        }
    }
]

NOTES

https://bootswatch.com/pulse/
https://yarnpkg.com/en/

  • How to manage steps in the Grapefile?
  • Have an agent that can auto-clean-up completed workspaces (if enabled on job)
  • Have an agent to allow scheduled jobs
  • Ability to store credentials
  • Ability to have process-environment variables set on every run (and parameterised jobs)

Contributors

MIT License
Created April 12, 2018
Updated July 25, 2023
Badgerati/Grape | GitHunt