Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add kbld asciinema #638

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
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
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.DS_Store
2 changes: 2 additions & 0 deletions asciinema/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
demo.cast
*.gif
30 changes: 21 additions & 9 deletions asciinema/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
# asciinema demos

This folder contains assets that are used to maintain asciinema demos for Carvel tools.
Currently, there is only one [demo for kapp-controller](https://asciinema.org/a/hhZwxyDcXEGiPD9RDHTb3e9QL).

The demo is all captured in a script called scenario.sh. In order to record an update to
this video, you will need the following:
Uploaded demos to asciinema:
- [demo for kapp-controller](https://asciinema.org/a/hhZwxyDcXEGiPD9RDHTb3e9QL).

* Install asciinema: https://asciinema.org/docs/installation
* Create an asciinema account: https://asciinema.org/login/new
* Install pv: https://linux.die.net/man/1/pv
* Access to a Kubernetes cluster with kapp-controller installed: https://carvel.dev/kapp-controller/docs/latest/install/
* kapp should be installed: https://carvel.dev/#whole-suite

To record a new video, run the following script:

```

To record a new video, run the following script to record for all tools:

```shell
./record.sh
```

if you want to record a single tool run the following script:

```shell
./record.sh kbld
```

The result of this will be a `.cast` file named `demo.cast`.

This can be uploaded to the asciinema website so others can view it by doing the following:

```
```shell
# Authenticate to your asciinema account
asciinmea auth
#Upload the .cast file
asciinema upload demo.cast
```

After the video is uploaded, you should receive a url to the demo from scenario.sh that you can share.

The other option is to generate a gif from the demo file. To do that you can use the tool [agg](https://github.com/asciinema/agg)

and run the following command in each folder:

```shell
agg demo.cast tool-name.gif
```
31 changes: 31 additions & 0 deletions asciinema/kapp-controller/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# kapp-controller asciinema demo

Uploaded [demo for kapp-controller](https://asciinema.org/a/hhZwxyDcXEGiPD9RDHTb3e9QL).

The demo is all captured in a script called scenario.sh. In order to record an update to
this video, you will need the following:

* Install asciinema: https://asciinema.org/docs/installation
* Create an asciinema account: https://asciinema.org/login/new
* Install pv: https://linux.die.net/man/1/pv
* Access to a Kubernetes cluster with kapp-controller installed: https://carvel.dev/kapp-controller/docs/latest/install/
* kapp should be installed: https://carvel.dev/#whole-suite

To record a new video, run the following script:

```
./record.sh
```

The result of this will be a `.cast` file named `demo.cast`.

This can be uploaded to the asciinema website so others can view it by doing the following:

```
# Authenticate to your asciinema account
asciinmea auth
#Upload the .cast file
asciinema upload demo.cast
```

After the video is uploaded, you should receive a url to the demo from scenario.sh that you can share.
2 changes: 2 additions & 0 deletions asciinema/kapp-controller/rollback.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kapp delete -a repo -y
kapp delete -a simple-app -y
File renamed without changes.
30 changes: 30 additions & 0 deletions asciinema/kbld/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# kbld asciinema demo


The demo is all captured in a script called scenario.sh. In order to record an update to
this video, you will need the following:

* Install asciinema: https://asciinema.org/docs/installation
* Create an asciinema account: https://asciinema.org/login/new
* Install pv: https://linux.die.net/man/1/pv
* kbld should be installed: https://carvel.dev/#whole-suite
* pack should be installed: https://buildpacks.io/docs/tools/pack/

To record a new video, run the following script:

```
./record.sh
```

The result of this will be a `.cast` file named `demo.cast`.

This can be uploaded to the asciinema website so others can view it by doing the following:

```
# Authenticate to your asciinema account
asciinmea auth
#Upload the .cast file
asciinema upload demo.cast
```

After the video is uploaded, you should receive a url to the demo from scenario.sh that you can share.
32 changes: 32 additions & 0 deletions asciinema/kbld/orchestrate-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: kbld-simple-app-build-local
spec:
selector:
matchLabels:
app: kbld-simple-app-build-local
template:
metadata:
labels:
app: kbld-simple-app-build-local
spec:
containers:
- name: my-app-docker
image: simple-app-with-docker
- name: my-app-pack
image: simple-app-with-pack
---
apiVersion: kbld.k14s.io/v1alpha1
kind: Config
sources:
- image: simple-app-with-docker
path: simple-app
docker:
pull: true
noCache: true
- image: simple-app-with-pack
path: simple-app
pack:
build:
builder: paketobuildpacks/builder:base
39 changes: 39 additions & 0 deletions asciinema/kbld/scenario.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
clear

echo "kbld has 2 main features" | pv -qL 12
echo " 1 - resolves tags to SHAs of all images present in the input yaml" | pv -qL 12
echo " 2 - orchestrates the build of images and updates the input yaml accordingly" | pv -qL 12

echo "# Example of resolution of tags given the follow yaml" | pv -qL 12
echo "cat tag-resolution.yml" | pv -qL 12
cat tag-resolution.yml
echo ''
echo ''
sleep 2
echo "kbld will resolve nginx image to the correct SHA" | pv -qL 12
echo "kbld -f tag-resolution.yml" | pv -qL 12
kbld -f tag-resolution.yml
echo ''
echo ''
sleep 2

echo "In the output you can see that nginx was replaced by the full reference of the nginx image." | pv -qL 12
echo "This is very important to make sure we know what is the image that is being used in our pods" | pv -qL 12

echo "# Example of building images using the following yaml" | pv -qL 12
echo "cat orchestrate-build.yml" | pv -qL 12
cat orchestrate-build.yml
echo ''
echo ''
sleep 2

echo "kbld will build the image called simple-app-with-docker with docker buildx" | pv -qL 12
echo "and will build the image called simple-app-with-pack with pack \(buildpacks.io\)" | pv -qL 12

echo "kbld -f orchestrate-build.yml" | pv -qL 12
kbld -f orchestrate-build.yml
echo ''
echo ''

echo "kbld supports building using bazel, docker buildx, ko, buildkit CLI for kubectl and pack" | pv -qL 12
sleep 5
12 changes: 12 additions & 0 deletions asciinema/kbld/simple-app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
9 changes: 9 additions & 0 deletions asciinema/kbld/simple-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM golang:1.10.1 AS build-env
WORKDIR /go/src/github.com/mchmarny/simple-app/
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -v -o app

FROM scratch
COPY --from=build-env /go/src/github.com/mchmarny/simple-app/app .
EXPOSE 8080
ENTRYPOINT ["/app"]
Loading