action=authapp{Input:GithubConfig+code,Output:clusterPipeline}, action=authuser{Input:code,Output:sourcecodecredential}, action=deploy,destroy,revokeapp
HTTP/1.1 POST /v3/clusters/cluster-id/clusterpipelines
Content-Type: application/json
{
"clusterId": "local",
"deploy": false,
"githubConfig": {
"tls": true,
"host": "github.com",
"clientId": "xxxxxx",
"clientSecret": "xxxxxxxxx",
}
//TODO gitlabConfig,bitbucketConfig, etc.
}
action=run{Output: pipelineExecution}, activate, deactivate, link=view,export(view and export yaml config)
HTTP/1.1 POST /v3/projects/cluster-id:project-id/pipelines
{
"projectId": "project-abc",
"name": "pipeline-test",
"stages": [
{
"name": "build/test",
"steps": [
{
//one of the following config.
"sourceCodeConfig": {
"sourceCodeCredentialId": "sc-id",
"url": "https://github.com/rancher/rancher.git",
"branch": "master" // onlyBranch/exceptBranch/all options maps to this field in regex way.
},
"runScriptConfig": {
"image": "golang:1.8",
"isShell": true,
"shellScript": "echo example script",
//omit following if isShell==true
"entrypoint": "custom_entrypoint.sh",
"command": "--optional args",
"env": [
"FOO=BAR"
]
},
"publishImageConfig": {
"dockerfilePath": "./Dockerfile",
"buildContext": ".",
"tag": "reg.example.com/rancher/server:dev"
}
}
]
}
],
"triggerCronTimezone": "Asia/Hong_Kong".
"triggerCronExpression": "* 4 * * *", //will add validation to limit minimum run sequence
"triggerWebhook": true, //pipeline can run multiple times at the same time
"nextRun": 2,
"lastExecutionId": "abc",
"lastRunState": "success",
"lastStarted": "2012-09-27T18:39:00Z",
"nextStart": "2012-09-27T18:40:00Z",
"webhookId": "123", //webhook id created on github repo, use to delete webhook when delete the pipeline. drop and do not expose to users.
"token": "***", //use for webhook validation, drop and do not expose to users.
}
HTTP/1.1 GET /v3/projects/cluster-id:project-id/pipelineexecutions/id
{
"projectId": "project-abc",
"pipelineId": "pipeline-test",
"id": "pipeline-test-1",
"run": 1,
"triggeredBy": "user", //webhook,cron
"triggerUserId": "user-ld78",
"pipeline": {}, //pipeline def of this execution
"commit": "e5ed7510",
"state": "running",
"started": "2012-09-27T18:39:00Z",
"ended": "2012-09-27T18:39:00Z",
//want to keep status and pipeline def seperated here
"stages": [
{
"state": "running",
"started": "2012-09-27T18:39:00Z",
"ended": "2012-09-27T18:39:00Z",
"steps": [
{
"state": "running",
"started": "2012-09-27T18:39:00Z",
"ended": "2012-09-27T18:39:00Z",
}
]
}
]
}
HTTP/1.1 GET /v3/projects/cluster-id:project-id/pipelineexecutionlogs/id
// the log will be trimmed to latest section if it exceed store limit
{
"projectId": "project-abc",
"pipelineExecutionId": "pipeline-test-1",
"stage": 1,
"step": 1,
"message": "here's the logs"
}
HTTP/1.1 GET /v3/sourcecodecredentials/id?creatorId=user-kb8l5
link=avatar,profile
{
"clusterId": "local"
"kind": "github",
"userId": "rancherUserId",
"name": "Lawrence Li",
"loginName": "gitlawr",
"accessToken": "***"
}
HTTP/1.1 GET /v3/sourcecoderepositories/id?creatorId=user-kb8l5
{
"clusterId": "local"
"kind": "github",
"userId": "user-ldk8",
"sourceCodeCredentialId": "somecredentialId",
"url": "https://github.com/rancher/rancher.git",
"permissions": {
"pull": true,
"push": true,
"admin": true
},
"language": "go"
}
Pipeline
triggerCron.timezone->triggerTimezone(don't nest deeply unless there's a compelling reason too)triggerCron.expression->triggerCronExpression* * * * *is going to go well.status.*-> fields directly on pipeline;lastRunId->lastExecutionId(the type is execution, not run)lastRunTimethe time it started or ended? Change tolastStartedorlastEnded.nextRunTime->nextStarttype: masked(ortype: passwordif the framework doesn't support masked, not sure).Execution
statusup a level. Thespecandstatuspattern in k8s is not exposed in the user APIcommitInfojust the commit hash? ->commit{start, end}Time->{start, end}ed, as ISO-8601stageStatus->stagesstepStatus->stepspipelineso you have all the steps with what they do and their start/end/state in one map instead of having to cross-reference two different maps to show all the steps and their statusLog
SourceCodeCredential
sourceCodeType->kindlinks.avatarlast time I meant a field called "avatar" in the "links" map..{type: '...', links: {"avatar": "http://..."}}.rancherUserId->userIdaccessTokenshould be masked/password and not readable by userclusterIdwhen SourceCodeRepositories aren't?SourceCodeRepository
gitrepocaches