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 tekton config for build and push operations using ansible-bender #209

Open
wants to merge 2 commits into
base: master
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
48 changes: 48 additions & 0 deletions ab_task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
name: ab_task
spec:
inputs:
params:
- name: AB_IMAGE
description: The location to ansible-bender image.
default: http://link-to-ab-image
- name: PLAYBOOK
description: Path to Ansible playbook to build the image.
default: ./playbook.yaml

resources:
- name: source
type: git

outputs:
resources:
- name: image
type: image

steps:
- name: build
image: $(inputs.params.AB_IMAGE)
workingDir: /workspace/source
command: ['ansible-bender', 'build', '$(inputs.params.PLAYBOOK)']
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
securityContext:
privileged: true

- name: push
image: $(inputs.params.AB_IMAGE)
workingDir: /workspace/source
command: ['ansible-bender', 'push', '$(outputs.resources.image.url)']
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
securityContext:
privileged: true

volumes:
- name: varlibcontainers
emptyDir: {}
23 changes: 23 additions & 0 deletions ab_task_run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
name: ab_task_run
spec:
taskRef:
name: ab_task
inputs:
resources:
- name: source
resourceRef:
type: git
params:
- name: url
value: https://github.com/my-user/my-repo
outputs:
resources:
- name: image
resourceSpec:
type: image
params:
- name:
value: http://link-to-my-image-registry