diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 19437595..cf8f1345 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -38,6 +38,7 @@ /plugins/Steam/ @kmichalski0 /plugins/SumoLogic/ @richpeters /plugins/Supabase/ @adamkinniburgh +/plugins/TeamCity/ @clarkd /plugins/TeamDynamix/ @shawn149 /plugins/TransportForLondon/ @clarkd /plugins/UniFi/ @adamkinniburgh diff --git a/plugins/TeamCity/v1/configValidation.json b/plugins/TeamCity/v1/configValidation.json new file mode 100644 index 00000000..ce47b453 --- /dev/null +++ b/plugins/TeamCity/v1/configValidation.json @@ -0,0 +1,25 @@ +{ + "steps": [ + { + "displayName": "Authenticate", + "dataStream": { + "name": "server" + }, + "required": true, + "error": "Could not connect to TeamCity. Check the server URL is reachable from SquaredUp and the access token is valid and has not expired.", + "success": "Connected to TeamCity successfully." + }, + { + "displayName": "Check data access", + "dataStream": { + "name": "buildTypes", + "config": { + "errorOnEmptyResults": true + } + }, + "required": false, + "error": "Connected, but no build configurations were returned. Check the user the access token belongs to can view at least one project.", + "success": "Build configurations are accessible." + } + ] +} diff --git a/plugins/TeamCity/v1/custom_types.json b/plugins/TeamCity/v1/custom_types.json new file mode 100644 index 00000000..0fbb36f5 --- /dev/null +++ b/plugins/TeamCity/v1/custom_types.json @@ -0,0 +1,23 @@ +[ + { + "name": "Project", + "sourceType": "Project", + "icon": "folder-tree", + "singular": "Project", + "plural": "Projects" + }, + { + "name": "Build Configuration", + "sourceType": "Build Configuration", + "icon": "gears", + "singular": "Build Configuration", + "plural": "Build Configurations" + }, + { + "name": "Agent", + "sourceType": "Agent", + "icon": "server", + "singular": "Agent", + "plural": "Agents" + } +] diff --git a/plugins/TeamCity/v1/dataStreams/agentList.json b/plugins/TeamCity/v1/dataStreams/agentList.json new file mode 100644 index 00000000..1967c5be --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/agentList.json @@ -0,0 +1,77 @@ +{ + "name": "agentList", + "displayName": "Agent List", + "description": "Authorized TeamCity build agents, with their pool, IP address and operating system", + "tags": [ + "Inventory" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "agents", + "getArgs": [ + { + "key": "locator", + "value": "authorized:true,connected:any,enabled:any,count:1000" + }, + { + "key": "fields", + "value": "nextHref,agent(id,name,ip,pool(id,name),environment(osType,osName))" + } + ], + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "pagedList.js", + "expandInnerObjects": true + }, + "matches": "none", + "visibility": { + "type": "hidden" + }, + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "role": "id" + }, + { + "name": "name", + "displayName": "Agent", + "shape": "string", + "role": "label" + }, + { + "name": "pool.name", + "displayName": "Pool", + "shape": "string" + }, + { + "name": "pool.id", + "displayName": "Pool ID", + "shape": "string", + "visible": false + }, + { + "name": "ip", + "displayName": "IP Address", + "shape": "string" + }, + { + "name": "environment.osType", + "displayName": "OS Type", + "shape": "string" + }, + { + "name": "environment.osName", + "displayName": "OS", + "shape": "string" + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/dataStreams/agents.json b/plugins/TeamCity/v1/dataStreams/agents.json new file mode 100644 index 00000000..389623d8 --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/agents.json @@ -0,0 +1,198 @@ +{ + "name": "agents", + "displayName": "Agents", + "description": "Live status of TeamCity build agents, with the build each is running now, its pool and operating system", + "tags": [ + "Agents" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "agents", + "getArgs": [ + { + "key": "locator", + "value": "{{ (() => { const ids = (typeof agent !== 'undefined' && Array.isArray(agent) ? agent : []).map(a => Array.isArray(a.rawId) ? a.rawId[0] : a.rawId).filter(Boolean); const idPart = ids.length === 1 ? `id:${ids[0]}` : ids.length > 1 ? `item:(${ids.map(i => `id:${i}`).join('),item:(')})` : ''; return [idPart, `authorized:${String(typeof includeUnauthorized === 'undefined' ? '' : includeUnauthorized) === 'true' ? 'any' : 'true'}`, 'connected:any', 'enabled:any', 'count:500'].filter(Boolean).join(','); })() }}" + }, + { + "key": "fields", + "value": "nextHref,agent(id,name,connected,enabled,authorized,uptodate,ip,lastActivityTime,pool(id,name),environment(osType,osName),build(id,number,buildTypeId,buildType(id,name,projectName)),enabledInfo(comment(text)),authorizedInfo(comment(text)),webUrl)" + } + ], + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "pagedList.js", + "expandInnerObjects": true + }, + "matches": "none", + "ui": [ + { + "type": "objects", + "name": "agent", + "label": "Agent(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Agent" + ] + } + } + }, + { + "type": "toggle", + "name": "includeUnauthorized", + "label": "Include unauthorized agents", + "defaultValue": false + } + ], + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "role": "id" + }, + { + "name": "name", + "displayName": "Agent", + "shape": "string", + "role": "label" + }, + { + "sourceId": "id", + "sourceType": "Agent", + "name": "name" + }, + { + "name": "status", + "displayName": "Status", + "shape": [ + "state", + { + "map": { + "error": [ + "Disconnected" + ], + "warning": [ + "Disabled", + "Outdated", + "Unauthorized" + ], + "success": [ + "Healthy" + ] + } + } + ], + "computed": true, + "valueExpression": "{{ $['connected'] === false ? 'Disconnected' : $['authorized'] === false ? 'Unauthorized' : $['enabled'] === false ? 'Disabled' : $['uptodate'] === false ? 'Outdated' : 'Healthy' }}" + }, + { + "name": "connected", + "displayName": "Connected", + "shape": "boolean" + }, + { + "name": "enabled", + "displayName": "Enabled", + "shape": "boolean" + }, + { + "name": "authorized", + "displayName": "Authorized", + "shape": "boolean" + }, + { + "name": "uptodate", + "displayName": "Up to Date", + "shape": "boolean" + }, + { + "name": "build.number", + "displayName": "Current Build", + "shape": "string" + }, + { + "name": "build.buildType.name", + "displayName": "Current Build Configuration", + "shape": "string" + }, + { + "name": "build.buildTypeId", + "displayName": "Current Build Configuration ID", + "shape": "string", + "visible": false + }, + { + "sourceId": "build.buildTypeId", + "sourceType": "Build Configuration", + "name": "build.buildType.name" + }, + { + "name": "build.id", + "displayName": "Current Build ID", + "shape": "string", + "visible": false + }, + { + "name": "pool.name", + "displayName": "Pool", + "shape": "string" + }, + { + "name": "pool.id", + "displayName": "Pool ID", + "shape": "string", + "visible": false + }, + { + "name": "environment.osName", + "displayName": "OS", + "shape": "string" + }, + { + "name": "environment.osType", + "displayName": "OS Type", + "shape": "string", + "visible": false + }, + { + "name": "ip", + "displayName": "IP Address", + "shape": "string" + }, + { + "name": "lastActivityTime", + "displayName": "Last Activity", + "shape": "date" + }, + { + "name": "enabledInfo.comment.text", + "displayName": "Disabled Reason", + "shape": "string" + }, + { + "name": "authorizedInfo.comment.text", + "displayName": "Unauthorized Reason", + "shape": "string", + "visible": false + }, + { + "name": "webUrl", + "displayName": "URL", + "shape": [ + "url", + { + "label": "Open in TeamCity" + } + ] + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/dataStreams/buildConfigurationStatus.json b/plugins/TeamCity/v1/dataStreams/buildConfigurationStatus.json new file mode 100644 index 00000000..a0a65e93 --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/buildConfigurationStatus.json @@ -0,0 +1,162 @@ +{ + "name": "buildConfigurationStatus", + "displayName": "Build Configuration Status", + "description": "Current health of each build configuration (the status of its last finished build)", + "tags": [ + "Builds" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "buildTypes", + "getArgs": [ + { + "key": "locator", + "value": "{{ (() => { const ids = v => (v || []).map(o => Array.isArray(o.rawId) ? o.rawId[0] : o.rawId); const p = ids(project), b = ids(buildConfiguration); return ['count:500', p.length && `affectedProject:(${p.length === 1 ? `id:${p[0]}` : p.map(x => `item:(id:${x})`).join(',')})`, b.length && (b.length === 1 ? `id:${b[0]}` : b.map(x => `item:(id:${x})`).join(','))].filter(Boolean).join(','); })() }}" + }, + { + "key": "fields", + "value": "nextHref,buildType(id,name,projectName,paused,webUrl,builds($locator(state:finished,count:1),build(id,number,status,statusText,branchName,finishDate,webUrl)))" + } + ], + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "buildConfigurationStatus.js" + }, + "matches": "none", + "ui": [ + { + "type": "objects", + "name": "project", + "label": "Project(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Project" + ] + } + } + }, + { + "type": "objects", + "name": "buildConfiguration", + "label": "Build configuration(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Build Configuration" + ] + } + } + } + ], + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "role": "id", + "visible": false + }, + { + "name": "name", + "displayName": "Name", + "shape": "string", + "visible": false + }, + { + "name": "fullName", + "displayName": "Build Configuration", + "shape": "string", + "role": "label", + "computed": true, + "valueExpression": "{{ $['projectName'] ? `${$['projectName']} / ${$['name']}` : $['name'] }}" + }, + { + "sourceId": "id", + "sourceType": "Build Configuration", + "name": "fullName" + }, + { + "name": "projectName", + "displayName": "Project", + "shape": "string" + }, + { + "name": "paused", + "displayName": "Paused", + "shape": "boolean" + }, + { + "name": "status", + "displayName": "Status", + "shape": [ + "state", + { + "map": { + "success": [ + "SUCCESS" + ], + "error": [ + "FAILURE" + ], + "unknown": [ + "UNKNOWN" + ], + "unmonitored": [ + "NONE" + ] + } + } + ] + }, + { + "name": "statusText", + "displayName": "Status Text", + "shape": "string" + }, + { + "name": "lastBuildNumber", + "displayName": "Last Build", + "shape": "string" + }, + { + "name": "lastBuildBranch", + "displayName": "Branch", + "shape": "string" + }, + { + "name": "lastBuildFinished", + "displayName": "Last Build Finished", + "shape": "date" + }, + { + "name": "lastBuildUrl", + "displayName": "Last Build URL", + "shape": [ + "url", + { + "label": "Open build" + } + ] + }, + { + "name": "webUrl", + "displayName": "URL", + "shape": [ + "url", + { + "label": "Open in TeamCity" + } + ] + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/dataStreams/buildQueue.json b/plugins/TeamCity/v1/dataStreams/buildQueue.json new file mode 100644 index 00000000..c9d4dd90 --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/buildQueue.json @@ -0,0 +1,147 @@ +{ + "name": "buildQueue", + "displayName": "Build Queue", + "description": "Builds waiting in the queue, with the reason they are waiting", + "tags": [ + "Builds" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "buildQueue", + "getArgs": [ + { + "key": "locator", + "value": "count:500" + }, + { + "key": "fields", + "value": "nextHref,build(id,buildTypeId,buildType(name,projectName,project(id,ancestorProjects(project(id)))),branchName,queuedDate,waitReason,state,webUrl,triggered(type,user(username)),startEstimate,agent(id,name))" + } + ], + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "buildQueue.js", + "expandInnerObjects": true + }, + "matches": "none", + "ui": [ + { + "type": "objects", + "name": "project", + "label": "Project(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Project" + ] + } + } + }, + { + "type": "objects", + "name": "buildConfiguration", + "label": "Build Configuration(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Build Configuration" + ] + } + } + } + ], + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "role": "id" + }, + { + "name": "buildTypeId", + "displayName": "Build Configuration ID", + "shape": "string", + "visible": false + }, + { + "name": "buildType.name", + "displayName": "Build Configuration Name", + "shape": "string", + "visible": false + }, + { + "name": "buildType.projectName", + "displayName": "Project", + "shape": "string" + }, + { + "name": "buildConfigurationName", + "displayName": "Build Configuration", + "shape": "string", + "role": "label", + "computed": true, + "valueExpression": "{{ $['buildType.projectName'] ? `${$['buildType.projectName']} / ${$['buildType.name']}` : $['buildType.name'] }}" + }, + { + "sourceId": "buildTypeId", + "sourceType": "Build Configuration", + "name": "buildConfigurationName" + }, + { + "name": "branchName", + "displayName": "Branch", + "shape": "string" + }, + { + "name": "queuedDate", + "displayName": "Queued", + "shape": "date" + }, + { + "name": "waitingSeconds", + "displayName": "Waiting", + "shape": "seconds", + "computed": true, + "valueExpression": "{{ $['queuedDate'] ? Math.max(0, Math.round((Date.now() - new Date($['queuedDate']).getTime()) / 1000)) : null }}" + }, + { + "name": "waitReason", + "displayName": "Wait Reason", + "shape": "string" + }, + { + "name": "triggered.user.username", + "displayName": "Triggered By", + "shape": "string" + }, + { + "name": "triggered.type", + "displayName": "Trigger Type", + "shape": "string" + }, + { + "name": "startEstimate", + "displayName": "Start Estimate", + "shape": "date" + }, + { + "name": "webUrl", + "displayName": "URL", + "shape": [ + "url", + { + "label": "Open in TeamCity" + } + ] + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/dataStreams/buildTypes.json b/plugins/TeamCity/v1/dataStreams/buildTypes.json new file mode 100644 index 00000000..a1b7c25f --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/buildTypes.json @@ -0,0 +1,78 @@ +{ + "name": "buildTypes", + "displayName": "Build Configurations", + "description": "TeamCity build configurations, with their project and paused status", + "tags": [ + "Inventory" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "buildTypes", + "getArgs": [ + { + "key": "locator", + "value": "count:1000" + }, + { + "key": "fields", + "value": "nextHref,buildType(id,name,projectId,projectName,paused,webUrl)" + } + ], + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "pagedList.js" + }, + "matches": "none", + "visibility": { + "type": "hidden" + }, + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "role": "id" + }, + { + "name": "name", + "displayName": "Name", + "shape": "string", + "visible": false + }, + { + "name": "fullName", + "displayName": "Build Configuration", + "shape": "string", + "role": "label", + "computed": true, + "valueExpression": "{{ $['projectName'] ? `${$['projectName']} / ${$['name']}` : $['name'] }}" + }, + { + "name": "projectId", + "displayName": "Project ID", + "shape": "string" + }, + { + "name": "projectName", + "displayName": "Project", + "shape": "string" + }, + { + "name": "paused", + "displayName": "Paused", + "shape": "boolean" + }, + { + "name": "webUrl", + "displayName": "URL", + "shape": ["url", { "label": "Open in TeamCity" }] + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/dataStreams/builds.json b/plugins/TeamCity/v1/dataStreams/builds.json new file mode 100644 index 00000000..e1fee87f --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/builds.json @@ -0,0 +1,219 @@ +{ + "name": "builds", + "displayName": "Builds", + "description": "Finished TeamCity builds within the selected timeframe, one row per build", + "tags": [ + "Builds" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "builds", + "getArgs": [ + { + "key": "locator", + "value": "{{ (() => { const f = d => new Date(d).toISOString().slice(0, 19).split('-').join('').split(':').join('') + '+0000'; const ids = v => (v || []).map(o => { const r = o.rawId !== undefined ? o.rawId : o.sourceId; return Array.isArray(r) ? r[0] : r; }).filter(Boolean); const dim = (n, v) => { const a = ids(v); return a.length === 0 ? null : a.length === 1 ? `${n}:(id:${a[0]})` : `${n}:(${a.map(i => `item:(id:${i})`).join(',')})`; }; return ['defaultFilter:false', 'state:finished', 'canceled:false', 'personal:false', 'branch:default:any', `finishDate:(date:${f(timeframe.start)},condition:after)`, `finishDate:(date:${f(timeframe.end)},condition:before)`, dim('affectedProject', typeof project === 'undefined' ? null : project), dim('buildType', typeof buildConfiguration === 'undefined' ? null : buildConfiguration), dim('agent', typeof agent === 'undefined' ? null : agent), 'count:500'].filter(Boolean).join(','); })() }}" + }, + { + "key": "fields", + "value": "nextHref,build(id,number,status,statusText,buildTypeId,branchName,queuedDate,startDate,finishDate,composite,webUrl,buildType(name,projectName),triggered(type,user(username)),agent(id,name))" + } + ], + "expandInnerObjects": true, + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "pagedList.js" + }, + "matches": "none", + "ui": [ + { + "type": "objects", + "name": "project", + "label": "Project(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Project" + ] + } + } + }, + { + "type": "objects", + "name": "buildConfiguration", + "label": "Build Configuration(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Build Configuration" + ] + } + } + }, + { + "type": "objects", + "name": "agent", + "label": "Agent(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Agent" + ] + } + } + } + ], + "metadata": [ + { + "name": "id", + "displayName": "Build ID", + "shape": "number", + "role": "id" + }, + { + "name": "number", + "displayName": "Build Number", + "shape": "string", + "role": "label" + }, + { + "name": "status", + "displayName": "Status", + "shape": [ + "state", + { + "map": { + "success": [ + "SUCCESS" + ], + "error": [ + "FAILURE" + ], + "unknown": [ + "UNKNOWN" + ] + } + } + ] + }, + { + "name": "statusText", + "displayName": "Status Text", + "shape": "string" + }, + { + "name": "buildTypeId", + "displayName": "Build Configuration ID", + "shape": "string", + "visible": false + }, + { + "name": "buildType.name", + "displayName": "Build Configuration Name", + "shape": "string", + "visible": false + }, + { + "name": "buildType.projectName", + "displayName": "Project", + "shape": "string" + }, + { + "name": "buildConfiguration", + "displayName": "Build Configuration", + "shape": "string", + "computed": true, + "valueExpression": "{{ $['buildType.projectName'] ? `${$['buildType.projectName']} / ${$['buildType.name']}` : $['buildType.name'] }}" + }, + { + "name": "branchName", + "displayName": "Branch", + "shape": "string" + }, + { + "name": "queuedDate", + "displayName": "Queued", + "shape": "date" + }, + { + "name": "startDate", + "displayName": "Started", + "shape": "date" + }, + { + "name": "finishDate", + "displayName": "Finished", + "shape": "date", + "role": "timestamp" + }, + { + "name": "duration", + "displayName": "Duration", + "shape": "seconds", + "computed": true, + "valueExpression": "{{ (() => { const p = s => new Date(s).getTime(); return $['finishDate'] && $['startDate'] ? Math.round((p($['finishDate']) - p($['startDate'])) / 1000) : null; })() }}" + }, + { + "name": "queueTime", + "displayName": "Queue Time", + "shape": "seconds", + "computed": true, + "valueExpression": "{{ (() => { const p = s => new Date(s).getTime(); return $['startDate'] && $['queuedDate'] ? Math.round((p($['startDate']) - p($['queuedDate'])) / 1000) : null; })() }}" + }, + { + "name": "triggered.type", + "displayName": "Trigger Type", + "shape": "string" + }, + { + "name": "triggered.user.username", + "displayName": "Triggered By", + "shape": "string" + }, + { + "name": "agent.id", + "displayName": "Agent ID", + "shape": "string", + "visible": false + }, + { + "name": "agent.name", + "displayName": "Agent", + "shape": "string" + }, + { + "name": "composite", + "displayName": "Composite", + "shape": "boolean" + }, + { + "name": "webUrl", + "displayName": "URL", + "shape": [ + "url", + { + "label": "Open in TeamCity" + } + ] + }, + { + "sourceId": "buildTypeId", + "sourceType": "Build Configuration", + "name": "buildConfiguration" + }, + { + "sourceId": "agent.id", + "sourceType": "Agent", + "name": "agent.name" + } + ], + "timeframes": true +} diff --git a/plugins/TeamCity/v1/dataStreams/projects.json b/plugins/TeamCity/v1/dataStreams/projects.json new file mode 100644 index 00000000..24c6aa12 --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/projects.json @@ -0,0 +1,91 @@ +{ + "name": "projects", + "displayName": "Projects", + "description": "TeamCity projects and subprojects, with their full project path and archived status", + "tags": [ + "Inventory" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "projects", + "getArgs": [ + { + "key": "locator", + "value": "affectedProject:(id:_Root),count:1000" + }, + { + "key": "fields", + "value": "nextHref,project(id,name,parentProjectId,archived,webUrl,ancestorProjects(project(id,name)))" + } + ], + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "pagedList.js", + "expandInnerObjects": true + }, + "matches": "none", + "visibility": { + "type": "hidden" + }, + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "role": "id" + }, + { + "name": "name", + "displayName": "Name", + "shape": "string", + "visible": false + }, + { + "name": "ancestorProjects.project", + "displayName": "Ancestor Projects", + "visible": false + }, + { + "name": "parentProjectName", + "displayName": "Parent Project", + "shape": "string", + "computed": true, + "valueExpression": "{{ (Array.isArray($['ancestorProjects.project']) ? $['ancestorProjects.project'] : (typeof $['ancestorProjects.project'] === 'string' ? JSON.parse($['ancestorProjects.project']) : [])).filter(p => p.id !== '_Root').map(p => p.name).pop() || '' }}" + }, + { + "name": "fullName", + "displayName": "Project", + "shape": "string", + "role": "label", + "computed": true, + "valueExpression": "{{ [...(Array.isArray($['ancestorProjects.project']) ? $['ancestorProjects.project'] : (typeof $['ancestorProjects.project'] === 'string' ? JSON.parse($['ancestorProjects.project']) : [])).filter(p => p.id !== '_Root').map(p => p.name), $['name']].join(' / ') }}" + }, + { + "name": "parentProjectId", + "displayName": "Parent Project ID", + "shape": "string" + }, + { + "name": "archived", + "displayName": "Archived", + "shape": "boolean" + }, + { + "name": "webUrl", + "displayName": "URL", + "shape": [ + "url", + { + "label": "Open in TeamCity" + } + ] + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/dataStreams/runningBuilds.json b/plugins/TeamCity/v1/dataStreams/runningBuilds.json new file mode 100644 index 00000000..7785134a --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/runningBuilds.json @@ -0,0 +1,204 @@ +{ + "name": "runningBuilds", + "displayName": "Running Builds", + "description": "Builds running right now, with progress, elapsed time and the agent running them", + "tags": [ + "Builds" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "builds", + "getArgs": [ + { + "key": "locator", + "value": "{{ ['state:running','defaultFilter:false','personal:false','branch:default:any','count:500'].concat([['affectedProject',project],['buildType',buildConfiguration],['agent',agent]].filter(p => p[1] && p[1].length).map(p => { const ids = p[1].map(o => Array.isArray(o.rawId) ? o.rawId[0] : o.rawId); return p[0] + ':' + (ids.length > 1 ? '(' + ids.map(i => 'item:(id:' + i + ')').join(',') + ')' : '(id:' + ids[0] + ')'); })).join(',') }}" + }, + { + "key": "fields", + "value": "nextHref,build(id,number,status,statusText,branchName,buildTypeId,buildType(name,projectName),startDate,webUrl,percentageComplete,agent(id,name),running-info(elapsedSeconds,estimatedTotalSeconds,currentStageText,probablyHanging))" + } + ], + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "pagedList.js", + "expandInnerObjects": true + }, + "matches": "none", + "ui": [ + { + "type": "objects", + "name": "project", + "label": "Project(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Project" + ] + } + } + }, + { + "type": "objects", + "name": "buildConfiguration", + "label": "Build Configuration(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Build Configuration" + ] + } + } + }, + { + "type": "objects", + "name": "agent", + "label": "Agent(s)", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Agent" + ] + } + } + } + ], + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "role": "id" + }, + { + "name": "number", + "displayName": "Build Number", + "shape": "string", + "role": "label" + }, + { + "name": "buildTypeId", + "displayName": "Build Configuration ID", + "shape": "string", + "visible": false + }, + { + "name": "buildType.name", + "displayName": "Build Configuration Name", + "shape": "string", + "visible": false + }, + { + "name": "buildType.projectName", + "displayName": "Project", + "shape": "string" + }, + { + "name": "buildConfigurationName", + "displayName": "Build Configuration", + "shape": "string", + "computed": true, + "valueExpression": "{{ $['buildType.projectName'] ? `${$['buildType.projectName']} / ${$['buildType.name']}` : $['buildType.name'] }}" + }, + { + "sourceId": "buildTypeId", + "sourceType": "Build Configuration", + "name": "buildConfigurationName" + }, + { + "name": "branchName", + "displayName": "Branch", + "shape": "string" + }, + { + "name": "status", + "displayName": "Status", + "shape": [ + "state", + { + "map": { + "success": [ + "SUCCESS" + ], + "error": [ + "FAILURE" + ], + "unknown": [ + "UNKNOWN" + ] + } + } + ] + }, + { + "name": "statusText", + "displayName": "Status Text", + "shape": "string" + }, + { + "name": "running-info.currentStageText", + "displayName": "Current Stage", + "shape": "string" + }, + { + "name": "percentageComplete", + "displayName": "Percent Complete", + "shape": "percent" + }, + { + "name": "running-info.elapsedSeconds", + "displayName": "Elapsed", + "shape": "seconds" + }, + { + "name": "running-info.estimatedTotalSeconds", + "displayName": "Estimated Total", + "shape": "seconds" + }, + { + "name": "running-info.probablyHanging", + "displayName": "Probably Hanging", + "shape": "boolean" + }, + { + "name": "startDate", + "displayName": "Started", + "shape": "date" + }, + { + "name": "agent.id", + "displayName": "Agent ID", + "shape": "string", + "visible": false + }, + { + "name": "agent.name", + "displayName": "Agent", + "shape": "string" + }, + { + "sourceId": "agent.id", + "sourceType": "Agent", + "name": "agent.name" + }, + { + "name": "webUrl", + "displayName": "URL", + "shape": [ + "url", + { + "label": "Open in TeamCity" + } + ] + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/dataStreams/scripts/buildConfigurationStatus.js b/plugins/TeamCity/v1/dataStreams/scripts/buildConfigurationStatus.js new file mode 100644 index 00000000..71d4112d --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/scripts/buildConfigurationStatus.js @@ -0,0 +1,21 @@ +// TeamCity returns the next page as `nextHref`, a path relative to the server root. Resolve it +// against this request's URL so `nextUrl` paging can follow it; no `nextHref` ends paging. +pagingContext = data && data.nextHref ? new URL(data.nextHref, response.url).href : undefined; + +// Flatten each configuration's latest finished build (if it has one) into the row. +result = ((data && data.buildType) || []).map(bt => { + const build = (bt.builds && bt.builds.build && bt.builds.build[0]) || {}; + return { + id: bt.id, + name: bt.name, + projectName: bt.projectName, + paused: bt.paused === true, + webUrl: bt.webUrl, + status: build.status || 'NONE', + statusText: build.statusText, + lastBuildNumber: build.number, + lastBuildBranch: build.branchName, + lastBuildFinished: build.finishDate, + lastBuildUrl: build.webUrl + }; +}); diff --git a/plugins/TeamCity/v1/dataStreams/scripts/buildQueue.js b/plugins/TeamCity/v1/dataStreams/scripts/buildQueue.js new file mode 100644 index 00000000..e8c3a3e9 --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/scripts/buildQueue.js @@ -0,0 +1,28 @@ +// TeamCity returns the next page as `nextHref`, a path relative to the server root. Resolve it +// against this request's URL so `nextUrl` paging can follow it; no `nextHref` ends paging. +pagingContext = data && data.nextHref ? new URL(data.nextHref, response.url).href : undefined; + +// The queue locator's `project` dimension matches only a project's own build configurations, and +// its `buildType` dimension resolves to a single configuration, so the optional object filters are +// applied here instead. The queue is paged, not capped, so no queued build is missed. +const unwrap = (v) => (Array.isArray(v) ? v[0] : v); +const ids = (v) => new Set((Array.isArray(v) ? v : []).map((o) => unwrap(o.rawId)).filter(Boolean)); +const projects = ids(context.config && context.config.project); +const configurations = ids(context.config && context.config.buildConfiguration); + +result = ((data && data.build) || []) + .filter((b) => { + if (configurations.size && !configurations.has(b.buildTypeId)) { + return false; + } + if (projects.size) { + const project = (b.buildType && b.buildType.project) || {}; + const ancestors = ((project.ancestorProjects && project.ancestorProjects.project) || []).map((p) => p.id); + return [project.id, ...ancestors].some((id) => projects.has(id)); + } + return true; + }) + .map(({ buildType, ...build }) => ({ + ...build, + buildType: { name: buildType && buildType.name, projectName: buildType && buildType.projectName }, + })); diff --git a/plugins/TeamCity/v1/dataStreams/scripts/pagedList.js b/plugins/TeamCity/v1/dataStreams/scripts/pagedList.js new file mode 100644 index 00000000..a04c915e --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/scripts/pagedList.js @@ -0,0 +1,6 @@ +// TeamCity returns the next page as `nextHref`, a path relative to the server root. Resolve it +// against this request's URL so `nextUrl` paging can follow it; no `nextHref` ends paging. +pagingContext = data && data.nextHref ? new URL(data.nextHref, response.url).href : undefined; + +// A list response holds its items in a single array property (`project`, `buildType`, `agent`, `build`). +result = (data && Object.values(data).find(Array.isArray)) || []; diff --git a/plugins/TeamCity/v1/dataStreams/server.json b/plugins/TeamCity/v1/dataStreams/server.json new file mode 100644 index 00000000..7094b456 --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/server.json @@ -0,0 +1,72 @@ +{ + "name": "server", + "displayName": "Server", + "description": "TeamCity server version, build number and start time", + "tags": [ + "Server" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "endpointPath": "server", + "getArgs": [ + { + "key": "fields", + "value": "version,versionMajor,versionMinor,buildNumber,buildDate,startTime,currentTime,webUrl,role" + } + ] + }, + "matches": "none", + "metadata": [ + { + "name": "version", + "displayName": "Version", + "shape": "string", + "role": "label", + "valueExpression": "{{ $['versionMajor'] ? `${$['versionMajor']}.${$['versionMinor']}` : String($['version'] || '').trim() }}" + }, + { + "name": "versionMajor", + "displayName": "Major Version", + "shape": "number", + "visible": false + }, + { + "name": "versionMinor", + "displayName": "Minor Version", + "shape": "number", + "visible": false + }, + { + "name": "buildNumber", + "displayName": "Build Number", + "shape": "string" + }, + { + "name": "buildDate", + "displayName": "Build Date", + "shape": "date" + }, + { + "name": "startTime", + "displayName": "Started", + "shape": "date" + }, + { + "name": "role", + "displayName": "Node Role", + "shape": "string" + }, + { + "name": "webUrl", + "displayName": "URL", + "shape": [ + "url", + { + "label": "Open TeamCity" + } + ] + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/dataStreams/testOccurrences.json b/plugins/TeamCity/v1/dataStreams/testOccurrences.json new file mode 100644 index 00000000..be2d33a5 --- /dev/null +++ b/plugins/TeamCity/v1/dataStreams/testOccurrences.json @@ -0,0 +1,115 @@ +{ + "name": "testOccurrences", + "displayName": "Test Results", + "description": "Tests run by the latest finished build of a build configuration, with their status", + "tags": [ + "Builds" + ], + "baseDataSourceName": "httpRequestScopedSingle", + "config": { + "httpMethod": "get", + "endpointPath": "testOccurrences", + "getArgs": [ + { + "key": "locator", + "value": "{{ `build:(buildType:(id:${object.rawId}),state:finished,count:1)${String(failedOnly) === 'true' ? ',status:FAILURE' : ''},count:1000` }}" + }, + { + "key": "fields", + "value": "nextHref,testOccurrence(id,name,status,duration,newFailure,muted,ignored,currentlyInvestigated,build(id,number))" + } + ], + "expandInnerObjects": true, + "paging": { + "mode": "nextUrl", + "in": { + "realm": "payload", + "path": "nextHref" + } + }, + "postRequestScript": "pagedList.js" + }, + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Build Configuration" + ] + } + }, + "objectLimit": 1, + "ui": [ + { + "type": "toggle", + "name": "failedOnly", + "label": "Failed tests only", + "defaultValue": false, + "help": "Show only tests with a failed status" + } + ], + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "visible": false + }, + { + "name": "name", + "displayName": "Test", + "shape": "string", + "role": "label" + }, + { + "name": "status", + "displayName": "Status", + "shape": [ + "state", + { + "map": { + "success": ["SUCCESS"], + "error": ["FAILURE"], + "unknown": ["UNKNOWN"] + } + } + ] + }, + { + "name": "duration", + "displayName": "Duration", + "shape": "milliseconds" + }, + { + "name": "newFailure", + "displayName": "New Failure", + "shape": "boolean" + }, + { + "name": "muted", + "displayName": "Muted", + "shape": "boolean" + }, + { + "name": "ignored", + "displayName": "Ignored", + "shape": "boolean" + }, + { + "name": "currentlyInvestigated", + "displayName": "Investigated", + "shape": "boolean" + }, + { + "name": "build.number", + "displayName": "Build Number", + "shape": "string" + }, + { + "name": "build.id", + "displayName": "Build ID", + "shape": "string", + "visible": false + } + ], + "timeframes": false +} diff --git a/plugins/TeamCity/v1/defaultContent/agent.dash.json b/plugins/TeamCity/v1/defaultContent/agent.dash.json new file mode 100644 index 00000000..2edeb35d --- /dev/null +++ b/plugins/TeamCity/v1/defaultContent/agent.dash.json @@ -0,0 +1,810 @@ +{ + "name": "Agent", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "b45dd336-b96c-4ce7-9f09-255e898f47d4", + "x": 0, + "y": 0, + "w": 1, + "h": 4, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Agent Properties", + "description": "Properties imported from TeamCity", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "none", + "dataStream": { + "id": "datastream-properties", + "name": "properties", + "pluginConfigId": "{{configId}}" + }, + "scope": { + "scope": "{{scopes.[TeamCity Agents]}}", + "workspace": "{{workspaceId}}", + "variable": "{{variables.[TeamCity Agent]}}" + }, + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "visualisation": { + "type": "data-stream-table", + "config": { + "data-stream-table": { + "transpose": true, + "columnOrder": [ + "name" + ], + "hiddenColumns": [ + "id", + "links", + "type", + "label", + "sourceId", + "sourceType", + "poolId" + ] + } + } + } + } + }, + { + "i": "f4f0fad4-91cc-49ac-828f-04117496f87c", + "x": 1, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Agent Status", + "description": "Healthy, or why not: disconnected, disabled, unauthorized or outdated", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[agents]}}", + "name": "agents", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + }, + "includeUnauthorized": true + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "statusGrid", + "encoding": { + "label": { + "field": "name", + "type": "nominal" + }, + "status": { + "field": "status", + "type": "nominal" + } + }, + "style": { + "statusGridColumnsPerRow": 1, + "statusGridLabelWrap": true + } + } + } + } + }, + { + "i": "d1f10c3e-b3dc-4f2d-8d82-d28a5e038161", + "x": 2, + "y": 0, + "w": 2, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Agent Details", + "description": "Connection, pool and environment", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[agents]}}", + "name": "agents", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + }, + "includeUnauthorized": true + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "connected", + "title": "Connected", + "renderer": { + "type": "boolean" + } + }, + { + "field": "enabled", + "title": "Enabled", + "renderer": { + "type": "boolean" + } + }, + { + "field": "authorized", + "title": "Authorized", + "renderer": { + "type": "boolean" + } + }, + { + "field": "uptodate", + "title": "Up to Date", + "renderer": { + "type": "boolean" + } + }, + { + "field": "pool.name", + "title": "Pool", + "renderer": { + "type": "text" + } + }, + { + "field": "environment.osName", + "title": "OS", + "renderer": { + "type": "text" + } + }, + { + "field": "ip", + "title": "IP Address", + "renderer": { + "type": "text" + } + }, + { + "field": "lastActivityTime", + "title": "Last Activity", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "enabledInfo.comment.text", + "title": "Disabled Reason", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableTranspose": true + } + } + } + } + }, + { + "i": "1f3bd2e7-418b-4a69-8ed3-4d1817a190ad", + "x": 1, + "y": 2, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Builds Run", + "description": "Builds this agent finished in the timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + } + } + }, + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "102cffe2-9440-4aca-a5d7-2366720a0ae9", + "x": 2, + "y": 2, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Success Rate", + "description": "Share of the builds this agent finished in the timeframe that succeeded", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + } + }, + "sql": "SELECT ROUND(CAST(COUNT(*) FILTER (WHERE \"status[Expanded].rawState\" = 'SUCCESS') AS DOUBLE) * 100 / NULLIF(COUNT(*), 0), 1) AS \"successRate\" FROM \"dataset\"" + }, + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "gauge", + "encoding": { + "value": { + "field": "successRate", + "type": "quantitative", + "title": "Success Rate" + } + }, + "style": { + "gaugeMin": 0, + "gaugeMax": 100, + "gaugeShowLabelText": false, + "labelFormat": "{{{{raw}}}}{{value}}%{{{{/raw}}}}", + "gaugeBands": [ + { + "to": 0.7, + "color": "#DE0038" + }, + { + "to": 0.9, + "color": "#E18700" + }, + { + "to": 1, + "color": "#259A51" + } + ] + } + } + } + } + }, + { + "i": "b7367771-65e8-4abd-948b-2cb952bd675e", + "x": 3, + "y": 2, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Average Duration", + "description": "Mean duration of the builds this agent finished in the timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + } + } + }, + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "duration", + "type": "quantitative", + "title": "Average Duration", + "aggregate": "avg" + } + ] + }, + "style": { + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "97082ad0-aa76-4a0d-8d4e-d7f22643a13a", + "x": 0, + "y": 4, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Current Build", + "description": "The build this agent is running now", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[runningBuilds]}}", + "name": "runningBuilds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + } + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "buildConfigurationName", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "number", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "running-info.currentStageText", + "title": "Current Stage", + "renderer": { + "type": "text" + } + }, + { + "field": "percentageComplete", + "title": "Progress", + "renderer": { + "type": "progress", + "max": 100 + } + }, + { + "field": "running-info.elapsedSeconds", + "title": "Elapsed", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "running-info.probablyHanging", + "title": "Probably Hanging", + "renderer": { + "type": "boolean", + "trueColor": "#DE0038" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + } + } + } + } + }, + { + "i": "2f941189-ba12-4105-9cab-855273a37bc9", + "x": 0, + "y": 7, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Builds per Day", + "description": "Builds this agent finished per day, by status", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + } + }, + "group": { + "by": [ + [ + "finishDate", + "byDay" + ], + [ + "status", + "uniqueValues" + ] + ], + "aggregate": [ + { + "type": "count" + } + ] + }, + "sort": { + "by": [ + [ + "finishDate_byDay", + "asc" + ] + ] + } + }, + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "finishDate_byDay", + "type": "temporal", + "title": "Day" + }, + "y": { + "field": "count", + "type": "quantitative", + "title": "Builds" + }, + "series": { + "field": "status_uniqueValues", + "type": "nominal", + "title": "Status" + } + }, + "style": { + "cartesianStack": "on", + "mappedColors": { + "success": "#259A51", + "error": "#DE0038", + "failure": "#DE0038", + "unknown": "#9CA3AF" + } + } + } + } + } + }, + { + "i": "7e2d574a-2bd7-4f7c-ba40-505f936aa139", + "x": 2, + "y": 7, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Builds by Build Configuration", + "description": "The build configurations this agent ran most in the timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + } + }, + "group": { + "by": [ + [ + "buildConfiguration", + "uniqueValues" + ] + ], + "aggregate": [ + { + "type": "count" + } + ] + }, + "sort": { + "by": [ + [ + "count", + "desc" + ] + ], + "top": 10 + } + }, + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "buildConfiguration_uniqueValues", + "type": "nominal", + "title": "Build Configuration" + }, + "y": { + "field": "count", + "type": "quantitative", + "title": "Builds" + } + }, + "style": { + "cartesianHorizontal": true + } + } + } + } + }, + { + "i": "f39e1cca-3cc5-4f6d-a9b0-2435d27afc32", + "x": 0, + "y": 10, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Recent Builds", + "description": "Builds this agent finished in the timeframe, most recent first", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "agent": { + "variable": "{{variables.[TeamCity Agent]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Agents]}}" + } + }, + "sort": { + "by": [ + [ + "finishDate", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[TeamCity Agent]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "buildConfiguration", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "number", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "statusText", + "title": "Status Text", + "renderer": { + "type": "text" + } + }, + { + "field": "finishDate", + "title": "Finished", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "duration", + "title": "Duration", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "triggered.user.username", + "title": "Triggered By", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableSort": { + "field": "finishDate", + "direction": "desc" + }, + "richTableRowHighlight": { + "field": "status", + "colors": { + "error": "rgba(222,0,56,0.12)" + } + } + } + } + } + } + } + ] + } +} diff --git a/plugins/TeamCity/v1/defaultContent/buildConfiguration.dash.json b/plugins/TeamCity/v1/defaultContent/buildConfiguration.dash.json new file mode 100644 index 00000000..eba9a216 --- /dev/null +++ b/plugins/TeamCity/v1/defaultContent/buildConfiguration.dash.json @@ -0,0 +1,1073 @@ +{ + "name": "Build Configuration", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "1ca41a4b-a4c9-462b-a820-12f1c2d97206", + "x": 0, + "y": 0, + "w": 1, + "h": 4, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build Configuration Properties", + "description": "Properties imported from TeamCity", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "none", + "dataStream": { + "id": "datastream-properties", + "name": "properties", + "pluginConfigId": "{{configId}}" + }, + "scope": { + "scope": "{{scopes.[TeamCity Build Configurations]}}", + "workspace": "{{workspaceId}}", + "variable": "{{variables.[TeamCity Build Configuration]}}" + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "visualisation": { + "type": "data-stream-table", + "config": { + "data-stream-table": { + "transpose": true, + "columnOrder": [ + "name" + ], + "hiddenColumns": [ + "id", + "links", + "type", + "label", + "sourceId", + "sourceType", + "projectId" + ] + } + } + } + } + }, + { + "i": "2d2eab59-d58d-42a9-a8a2-ba25c5244559", + "x": 1, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Last Build Status", + "description": "Status of the last finished build", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildConfigurationStatus]}}", + "name": "buildConfigurationStatus", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "statusGrid", + "encoding": { + "label": { + "field": "fullName", + "type": "nominal" + }, + "status": { + "field": "status", + "type": "nominal" + } + }, + "style": { + "statusGridPrimaryTemplate": "{{{{raw}}}}{{name}}{{{{/raw}}}}", + "statusGridSecondaryTemplate": "{{{{raw}}}}#{{lastBuildNumber}}{{{{/raw}}}}", + "statusGridColumnsPerRow": 1, + "statusGridLabelWrap": true + } + } + } + } + }, + { + "i": "b5161b5a-68df-4467-afb8-d51881c88832", + "x": 2, + "y": 0, + "w": 2, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Last Build", + "description": "Details of the last finished build", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildConfigurationStatus]}}", + "name": "buildConfigurationStatus", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "statusText", + "title": "Status Text", + "renderer": { + "type": "text" + } + }, + { + "field": "lastBuildNumber", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "lastBuildBranch", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "lastBuildFinished", + "title": "Finished", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "paused", + "title": "Paused", + "renderer": { + "type": "boolean" + } + }, + { + "field": "lastBuildUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableTranspose": true + } + } + } + } + }, + { + "i": "3e612b66-1d55-404e-ae7a-70514fcac115", + "x": 1, + "y": 2, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Success Rate", + "description": "Share of builds finished in the timeframe that succeeded", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + }, + "sql": "SELECT ROUND(CAST(COUNT(*) FILTER (WHERE \"status[Expanded].rawState\" = 'SUCCESS') AS DOUBLE) * 100 / NULLIF(COUNT(*), 0), 1) AS \"successRate\" FROM \"dataset\"" + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "gauge", + "encoding": { + "value": { + "field": "successRate", + "type": "quantitative", + "title": "Success Rate" + } + }, + "style": { + "gaugeMin": 0, + "gaugeMax": 100, + "gaugeShowLabelText": false, + "labelFormat": "{{{{raw}}}}{{value}}%{{{{/raw}}}}", + "gaugeBands": [ + { + "to": 0.7, + "color": "#DE0038" + }, + { + "to": 0.9, + "color": "#E18700" + }, + { + "to": 1, + "color": "#259A51" + } + ] + } + } + } + } + }, + { + "i": "1d6aacce-b821-46e8-a835-95239f7e8389", + "x": 2, + "y": 2, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Builds", + "description": "Builds finished in the timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + } + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "1ebc2cf0-3a22-4361-ab01-2db241be12db", + "x": 3, + "y": 2, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Average Duration", + "description": "Mean duration of builds finished in the timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + } + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "duration", + "type": "quantitative", + "title": "Average Duration", + "aggregate": "avg" + } + ] + }, + "style": { + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "76275687-fb01-49ce-9851-eac4ad93dda5", + "x": 0, + "y": 4, + "w": 4, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build History", + "description": "Outcome of finished builds over the timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + } + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "healthHistory", + "encoding": { + "time": { + "field": "finishDate", + "type": "temporal" + }, + "status": { + "field": "status", + "type": "nominal" + } + }, + "style": { + "historyUptimeLabel": "success" + } + } + } + } + }, + { + "i": "dcefd75d-2f4d-4ca0-a53b-084e18fadcc5", + "x": 0, + "y": 6, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Success Rate by Day", + "description": "Share of builds finished each day that succeeded", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + }, + "sql": "SELECT STRFTIME(DATE_TRUNC('day', \"finishDate\"), '%Y-%m-%dT%H:%M:%SZ') AS \"day\", ROUND(CAST(COUNT(*) FILTER (WHERE \"status[Expanded].rawState\" = 'SUCCESS') AS DOUBLE) * 100 / COUNT(*), 1) AS \"successRate\" FROM \"dataset\" WHERE \"finishDate\" IS NOT NULL GROUP BY 1 ORDER BY 1" + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "line", + "encoding": { + "x": { + "field": "day", + "type": "temporal", + "title": "Day" + }, + "y": { + "field": "successRate", + "type": "quantitative", + "title": "Success Rate" + } + }, + "style": { + "cartesianYAxisRangeMode": "percentage", + "cartesianTooltipTemplate": "{{{{raw}}}}{{value}}%{{{{/raw}}}}" + } + } + } + } + }, + { + "i": "df31c269-1dc2-4d3b-bd12-6cfd48319bd4", + "x": 2, + "y": 6, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build Duration", + "description": "Duration of each build finished in the timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + }, + "sort": { + "by": [ + [ + "finishDate", + "asc" + ] + ] + } + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "line", + "encoding": { + "x": { + "field": "finishDate", + "type": "temporal", + "title": "Finished" + }, + "y": [ + { + "field": "duration", + "type": "quantitative", + "title": "Duration" + }, + { + "field": "queueTime", + "type": "quantitative", + "title": "Queue Time" + } + ] + }, + "style": { + "legendPosition": "bottom" + } + } + } + } + }, + { + "i": "f2e8c688-086d-48fd-8589-96563774495b", + "x": 0, + "y": 9, + "w": 1, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Test Results", + "description": "Tests run by the last finished build, by status", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[testOccurrences]}}", + "name": "testOccurrences", + "pluginConfigId": "{{configId}}", + "group": { + "by": [ + [ + "status", + "uniqueValues" + ] + ], + "aggregate": [ + { + "type": "count" + } + ] + } + }, + "timeframe": "none", + "scope": { + "scope": "{{scopes.[TeamCity Build Configurations]}}", + "workspace": "{{workspaceId}}", + "variable": "{{variables.[TeamCity Build Configuration]}}" + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "pie", + "encoding": { + "label": { + "field": "status_uniqueValues", + "type": "nominal", + "title": "Status" + }, + "value": { + "field": "count", + "type": "quantitative", + "title": "Tests" + } + }, + "style": { + "pieInnerRadius": 60, + "pieDonutCenterValue": "total", + "labelFontSize": 16, + "mappedColors": { + "success": "#259A51", + "error": "#DE0038", + "failure": "#DE0038", + "unknown": "#9CA3AF" + } + } + } + } + } + }, + { + "i": "e3f1bb90-d5b8-45be-af57-83cdd47f74a8", + "x": 1, + "y": 9, + "w": 3, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Failed Tests", + "description": "Tests that failed in the last finished build", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[testOccurrences]}}", + "name": "testOccurrences", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "failedOnly": true + } + }, + "timeframe": "none", + "scope": { + "scope": "{{scopes.[TeamCity Build Configurations]}}", + "workspace": "{{workspaceId}}", + "variable": "{{variables.[TeamCity Build Configuration]}}" + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "name", + "title": "Test", + "renderer": { + "type": "text" + } + }, + { + "field": "newFailure", + "title": "New Failure", + "renderer": { + "type": "boolean" + } + }, + { + "field": "muted", + "title": "Muted", + "renderer": { + "type": "boolean" + } + }, + { + "field": "currentlyInvestigated", + "title": "Investigated", + "renderer": { + "type": "boolean" + } + }, + { + "field": "duration", + "title": "Duration", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "build.number", + "title": "Build", + "renderer": { + "type": "text" + } + } + ] + }, + "style": { + "richTableWrapText": true + } + } + } + } + }, + { + "i": "08974722-f1a3-4cd8-aff3-f8d2a99e69da", + "x": 0, + "y": 12, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Recent Builds", + "description": "Builds finished in the timeframe, most recent first", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + }, + "sort": { + "by": [ + [ + "finishDate", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "number", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "statusText", + "title": "Status Text", + "renderer": { + "type": "text" + } + }, + { + "field": "finishDate", + "title": "Finished", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "duration", + "title": "Duration", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "agent.name", + "title": "Agent", + "renderer": { + "type": "text" + } + }, + { + "field": "triggered.user.username", + "title": "Triggered By", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableSort": { + "field": "finishDate", + "direction": "desc" + }, + "richTableRowHighlight": { + "field": "status", + "colors": { + "error": "rgba(222,0,56,0.12)" + } + } + } + } + } + } + }, + { + "i": "a15b1213-9eb1-49f1-958b-c22e61e5046b", + "x": 0, + "y": 15, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Running Builds", + "description": "Builds of this configuration running now", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[runningBuilds]}}", + "name": "runningBuilds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "buildConfigurationName", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "number", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "running-info.currentStageText", + "title": "Current Stage", + "renderer": { + "type": "text" + } + }, + { + "field": "percentageComplete", + "title": "Progress", + "renderer": { + "type": "progress", + "max": 100 + } + }, + { + "field": "running-info.elapsedSeconds", + "title": "Elapsed", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "running-info.probablyHanging", + "title": "Probably Hanging", + "renderer": { + "type": "boolean", + "trueColor": "#DE0038" + } + }, + { + "field": "agent.name", + "title": "Agent", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + } + } + } + } + }, + { + "i": "c4b37fd3-9c5f-4f48-9303-116d44acdb71", + "x": 2, + "y": 15, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build Queue", + "description": "Queued builds of this configuration", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildQueue]}}", + "name": "buildQueue", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "buildConfiguration": { + "variable": "{{variables.[TeamCity Build Configuration]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Build Configurations]}}" + } + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Build Configuration]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "buildConfigurationName", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "queuedDate", + "title": "Queued", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "waitingSeconds", + "title": "Waiting", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "waitReason", + "title": "Wait Reason", + "renderer": { + "type": "text" + } + }, + { + "field": "triggered.user.username", + "title": "Triggered By", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableSort": { + "field": "waitingSeconds", + "direction": "desc" + } + } + } + } + } + } + ] + } +} diff --git a/plugins/TeamCity/v1/defaultContent/manifest.json b/plugins/TeamCity/v1/defaultContent/manifest.json new file mode 100644 index 00000000..a571cb06 --- /dev/null +++ b/plugins/TeamCity/v1/defaultContent/manifest.json @@ -0,0 +1,20 @@ +{ + "items": [ + { + "name": "overview", + "type": "dashboard" + }, + { + "name": "project", + "type": "dashboard" + }, + { + "name": "buildConfiguration", + "type": "dashboard" + }, + { + "name": "agent", + "type": "dashboard" + } + ] +} diff --git a/plugins/TeamCity/v1/defaultContent/overview.dash.json b/plugins/TeamCity/v1/defaultContent/overview.dash.json new file mode 100644 index 00000000..42689bb6 --- /dev/null +++ b/plugins/TeamCity/v1/defaultContent/overview.dash.json @@ -0,0 +1,1066 @@ +{ + "name": "Overview", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "77618656-3967-477f-ad30-fb344e0f1dd4", + "x": 0, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Builds", + "description": "Builds finished in the timeframe, excluding composite (pipeline head) builds", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "composite", + "operation": "equals", + "value": "false" + } + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "bebb42c9-bdfb-4f1a-8255-1e2807e4b3de", + "x": 1, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Success Rate", + "description": "Share of builds finished in the timeframe that succeeded, excluding composite (pipeline head) builds", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "sql": "SELECT ROUND(CAST(COUNT(*) FILTER (WHERE \"status[Expanded].rawState\" = 'SUCCESS') AS DOUBLE) * 100 / NULLIF(COUNT(*), 0), 1) AS \"successRate\" FROM \"dataset\" WHERE COALESCE(CAST(\"composite\" AS VARCHAR), 'false') <> 'true'" + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "gauge", + "encoding": { + "value": { + "field": "successRate", + "type": "quantitative", + "title": "Success Rate" + } + }, + "style": { + "gaugeMin": 0, + "gaugeMax": 100, + "gaugeShowLabelText": false, + "labelFormat": "{{{{raw}}}}{{value}}%{{{{/raw}}}}", + "gaugeBands": [ + { + "to": 0.7, + "color": "#DE0038" + }, + { + "to": 0.9, + "color": "#E18700" + }, + { + "to": 1, + "color": "#259A51" + } + ] + } + } + } + } + }, + { + "i": "053234cc-a25a-49bc-8ad8-1262c916c00e", + "x": 2, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Running Builds", + "description": "Builds running now", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[runningBuilds]}}", + "name": "runningBuilds", + "pluginConfigId": "{{configId}}" + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "02a882e9-0637-4cd7-9aee-452b6f7ebd62", + "x": 3, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Queued Builds", + "description": "Builds waiting in the queue now", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildQueue]}}", + "name": "buildQueue", + "pluginConfigId": "{{configId}}" + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "85015657-bf66-4e84-bf61-c87290d987ff", + "x": 0, + "y": 2, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build Configuration Health", + "description": "Status of the last finished build of each build configuration, grouped by project", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildConfigurationStatus]}}", + "name": "buildConfigurationStatus", + "pluginConfigId": "{{configId}}" + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "statusGrid", + "encoding": { + "label": { + "field": "fullName", + "type": "nominal" + }, + "status": { + "field": "status", + "type": "nominal" + }, + "group": { + "field": "projectName", + "type": "nominal" + } + }, + "style": { + "statusGridPrimaryTemplate": "{{{{raw}}}}{{name}}{{{{/raw}}}}", + "statusGridSecondaryTemplate": "{{{{raw}}}}#{{lastBuildNumber}}{{{{/raw}}}}", + "statusGridColumnsPerRow": 4, + "statusGridLabelWrap": true + } + } + } + } + }, + { + "i": "48ebb84c-4551-44a0-8316-30d0e6a42241", + "x": 0, + "y": 5, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Builds per Day", + "description": "Finished builds per day by status, excluding composite (pipeline head) builds", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "composite", + "operation": "equals", + "value": "false" + } + ] + }, + "group": { + "by": [ + [ + "finishDate", + "byDay" + ], + [ + "status", + "uniqueValues" + ] + ], + "aggregate": [ + { + "type": "count" + } + ] + }, + "sort": { + "by": [ + [ + "finishDate_byDay", + "asc" + ] + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "finishDate_byDay", + "type": "temporal", + "title": "Day" + }, + "y": { + "field": "count", + "type": "quantitative", + "title": "Builds" + }, + "series": { + "field": "status_uniqueValues", + "type": "nominal", + "title": "Status" + } + }, + "style": { + "cartesianStack": "on", + "mappedColors": { + "success": "#259A51", + "error": "#DE0038", + "failure": "#DE0038", + "unknown": "#9CA3AF" + } + } + } + } + } + }, + { + "i": "8ca2e192-ee5f-4258-9228-dac6993fc01e", + "x": 2, + "y": 5, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Average Build Duration", + "description": "Mean build duration and time spent queued per day, excluding composite (pipeline head) builds", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "composite", + "operation": "equals", + "value": "false" + } + ] + }, + "group": { + "by": [ + [ + "finishDate", + "byDay" + ] + ], + "aggregate": [ + { + "type": "mean", + "names": [ + "duration" + ] + }, + { + "type": "mean", + "names": [ + "queueTime" + ] + } + ] + }, + "sort": { + "by": [ + [ + "finishDate_byDay", + "asc" + ] + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "line", + "encoding": { + "x": { + "field": "finishDate_byDay", + "type": "temporal", + "title": "Day" + }, + "y": [ + { + "field": "duration_mean", + "type": "quantitative", + "title": "Build Duration" + }, + { + "field": "queueTime_mean", + "type": "quantitative", + "title": "Queue Time" + } + ] + }, + "style": { + "legendPosition": "bottom" + } + } + } + } + }, + { + "i": "3166f5a6-54d1-4a9d-9fc2-5ee862df778a", + "x": 0, + "y": 8, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build History", + "description": "Outcome of finished builds over the timeframe for each build configuration", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}" + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "healthHistory", + "encoding": { + "time": { + "field": "finishDate", + "type": "temporal" + }, + "status": { + "field": "status", + "type": "nominal" + }, + "label": { + "field": "buildConfiguration", + "type": "nominal" + } + }, + "style": { + "statusGridLabelWidth": 320, + "historyUptimeLabel": "success" + } + } + } + } + }, + { + "i": "aac5d0b2-f2a0-4731-bf83-64cb6df65f5b", + "x": 0, + "y": 11, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Recent Failed Builds", + "description": "Failed builds in the timeframe, most recent first", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "status", + "operation": "equals", + "value": "error" + } + ] + }, + "sort": { + "by": [ + [ + "finishDate", + "desc" + ] + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "buildConfiguration", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "number", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "statusText", + "title": "Status Text", + "renderer": { + "type": "text" + } + }, + { + "field": "finishDate", + "title": "Finished", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "duration", + "title": "Duration", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "agent.name", + "title": "Agent", + "renderer": { + "type": "text" + } + }, + { + "field": "triggered.user.username", + "title": "Triggered By", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableSort": { + "field": "finishDate", + "direction": "desc" + } + } + } + } + } + }, + { + "i": "f39b0e3a-2640-4f93-97d7-d2dc4aff4a1b", + "x": 0, + "y": 14, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Running Builds", + "description": "Builds running now, with progress", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[runningBuilds]}}", + "name": "runningBuilds", + "pluginConfigId": "{{configId}}" + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "buildConfigurationName", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "number", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "running-info.currentStageText", + "title": "Current Stage", + "renderer": { + "type": "text" + } + }, + { + "field": "percentageComplete", + "title": "Progress", + "renderer": { + "type": "progress", + "max": 100 + } + }, + { + "field": "running-info.elapsedSeconds", + "title": "Elapsed", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "running-info.probablyHanging", + "title": "Probably Hanging", + "renderer": { + "type": "boolean", + "trueColor": "#DE0038" + } + }, + { + "field": "agent.name", + "title": "Agent", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + } + } + } + } + }, + { + "i": "29739f69-fee4-488a-bc5c-f89ef4cafe63", + "x": 2, + "y": 14, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build Queue", + "description": "Queued builds and why they are waiting", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildQueue]}}", + "name": "buildQueue", + "pluginConfigId": "{{configId}}" + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "buildConfigurationName", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "queuedDate", + "title": "Queued", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "waitingSeconds", + "title": "Waiting", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "waitReason", + "title": "Wait Reason", + "renderer": { + "type": "text" + } + }, + { + "field": "triggered.user.username", + "title": "Triggered By", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableSort": { + "field": "waitingSeconds", + "direction": "desc" + } + } + } + } + } + }, + { + "i": "631b8802-6960-4c90-b276-b860a44811ad", + "x": 0, + "y": 17, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Connected Agents", + "description": "Authorized agents connected to the server now", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[agents]}}", + "name": "agents", + "pluginConfigId": "{{configId}}", + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "connected", + "operation": "equals", + "value": "true" + } + ] + } + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "aadf74cc-8773-4502-97c3-ad291f8e6c45", + "x": 1, + "y": 17, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Disconnected Agents", + "description": "Authorized agents not connected to the server", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[agents]}}", + "name": "agents", + "pluginConfigId": "{{configId}}", + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "connected", + "operation": "equals", + "value": "false" + } + ] + } + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "d81ad5d4-4e4e-4a59-aff5-ff33c5123032", + "x": 2, + "y": 17, + "w": 2, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "TeamCity Server", + "description": "Server version and when it last started", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[server]}}", + "name": "server", + "pluginConfigId": "{{configId}}" + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "version", + "title": "Version", + "renderer": { + "type": "text" + } + }, + { + "field": "buildNumber", + "title": "Build Number", + "renderer": { + "type": "text" + } + }, + { + "field": "startTime", + "title": "Started", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "role", + "title": "Node Role", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableTranspose": true + } + } + } + } + }, + { + "i": "2bdc2750-00bb-4750-ba72-8f898abd88a3", + "x": 0, + "y": 19, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Agents", + "description": "Authorized build agents and what they are running", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[agents]}}", + "name": "agents", + "pluginConfigId": "{{configId}}" + }, + "timeframe": "none", + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "name", + "title": "Agent", + "renderer": { + "type": "text" + } + }, + { + "field": "pool.name", + "title": "Pool", + "renderer": { + "type": "text" + } + }, + { + "field": "build.buildType.name", + "title": "Current Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "build.number", + "title": "Current Build", + "renderer": { + "type": "text" + } + }, + { + "field": "environment.osName", + "title": "OS", + "renderer": { + "type": "text" + } + }, + { + "field": "lastActivityTime", + "title": "Last Activity", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "enabledInfo.comment.text", + "title": "Disabled Reason", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableSort": { + "field": "name", + "direction": "asc" + } + } + } + } + } + } + ] + } +} diff --git a/plugins/TeamCity/v1/defaultContent/project.dash.json b/plugins/TeamCity/v1/defaultContent/project.dash.json new file mode 100644 index 00000000..272b10e4 --- /dev/null +++ b/plugins/TeamCity/v1/defaultContent/project.dash.json @@ -0,0 +1,914 @@ +{ + "name": "Project", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "65d96450-9517-4dd3-9aa6-b0b9babd9f1f", + "x": 0, + "y": 0, + "w": 1, + "h": 4, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Project Properties", + "description": "Properties imported from TeamCity", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "none", + "dataStream": { + "id": "datastream-properties", + "name": "properties", + "pluginConfigId": "{{configId}}" + }, + "scope": { + "scope": "{{scopes.[TeamCity Projects]}}", + "workspace": "{{workspaceId}}", + "variable": "{{variables.[TeamCity Project]}}" + }, + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "visualisation": { + "type": "data-stream-table", + "config": { + "data-stream-table": { + "transpose": true, + "columnOrder": [ + "name" + ], + "hiddenColumns": [ + "id", + "links", + "type", + "label", + "sourceId", + "sourceType", + "parentProjectId" + ] + } + } + } + } + }, + { + "i": "cd88094f-0113-455f-9473-f3f060d3365e", + "x": 1, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Builds", + "description": "Builds of this project finished in the timeframe, excluding composite (pipeline head) builds", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "composite", + "operation": "equals", + "value": "false" + } + ] + } + }, + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "becd4650-1cb6-49b7-bed4-c0d5c1f452af", + "x": 2, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Success Rate", + "description": "Share of this project's builds in the timeframe that succeeded, excluding composite (pipeline head) builds", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + }, + "sql": "SELECT ROUND(CAST(COUNT(*) FILTER (WHERE \"status[Expanded].rawState\" = 'SUCCESS') AS DOUBLE) * 100 / NULLIF(COUNT(*), 0), 1) AS \"successRate\" FROM \"dataset\" WHERE COALESCE(CAST(\"composite\" AS VARCHAR), 'false') <> 'true'" + }, + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "gauge", + "encoding": { + "value": { + "field": "successRate", + "type": "quantitative", + "title": "Success Rate" + } + }, + "style": { + "gaugeMin": 0, + "gaugeMax": 100, + "gaugeShowLabelText": false, + "labelFormat": "{{{{raw}}}}{{value}}%{{{{/raw}}}}", + "gaugeBands": [ + { + "to": 0.7, + "color": "#DE0038" + }, + { + "to": 0.9, + "color": "#E18700" + }, + { + "to": 1, + "color": "#259A51" + } + ] + } + } + } + } + }, + { + "i": "5eba178a-0da7-4265-af49-a766caffd264", + "x": 3, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Failing Configurations", + "description": "Build configurations in this project whose last finished build failed", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildConfigurationStatus]}}", + "name": "buildConfigurationStatus", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "status", + "operation": "equals", + "value": "error" + } + ] + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [] + }, + "style": { + "scalarRowCount": true, + "scalarLabelPosition": "none" + } + } + } + } + }, + { + "i": "20710ff7-6b52-4067-9f15-17686d464fb6", + "x": 1, + "y": 2, + "w": 3, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build Configuration Health", + "description": "Status of the last finished build of each build configuration in this project", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildConfigurationStatus]}}", + "name": "buildConfigurationStatus", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "statusGrid", + "encoding": { + "label": { + "field": "fullName", + "type": "nominal" + }, + "status": { + "field": "status", + "type": "nominal" + } + }, + "style": { + "statusGridPrimaryTemplate": "{{{{raw}}}}{{name}}{{{{/raw}}}}", + "statusGridSecondaryTemplate": "{{{{raw}}}}#{{lastBuildNumber}}{{{{/raw}}}}", + "statusGridColumnsPerRow": 4, + "statusGridLabelWrap": true + } + } + } + } + }, + { + "i": "8238cc65-abb8-4056-b1d2-d57020595397", + "x": 0, + "y": 4, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Builds per Day", + "description": "Finished builds per day by status, excluding composite (pipeline head) builds", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "composite", + "operation": "equals", + "value": "false" + } + ] + }, + "group": { + "by": [ + [ + "finishDate", + "byDay" + ], + [ + "status", + "uniqueValues" + ] + ], + "aggregate": [ + { + "type": "count" + } + ] + }, + "sort": { + "by": [ + [ + "finishDate_byDay", + "asc" + ] + ] + } + }, + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "finishDate_byDay", + "type": "temporal", + "title": "Day" + }, + "y": { + "field": "count", + "type": "quantitative", + "title": "Builds" + }, + "series": { + "field": "status_uniqueValues", + "type": "nominal", + "title": "Status" + } + }, + "style": { + "cartesianStack": "on", + "mappedColors": { + "success": "#259A51", + "error": "#DE0038", + "failure": "#DE0038", + "unknown": "#9CA3AF" + } + } + } + } + } + }, + { + "i": "c48b4244-4ba3-4db8-b5cf-2236c4a07b77", + "x": 2, + "y": 4, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Average Build Duration", + "description": "Mean build duration and time spent queued per day, excluding composite (pipeline head) builds", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "composite", + "operation": "equals", + "value": "false" + } + ] + }, + "group": { + "by": [ + [ + "finishDate", + "byDay" + ] + ], + "aggregate": [ + { + "type": "mean", + "names": [ + "duration" + ] + }, + { + "type": "mean", + "names": [ + "queueTime" + ] + } + ] + }, + "sort": { + "by": [ + [ + "finishDate_byDay", + "asc" + ] + ] + } + }, + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "line", + "encoding": { + "x": { + "field": "finishDate_byDay", + "type": "temporal", + "title": "Day" + }, + "y": [ + { + "field": "duration_mean", + "type": "quantitative", + "title": "Build Duration" + }, + { + "field": "queueTime_mean", + "type": "quantitative", + "title": "Queue Time" + } + ] + }, + "style": { + "legendPosition": "bottom" + } + } + } + } + }, + { + "i": "2e043456-417e-400f-b31c-b3cdacc4d2a3", + "x": 0, + "y": 7, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build History", + "description": "Outcome of finished builds over the timeframe for each build configuration in this project", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + } + }, + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "healthHistory", + "encoding": { + "time": { + "field": "finishDate", + "type": "temporal" + }, + "status": { + "field": "status", + "type": "nominal" + }, + "label": { + "field": "buildConfiguration", + "type": "nominal" + } + }, + "style": { + "statusGridLabelWidth": 320, + "historyUptimeLabel": "success" + } + } + } + } + }, + { + "i": "67dee5be-10d9-41a6-b94b-5e8c3464b343", + "x": 0, + "y": 10, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Recent Builds", + "description": "Builds of this project finished in the timeframe, most recent first", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[builds]}}", + "name": "builds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + }, + "sort": { + "by": [ + [ + "finishDate", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "buildConfiguration", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "number", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "statusText", + "title": "Status Text", + "renderer": { + "type": "text" + } + }, + { + "field": "finishDate", + "title": "Finished", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "duration", + "title": "Duration", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "agent.name", + "title": "Agent", + "renderer": { + "type": "text" + } + }, + { + "field": "triggered.user.username", + "title": "Triggered By", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableSort": { + "field": "finishDate", + "direction": "desc" + }, + "richTableRowHighlight": { + "field": "status", + "colors": { + "error": "rgba(222,0,56,0.12)" + } + } + } + } + } + } + }, + { + "i": "33cc60f2-6a85-4759-8db0-e772fbf2ee96", + "x": 0, + "y": 13, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Running Builds", + "description": "Builds of this project running now", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[runningBuilds]}}", + "name": "runningBuilds", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "buildConfigurationName", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "number", + "title": "Build", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "status", + "title": "Status", + "renderer": { + "type": "status" + } + }, + { + "field": "running-info.currentStageText", + "title": "Current Stage", + "renderer": { + "type": "text" + } + }, + { + "field": "percentageComplete", + "title": "Progress", + "renderer": { + "type": "progress", + "max": 100 + } + }, + { + "field": "running-info.elapsedSeconds", + "title": "Elapsed", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "running-info.probablyHanging", + "title": "Probably Hanging", + "renderer": { + "type": "boolean", + "trueColor": "#DE0038" + } + }, + { + "field": "agent.name", + "title": "Agent", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + } + } + } + } + }, + { + "i": "73701c49-106e-4286-9152-275f8058a6be", + "x": 2, + "y": 13, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Build Queue", + "description": "Queued builds of this project", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[buildQueue]}}", + "name": "buildQueue", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "project": { + "variable": "{{variables.[TeamCity Project]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[TeamCity Projects]}}" + } + } + }, + "timeframe": "none", + "variables": [ + "{{variables.[TeamCity Project]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "buildConfigurationName", + "title": "Build Configuration", + "renderer": { + "type": "text" + } + }, + { + "field": "branchName", + "title": "Branch", + "renderer": { + "type": "text" + } + }, + { + "field": "queuedDate", + "title": "Queued", + "renderer": { + "type": "date", + "relative": true + } + }, + { + "field": "waitingSeconds", + "title": "Waiting", + "renderer": { + "type": "number" + }, + "align": "right" + }, + { + "field": "waitReason", + "title": "Wait Reason", + "renderer": { + "type": "text" + } + }, + { + "field": "triggered.user.username", + "title": "Triggered By", + "renderer": { + "type": "text" + } + }, + { + "field": "webUrl", + "title": "Link", + "renderer": { + "type": "link" + } + } + ] + }, + "style": { + "richTableSort": { + "field": "waitingSeconds", + "direction": "desc" + } + } + } + } + } + } + ] + } +} diff --git a/plugins/TeamCity/v1/defaultContent/scopes.json b/plugins/TeamCity/v1/defaultContent/scopes.json new file mode 100644 index 00000000..d9b62fa7 --- /dev/null +++ b/plugins/TeamCity/v1/defaultContent/scopes.json @@ -0,0 +1,53 @@ +[ + { + "name": "TeamCity Projects", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Project" + ] + } + }, + "variable": { + "name": "TeamCity Project", + "allowMultipleSelection": false, + "default": "none", + "type": "object" + } + }, + { + "name": "TeamCity Build Configurations", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Build Configuration" + ] + } + }, + "variable": { + "name": "TeamCity Build Configuration", + "allowMultipleSelection": false, + "default": "none", + "type": "object" + } + }, + { + "name": "TeamCity Agents", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Agent" + ] + } + }, + "variable": { + "name": "TeamCity Agent", + "allowMultipleSelection": false, + "default": "none", + "type": "object" + } + } +] diff --git a/plugins/TeamCity/v1/docs/README.md b/plugins/TeamCity/v1/docs/README.md new file mode 100644 index 00000000..9f534569 --- /dev/null +++ b/plugins/TeamCity/v1/docs/README.md @@ -0,0 +1,61 @@ +Monitor build health, success rates, durations, the build queue and build agents across your [TeamCity](https://www.jetbrains.com/teamcity/) projects in SquaredUp, using the [TeamCity REST API](https://www.jetbrains.com/help/teamcity/rest/teamcity-rest-api-documentation.html). Works with TeamCity Cloud and self-hosted TeamCity servers. + +> ⚠️ SquaredUp's cloud can only reach a TeamCity server with a public address. If your server is on a private network, add this data source through a [relay agent](https://docs.squaredup.com/features/connect-and-explore/relay-agents) installed somewhere that can reach it. + +## Setup + +You need the address of your TeamCity server and an **access token** for a user who can view the projects you want to monitor. + +1. Sign in to TeamCity with the user the data source should connect as. The data source only reads, so a user with the **Project viewer** role on the projects you want to monitor is enough for projects, build configurations, builds, the build queue and tests. **Project viewer** can't see build agents, though. To monitor agents, the user also needs the **View agent details** permission. Rather than giving the user a role that can run builds, such as **Project developer**, an administrator can add **View agent details** to a role under **Administration → Roles**. See [Roles and permissions](https://www.jetbrains.com/help/teamcity/managing-roles-and-permissions.html). Without it, agent data isn't available and the optional agent import step is skipped. +2. Click your avatar in the top-right corner, choose **Profile**, then open **Access Tokens**. +3. Click **Create access token**, give it a name such as `SquaredUp`, choose an expiration date, and leave the permission scope as **Same as current user**. See [Manage access tokens](https://www.jetbrains.com/help/teamcity/managing-your-user-account.html#Managing+Access+Tokens). +4. Copy the token. TeamCity only shows it once. +5. In SquaredUp, paste the token into the **Access token** field and enter the address you use to open TeamCity in a browser in the **Server URL** field. + +## Configuration fields + +| Field | What it is | Where to find it | Required | +| --- | --- | --- | --- | +| **Server URL** | The address of your TeamCity server, for example `https://example.teamcity.com` for TeamCity Cloud or `https://ci.example.com/teamcity` for a self-hosted server. Include any context path, but not `/app/rest`. | The address bar of your browser when TeamCity is open. | Yes | +| **Access token** | Authenticates every request as the user that created it. | TeamCity → **Profile** → **Access Tokens**. | Yes | + +When you save, SquaredUp checks it can reach the server and read its version with the access token. If this fails, check the server URL is reachable from SquaredUp (or from your relay agent) and that the token is valid and has not expired. + +## What this plugin monitors + +- **Build configuration health**: the status of the latest finished build of every build configuration on its default branch, and whether the configuration is paused. +- **Build history**: every finished build in a timeframe, with status, branch, duration, queue time, who or what triggered it and the agent it ran on. Use it for success rates, build volume and duration trends. +- **Work in progress**: builds running now, with progress and elapsed time, and builds waiting in the queue with the reason they are waiting. +- **Tests**: the tests run by the latest finished build of a build configuration, including new failures, muted and ignored tests. +- **Build agents**: whether each agent is connected, enabled, authorized and up to date, what it is building, its pool and its operating system. + +The out-of-the-box dashboards include an **Overview** of the whole server, plus a perspective for each **Project**, **Build Configuration** and **Agent**. + +## Data streams + +- **Build Configuration Status**: one row per build configuration, with the status of its latest finished build. Server-wide, or filtered to selected projects or build configurations. +- **Builds**: one row per finished build in the timeframe, excluding cancelled builds. Server-wide, or filtered to selected projects, build configurations or agents. +- **Running Builds**: builds running now, with percentage complete and elapsed time. Server-wide, or filtered to selected projects, build configurations or agents. +- **Build Queue**: queued builds, how long they have waited and why. Server-wide, or filtered to selected projects or build configurations. +- **Agents**: the current status of authorized build agents, optionally including unauthorized agents. Server-wide, or filtered to selected agents. +- **Test Results**: the tests from the latest finished build of a build configuration, optionally failed tests only. Per build configuration. +- **Server**: the TeamCity version, build number and start time. + +## What gets indexed + +| Object type | API source | Represents | +| --- | --- | --- | +| **Project** | `/app/rest/projects` | A TeamCity project or subproject. Named with its full project path, e.g. `Backend / Services / API`. | +| **Build Configuration** | `/app/rest/buildTypes` | A build configuration. Named with its full project path, e.g. `Backend / Services / Build`. | +| **Agent** | `/app/rest/agents` | An authorized build agent, connected or not. | + +Objects are imported every 12 hours. Build results, the queue and agent status are always read live, so they are not affected by the import schedule. + +## Known limitations + +- **Ephemeral cloud agents are not imported.** TeamCity removes JetBrains-hosted and cloud-profile agents from its agent list once they stop, so only persistent agents, such as self-hosted agents, appear as **Agent** objects. Builds still show the name of the agent they ran on. +- **Deleted objects fail until the next import.** If a tile is filtered to a build configuration or agent that has since been deleted from TeamCity, TeamCity rejects the request and the tile shows an error until the next import removes the object. +- **Renaming an ID creates a new object.** Projects and build configurations are identified by their TeamCity ID. Changing the ID in TeamCity creates a new object on the next import, and dashboards using the old one need updating. +- **Large timeframes on busy servers.** The **Builds** stream returns one row per build. On a server that runs many thousands of builds a day, a long timeframe can exceed SquaredUp's response size limit; filter to a project or shorten the timeframe. +- **Default branch only for health.** **Build Configuration Status** and **Test Results** use the latest finished build on the default branch, excluding personal and cancelled builds. **Builds** includes all branches. +- **Pipelines** appear as a set of auto-generated build configurations plus a composite "Pipeline Head" build configuration. The out-of-the-box success rate and duration tiles on the **Overview** and **Project** dashboards leave out composite builds so a pipeline failure is not counted twice. diff --git a/plugins/TeamCity/v1/icon.svg b/plugins/TeamCity/v1/icon.svg new file mode 100644 index 00000000..61e03ab7 --- /dev/null +++ b/plugins/TeamCity/v1/icon.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/plugins/TeamCity/v1/indexDefinitions/default.json b/plugins/TeamCity/v1/indexDefinitions/default.json new file mode 100644 index 00000000..841123b4 --- /dev/null +++ b/plugins/TeamCity/v1/indexDefinitions/default.json @@ -0,0 +1,82 @@ +{ + "steps": [ + { + "name": "projects", + "dataStream": { + "name": "projects" + }, + "timeframe": "none", + "objectMapping": { + "id": "id", + "name": "fullName", + "type": { + "value": "Project" + }, + "properties": [ + { + "shortName": "name" + }, + "parentProjectId", + "parentProjectName", + "archived", + "webUrl" + ] + } + }, + { + "name": "buildTypes", + "dataStream": { + "name": "buildTypes" + }, + "timeframe": "none", + "objectMapping": { + "id": "id", + "name": "fullName", + "type": { + "value": "Build Configuration" + }, + "properties": [ + { + "shortName": "name" + }, + "projectId", + "projectName", + "paused", + "webUrl" + ] + } + }, + { + "name": "agents", + "dataStream": { + "name": "agentList" + }, + "timeframe": "none", + "objectMapping": { + "id": "id", + "name": "name", + "type": { + "value": "Agent" + }, + "properties": [ + { + "poolName": "pool.name" + }, + { + "poolId": "pool.id" + }, + { + "ipAddress": "ip" + }, + { + "osType": "environment.osType" + }, + { + "osName": "environment.osName" + } + ] + }, + "optional": true + } + ] +} diff --git a/plugins/TeamCity/v1/metadata.json b/plugins/TeamCity/v1/metadata.json new file mode 100644 index 00000000..c46a8553 --- /dev/null +++ b/plugins/TeamCity/v1/metadata.json @@ -0,0 +1,70 @@ +{ + "name": "teamcity", + "displayName": "TeamCity", + "version": "1.0.0", + "author": { + "name": "SquaredUp Labs", + "type": "labs" + }, + "description": "Track build health, success rates, durations, queues and build agents across your TeamCity projects.", + "category": "CI/CD Tools", + "type": "hybrid", + "schemaVersion": "2.1", + "importNotSupported": false, + "restrictedToPlatforms": [], + "keywords": [ + "teamcity", + "jetbrains", + "build", + "ci", + "continuous integration", + "cicd", + "devops", + "build configuration", + "build agent", + "build queue", + "tests" + ], + "objectTypes": [ + "Project", + "Build Configuration", + "Agent" + ], + "links": [ + { + "category": "documentation", + "url": "https://github.com/squaredup/plugins/blob/main/plugins/TeamCity/v1/docs/README.md", + "label": "Help adding this plugin" + }, + { + "category": "source", + "url": "https://github.com/squaredup/plugins/tree/main/plugins/TeamCity/v1", + "label": "Repository" + } + ], + "base": { + "plugin": "WebAPI", + "majorVersion": "1", + "config": { + "baseUrl": "{{ serverUrl.trim().replace(/[/]+$/, '').replace(/[/]app[/]rest$/i, '') }}/app/rest", + "authMode": "none", + "headers": [ + { + "key": "Authorization", + "value": "Bearer {{ accessToken.trim() }}" + }, + { + "key": "Accept", + "value": "application/json" + } + ], + "queryArgs": [] + } + }, + "screenshots": [ + "https://github.com/squaredup/plugins/blob/main/plugins/TeamCity/v1/screenshots/overview.png", + "https://github.com/squaredup/plugins/blob/main/plugins/TeamCity/v1/screenshots/project.png", + "https://github.com/squaredup/plugins/blob/main/plugins/TeamCity/v1/screenshots/buildConfiguration.png", + "https://github.com/squaredup/plugins/blob/main/plugins/TeamCity/v1/screenshots/agent.png" + ] +} diff --git a/plugins/TeamCity/v1/screenshots/agent.png b/plugins/TeamCity/v1/screenshots/agent.png new file mode 100644 index 00000000..2b32ff64 Binary files /dev/null and b/plugins/TeamCity/v1/screenshots/agent.png differ diff --git a/plugins/TeamCity/v1/screenshots/buildConfiguration.png b/plugins/TeamCity/v1/screenshots/buildConfiguration.png new file mode 100644 index 00000000..4f167055 Binary files /dev/null and b/plugins/TeamCity/v1/screenshots/buildConfiguration.png differ diff --git a/plugins/TeamCity/v1/screenshots/overview.png b/plugins/TeamCity/v1/screenshots/overview.png new file mode 100644 index 00000000..bfaacc1b Binary files /dev/null and b/plugins/TeamCity/v1/screenshots/overview.png differ diff --git a/plugins/TeamCity/v1/screenshots/project.png b/plugins/TeamCity/v1/screenshots/project.png new file mode 100644 index 00000000..e5fbb6ef Binary files /dev/null and b/plugins/TeamCity/v1/screenshots/project.png differ diff --git a/plugins/TeamCity/v1/ui.json b/plugins/TeamCity/v1/ui.json new file mode 100644 index 00000000..5074ec5a --- /dev/null +++ b/plugins/TeamCity/v1/ui.json @@ -0,0 +1,26 @@ +[ + { + "type": "text", + "name": "serverUrl", + "label": "Server URL", + "placeholder": "https://example.teamcity.com", + "help": "The address used to open TeamCity in a browser, for TeamCity Cloud or a self-hosted TeamCity server, including any context path such as `/teamcity`", + "validation": { + "required": true, + "pattern": { + "value": "^https?://[^ ]+$", + "message": "Enter the full address of the TeamCity server, e.g. https://example.teamcity.com" + } + } + }, + { + "type": "password", + "name": "accessToken", + "label": "Access token", + "placeholder": "eyJ0eXAiOiAiVENWMiJ9...", + "help": "Create an access token in TeamCity under **Profile > Access Tokens**. See [Manage access tokens](https://www.jetbrains.com/help/teamcity/managing-your-user-account.html#Managing+Access+Tokens)", + "validation": { + "required": true + } + } +]