- Make sure tkn-pac is compiled from main
- Make sure we are on the right cluster ($ opac)
- Create a demo directory in /tmp (
mkdir /tmp/demo
)
gh repo create openshfit-demo-test
? Visibility Public
? Would you like to add a .gitignore? Yes
? Choose a .gitignore template Python
? Would you like to add a license? Yes
? Choose a license Apache License 2.0
? This will create the "openshift-demo-test" repository on GitHub. Continue? Yes
✓ Created repository chmouel/openshift-demo-test on GitHub
? Clone the remote project directory "chmouel/openshift-demo-test"? Yes
Cloning into 'openshift-demo-test'...
remote: Enumerating objects: 4, done.
-
Run
cat .git/config
andgithub-to-remote-ssh origin
andcat .git/config
-
tkn pac repo create
% tkn-pac repository create
? Enter the namespace where the pipeline should run (default: pipelines-as-code): openshift-demo-test
? Enter the Git repository url containing the pipelines (default: https://github.com/chmouel/openshift-demo-test):
? Enter the target GIT branch (default: main):
? Enter the Git event type for triggering the pipeline: pull_request
! Namespace openshift-demo-test is not created yet
? Would you like me to create the namespace openshift-demo-test? Yes
✓ Repository openshift-demo-test-pull-request has been created in openshift-demo-test namespace
? Would you like me to create a basic PipelineRun file into the file .tekton/pull_request.yaml ? True
-
Go to https://github.com/apps/pipelines-as-code and click Configure and add
openshift-demo-test
to the APP -
git checkout -b demo-openshift-pipeline
-
mkdir lib/
-
touch lib/__init__.py
-
vi lib/app.py
-
Insert his
#!/usr/bin/env python3
var = "hello"
if not "hello" in var:
print("hello var is not")
-
vi .tekton
-
add :
pipelinesascode.tekton.dev/task: "[git-clone, pylint]"
- add :
- name: pylint
runAfter: [fetch-repository]
params:
- name: path
value: "lib/"
- name: args
value: ["-r", "y"]
taskRef:
name: pylint
workspaces:
- name: source
workspace: source
-
git push origin demo-openshift-pipeline
and create a pull request by clicking onto the link -
See it fails
-
tkn pac repo ls -n demo-openshift-pipeline
-
tkn pac repo describe -n demo-openshift-pipeline
-
Click on the pull request link logs to see the logs
-
Show via CLI
tkn pr ls -n demo-openshift-pipeline
-
Adjust app.py :
#!/usr/bin/env python3
"""This is an APP"""
VAR = "hello"
if "hello" not in VAR:
print("hello var is not")
-
Commit
git commit -a -m "Linters"
-
Repush with
git push origin demo-openshift-pipeline
-
Explains auto secret
-
Explains ACL
-
Show
/retest
-
Show how a push pipeline would look like