# PAC Demo on Kubernetes Kind
* Video:
* Doc: https://pipelinesascode.com
## Preparation
- Created Sample Repo: https://github.com/chmouel/pac-demo (fork it!!)
- Installed Kind https://kind.sigs.k8s.io/ (any kubernetes platform works)
- Only tekton pipelines+dashboard and a ingress pointing to dashboard (setting
up dashboard and ingress is optional)
- Installed latest version of tkn-pac from https://pipelinesascode.com/docs/guide/cli/#install
## Bootstrap
- Install latest version of Pipelines as Code
- Deploy a service to forward webhook to the local kind so you don't need give access
between pac and your local kind install.
- Create a GitHub Application with pac settings via a web browser.
- Configure PAC secrets.
```console
tkn pac bootstrap
```
## Post Bootstrap
- Enable some experimental feature for error detection (which will show later)
```console
kubectl patch configmap -n pipelines-as-code -p "{\"data\":{\"error-detection-from-container-logs\": \"true\"}}" pipelines-as-code
```
- Add Github app to the sample repository
- Go to the just bootstrapped application homepage (as seen on the tkn pac bootstrap but you can find it
in https://github.com/settings/apps as well)
- Click Install
- Add the app to the target repository, ie: https://github.com/chmouel/pac-demo
## Create a Repository CRD for your repository URL
- Checkout your sample repository
```console
git clone git@github.com:chmouel/pac-demo
```
- Inspect what we have in there.
- A sample badly written go app
- use tkn pac create repo :
```console
tkn pac create repo
```
- Inspect the generate .tekton/pipelinerun.yaml
## Create a Pull Request
- Create a branch :
```
git checkout -b tektonci
```
- Commit files
```
git add .
git commit -m "Tekton FTW"
```
- Push it
```
git push origin tektonci
```
- create the pull request via web.
- wait a few seconds that the checks come up,
- Click on the Checks tab and see that the CI has started
- See failures, see failures attached directly on code via annotations from the
container log.
## Fix your code and repush
- edit main.go and change it to :
```go
package main
import (
"fmt"
"os"
)
func main() {
fmt.Fprint(os.Stdout, "Hello world\n")
}
```
- commit and push the change:
```
git commit -a -m "Fix linter errors"
git push
```
- Inspect the checks tab on your pull request again and see it's green now.
## More deep dive in features
- Target events
- Advanced Target events via CEL expression: https://pipelinesascode.com/docs/guide/authoringprs/#advanced-event-matching
- Support Private Repositories transparently, exposing temporary github token for git-clone task to reuse.
- PAC Resolver
- Take every tasks and pipeline attached to pipelinerun and resolve as one
- Remote tasks support
- Remote PipelineRef support
- Webhook Support for Github webhook / Gitlab Bitbucket Cloud/Server
- Cleanups on pipelinerun target
- Concurrency limit
- tkn pac cli features (describe/list/webhook setup)
## Finish
More documentation https://pipelinesascode.com/