Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 5 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

`pipebuilder` is a CI for [`pipebase`] apps

[Examples] | [Development]

## Overview
`pipebulder` is composed of five main components
* **api**: exposes the `pipebuilder` restful api.
Expand All @@ -19,47 +21,6 @@
* **scheduler**: watch builders and assign build request.
* **pbctl**: command-line tool allows you to run commands against `pipebuilder` api

## Install Tools
install [`cargo`]
```sh
curl https://sh.rustup.rs -sSf | sh
```
install `pbctl`
```sh
cargo install pipebuilder --bin pbctl
```
## Quick Start
setup CI
```sh
docker-compose -f examples/docker-compose.yml up -d
```
create namespace
```sh
pbctl create namespace -i dev
```
create project in namespace
```sh
pbctl create project -n dev -i timer
```
push app manifest
```sh
pbctl push manifest -n dev -i timer -f examples/timer/pipe.yml
```
build app
```sh
pbctl create build -n dev -i timer -v 0 -t x86_64-apple-darwin
```
check build status till build succeed
```sh
pbctl list build -n dev
```
pull app binary and run
```
cd examples/timer && \
pbctl pull app -n dev -i timer -v 0 && \
chmod +x app && \
./app
```

[`cargo`]: https://doc.rust-lang.org/cargo/
[`pipebase`]: https://github.com/pipebase/pipebase/tree/main/pipebase
[`pipebase`]: https://github.com/pipebase/pipebase/tree/main/pipebase
[Examples]: https://github.com/pipebase/pipebuider/tree/main/examples
[Development]: https://github.com/pipebase/pipebuider/tree/main/e2e
26 changes: 26 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,29 @@ run `repository`, `builder`, `scheduler`, `api` services
# at project root
RUST_LOG=info PIPEBUILDER_CONFIG_FILE=e2e/resources/SERVICE.yml cargo run --bin SERVICE
```
## Run test
go to test directory
```sh
cd e2e/tests/A_TEST_PROJECT
```
create namespace, project, manifest
```sh
pbctl create namespace -i dev && \
pbctl create project -n dev -i A_TEST_PROJECT && \
pbctl push manifest -n dev -i A_TEST_PROJECT -f pipe.yml
```
trigger build
```sh
pbctl create build -n dev -i A_TEST_PROJECT -v MANIFEST_VERSION && \
```
wait for build succeed
```
pbctl list build -n dev
```
download and run application
```
cd tests/A_TEST_PROJECT && \
pbctl pull -n dev -i A_TEST_PROJECT -v BUILD_VERSION && \
chmod +x app && \
./app
```
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Examples for pipebuilder demo

## Install Tools
install [`cargo`]
```sh
curl https://sh.rustup.rs -sSf | sh
```
install `pbctl`
```sh
cargo install pipebuilder --bin pbctl
```
## Quick Start
clone git repository and setup CI
```sh
docker-compose -f examples/ci.yml up -d
```
create namespace, project, manifest
```sh
pbctl create namespace -i dev && \
pbctl create project -n dev -i timer && \
pbctl push manifest -n dev -i timer -f examples/timer/pipe.yml
```
trigger build
```sh
pbctl create build -n dev -i timer -v 0 -t x86_64-unknown-linux-gnu
```
wait for build succeed
```sh
pbctl list build -n dev
```
download and run application
```
cd examples/timer && \
pbctl pull app -n dev -i timer -v 0 && \
chmod +x app && \
./app
```

[`cargo`]: https://doc.rust-lang.org/cargo/
72 changes: 72 additions & 0 deletions examples/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
version: '3.9'

services:
# https://etcd.io/docs/v3.5/op-guide/container/
etcd1:
container_name: etcd1
image: gcr.io/etcd-development/etcd
ports:
- 2379:2379
- 2380:2380
command: ["sh", "-c", "/usr/local/bin/etcd --data-dir=/etcd-data --name etcd1 --initial-advertise-peer-urls http://etcd1:2380 --listen-peer-urls http://0.0.0.0:2380 --advertise-client-urls http://etcd1:2379 --listen-client-urls http://0.0.0.0:2379 --initial-cluster etcd1=http://etcd1:2380"]
repository0:
container_name: repository0
image: pipebase/pipebuilder-repository:0.1.4
environment:
- RUST_LOG=info
ports:
- 17000:17000
volumes:
- ./resources/repository.yml:/opt/repository/repository.yml
depends_on:
- etcd1
scheduler0:
container_name: scheduler0
image: pipebase/pipebuilder-scheduler:0.1.4
environment:
- RUST_LOG=info
ports:
- 18000:18000
volumes:
- ./resources/scheduler.yml:/opt/scheduler/scheduler.yml
depends_on:
- etcd1
builder0:
container_name: builder0
image: pipebase/pipebuilder-builder:x86_64-linux_0.1.4
environment:
- RUST_LOG=info
ports:
- 19000:19000
volumes:
- ./resources/builder0.yml:/opt/builder/builder.yml
depends_on:
- etcd1
- repository0
builder1:
container_name: builder1
image: pipebase/pipebuilder-builder:aarch64-linux_0.1.4
environment:
- RUST_LOG=info
ports:
- 19001:19001
volumes:
- ./resources/builder1.yml:/opt/builder/builder.yml
depends_on:
- etcd1
- repository0
api0:
container_name: api0
image: pipebase/pipebuilder-api:0.1.4
environment:
- RUST_LOG=info
ports:
- 16000:16000
volumes:
- ./resources/api.yml:/opt/api/api.yml
depends_on:
- etcd1
- builder0
- builder1
- repository0
- scheduler0
16 changes: 16 additions & 0 deletions examples/resources/api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
base:
node:
id: api0
role: Api
internal_address: 0.0.0.0:16000
external_address: api:16000
lease:
ttl: 30
register:
endpoints: ["etcd1:2379"]
api:
clients:
repository:
endpoint: http://repository0:17000
scheduler:
endpoint: http://scheduler0:18000
15 changes: 15 additions & 0 deletions examples/resources/builder0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
base:
node:
id: builder0
role: Builder
internal_address: 0.0.0.0:19000
external_address: builder0:19000
lease:
ttl: 30
register:
endpoints: ["etcd1:2379"]
builder:
repository_endpoint: http://repository0:17000
workspace: /opt/builder/builds/apps
restore_directory: /opt/builder/builds/restores
log_directory: /opt/builder/builds/logs
15 changes: 15 additions & 0 deletions examples/resources/builder1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
base:
node:
id: builder1
role: Builder
internal_address: 0.0.0.0:19001
external_address: builder1:19001
lease:
ttl: 30
register:
endpoints: ["etcd1:2379"]
builder:
repository_endpoint: http://repository0:17000
workspace: /opt/builder/builds/apps
restore_directory: /opt/builder/builds/restores
log_directory: /opt/builder/builds/logs
13 changes: 13 additions & 0 deletions examples/resources/repository.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
base:
node:
id: repository0
role: Manifest
internal_address: 0.0.0.0:17000
external_address: repository:17000
lease:
ttl: 30
register:
endpoints: ["etcd1:2379"]
repository:
manifest: /opt/repository/manifests
app: /opt/repository/apps
11 changes: 11 additions & 0 deletions examples/resources/scheduler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
base:
node:
id: scheduler0
role: Scheduler
internal_address: 0.0.0.0:18000
external_address: scheduler:18000
lease:
ttl: 30
register:
endpoints: ["etcd1:2379"]

4 changes: 4 additions & 0 deletions examples/timer/catalogs/timer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
interval:
Millis: 1000
ticks: 10
11 changes: 11 additions & 0 deletions examples/timer/pipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: print_timer
pipes:
- name: timer1
config:
ty: TimerConfig
path: catalogs/timer.yml
output: UnsignedLongLong
- name: printer
config:
ty: PrinterConfig
upstreams: ["timer1"]