Skip to content

Commit 7e5195d

Browse files
committed
Add BuildTracker
1 parent 42e1fca commit 7e5195d

14 files changed

+214
-5
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [1.3.0] - 2020-03-27
11+
### Added
12+
- Build Tracker server
13+
- Bump dependencies (lhci, sitespeed.io)
14+
1015
## [1.2.0] - 2020-03-20
1116
### Added
1217
- Bump all dependecies to latest versions

README.md

+19-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Framework consists of next services:
1111
- **Sitespeed.io**: set of tools for frontend load testing
1212
- **Webpagetest**: private instance of webpagetest server for frontend tests execution
1313
- **K6**: tool for backend load testing
14+
- **Build Tracker** tool for monitoring asset sizes and performance budgets
1415
- **Grafana**: data visualization & monitoring
1516
- **Graphite**: time series DB platform for metrics
1617
- **InfluxDB**: time series DB optimized for fast storage and retrieval of time series data
@@ -69,11 +70,12 @@ All containers should be up and running
6970

7071
### Services endpoints
7172

72-
- **jenkins** localhost:8181
73-
- **LHCI** localhost:9001
74-
- **webpagetest server** localhost:4000
75-
- **grafana** localhost:3000
76-
- **portainer** localhost:9000
73+
- **jenkins** [localhost:8181](http://localhost:8181/)
74+
- **LHCI** [localhost:9001](http://localhost:9001/)
75+
- **webpagetest server** [localhost:4000](http://localhost:4000/)
76+
- **build tracker server** [localhost:9002](http://localhost:9002/)
77+
- **grafana** [localhost:3000](http://localhost:3000/)
78+
- **portainer** [localhost:9000](http://localhost:9000/)
7779

7880
### How to stop
7981

@@ -131,6 +133,18 @@ The results will be saved on the associated k6 reports folder and also pushed to
131133

132134
*To add this dashboard follow the instructions [here](https://k6.io/docs/results-visualization/influxdb-+-grafana).*
133135

136+
## Build Tracker
137+
138+
*Track performance budgets & prevent unexpected bloat.*
139+
140+
![](docs/img/build-tracker-example.png)
141+
142+
The docker compose services contains the build tracker server that can be used to send build artifacts from the build tracker CLI and monitor.
143+
144+
Once the service is running access [localhost:9002](http://localhost:9002) to see the dashboard.
145+
146+
In order to send build artifacts follow the instructions on the [docs site](https://buildtracker.dev/docs/packages/cli). You can also find an example in the test folder for build tracker in this repo.
147+
134148
## Grafana
135149

136150
### Available metrics

buildtracker/Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM node:12
2+
3+
WORKDIR /usr/src/buildtracker
4+
COPY package.json .
5+
COPY build-tracker.config.js .
6+
RUN npm install
7+
8+
EXPOSE 9002
9+
CMD [ "npm", "start" ]

buildtracker/build-tracker.config.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const withPostgres = require('@build-tracker/plugin-with-postgres').default;
2+
3+
module.exports = withPostgres({
4+
url: 'http://127.0.0.1:9002',
5+
pg: {
6+
user: 'myuser',
7+
password: 'mypassword',
8+
host: 'postgres', // This is the docker-componse container name for postgres https://docs.docker.com/compose/networking/
9+
database: 'postgres'
10+
}
11+
});

buildtracker/package.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "buildtracker",
3+
"version": "0.0.0",
4+
"scripts": {
5+
"start": "bt-server setup && bt-server run"
6+
},
7+
"dependencies": {
8+
"@build-tracker/server": "1.0.0-beta.14",
9+
"@build-tracker/plugin-with-postgres": "latest"
10+
}
11+
}

docker-compose.yml

+17
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ services:
4040
shm_size: 2g
4141
volumes:
4242
- ./reports/sitespeed-result/:/sitespeed.io/sitespeed-result
43+
buildtracker:
44+
container_name: buildtracker
45+
build: ./buildtracker
46+
depends_on:
47+
- postgres
48+
ports:
49+
- "9002:3000"
50+
restart: unless-stopped
4351
lhci-server:
4452
container_name: lhci-server
4553
build: ./lhci-server
@@ -119,6 +127,14 @@ services:
119127
environment:
120128
- INFLUXDB_DB=k6
121129
restart: unless-stopped
130+
postgres:
131+
container_name: postgres
132+
image: postgres:12-alpine
133+
environment:
134+
- POSTGRES_USER=myuser
135+
- POSTGRES_PASSWORD=mypassword
136+
ports:
137+
- "5432:5432"
122138
jenkins:
123139
container_name: jenkins
124140
# image: jenkins/jenkins:lts
@@ -169,5 +185,6 @@ volumes:
169185
# grafana-home:
170186
# grafana-conf:
171187
influxdb:
188+
postgres:
172189
grafana:
173190
jenkins-home:

docs/img/build-tracker-example.png

230 KB
Loading

docs/img/framework-architecture.png

118 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
applicationUrl: "http://127.0.0.1:9002", // The same as your server config `url`
3+
artifacts: ["dist-v1/**/*.js"] // an Array of glob-style file paths
4+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import baseClone from './.internal/baseClone.js'
2+
3+
/** Used to compose bitmasks for cloning. */
4+
const CLONE_DEEP_FLAG = 1
5+
const CLONE_SYMBOLS_FLAG = 4
6+
7+
/**
8+
* This method is like `cloneWith` except that it recursively clones `value`.
9+
* The customizer is invoked with up to four arguments
10+
* (value [, index|key, object, stack]).
11+
*
12+
* @since 4.0.0
13+
* @category Lang
14+
* @param {*} value The value to recursively clone.
15+
* @param {Function} [customizer] The function to customize cloning.
16+
* @returns {*} Returns the deep cloned value.
17+
* @see cloneWith
18+
* @example
19+
*
20+
* function customizer(value) {
21+
* if (isElement(value)) {
22+
* return value.cloneNode(true)
23+
* }
24+
* }
25+
*
26+
* const el = cloneDeepWith(document.body, customizer)
27+
*
28+
* console.log(el === document.body)
29+
* // => false
30+
* console.log(el.nodeName)
31+
* // => 'BODY'
32+
* console.log(el.childNodes.length)
33+
* // => 20
34+
*/
35+
function cloneDeepWith(value, customizer) {
36+
customizer = typeof customizer === 'function' ? customizer : undefined
37+
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer)
38+
}
39+
40+
export default cloneDeepWith
41+
// test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import baseClone from './.internal/baseClone.js'
2+
3+
/** Used to compose bitmasks for cloning. */
4+
const CLONE_DEEP_FLAG = 1
5+
const CLONE_SYMBOLS_FLAG = 4
6+
7+
/**
8+
* This method is like `cloneWith` except that it recursively clones `value`.
9+
* The customizer is invoked with up to four arguments
10+
* (value [, index|key, object, stack]).
11+
*
12+
* @since 4.0.0
13+
* @category Lang
14+
* @param {*} value The value to recursively clone.
15+
* @param {Function} [customizer] The function to customize cloning.
16+
* @returns {*} Returns the deep cloned value.
17+
* @see cloneWith
18+
* @example
19+
*
20+
* function customizer(value) {
21+
* if (isElement(value)) {
22+
* return value.cloneNode(true)
23+
* }
24+
* }
25+
*
26+
* const el = cloneDeepWith(document.body, customizer)
27+
*
28+
* console.log(el === document.body)
29+
* // => false
30+
* console.log(el.nodeName)
31+
* // => 'BODY'
32+
* console.log(el.childNodes.length)
33+
* // => 20
34+
*/
35+
function cloneDeepWith(value, customizer) {
36+
customizer = typeof customizer === 'function' ? customizer : undefined
37+
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer)
38+
}
39+
40+
export default cloneDeepWith
41+
// test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import baseClone from './.internal/baseClone.js'
2+
3+
/** Used to compose bitmasks for cloning. */
4+
const CLONE_DEEP_FLAG = 1
5+
const CLONE_SYMBOLS_FLAG = 4
6+
7+
/**
8+
* This method is like `cloneWith` except that it recursively clones `value`.
9+
* The customizer is invoked with up to four arguments
10+
* (value [, index|key, object, stack]).
11+
*
12+
* @since 4.0.0
13+
* @category Lang
14+
* @param {*} value The value to recursively clone.
15+
* @param {Function} [customizer] The function to customize cloning.
16+
* @returns {*} Returns the deep cloned value.
17+
* @see cloneWith
18+
* @example
19+
*
20+
* function customizer(value) {
21+
* if (isElement(value)) {
22+
* return value.cloneNode(true)
23+
* }
24+
* }
25+
*
26+
* const el = cloneDeepWith(document.body, customizer)
27+
*
28+
* console.log(el === document.body)
29+
* // => false
30+
* console.log(el.nodeName)
31+
* // => 'BODY'
32+
* console.log(el.childNodes.length)
33+
* // => 20
34+
*/
35+
function cloneDeepWith(value, customizer) {
36+
customizer = typeof customizer === 'function' ? customizer : undefined
37+
return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer)
38+
}
39+
40+
export default cloneDeepWith
41+
// test
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "test-project",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"buildtracker": "bt-cli upload-build -b master --parent-revision d02af1e --skip-dirty-check"
8+
},
9+
"author": "",
10+
"license": "ISC",
11+
"dependencies": {
12+
"@build-tracker/cli": "^1.0.0-beta.14"
13+
}
14+
}

0 commit comments

Comments
 (0)