diff --git a/ab_task.yaml b/ab_task.yaml new file mode 100644 index 0000000..5aca3cd --- /dev/null +++ b/ab_task.yaml @@ -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: {} \ No newline at end of file diff --git a/ab_task_run.yaml b/ab_task_run.yaml new file mode 100644 index 0000000..00aa263 --- /dev/null +++ b/ab_task_run.yaml @@ -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 \ No newline at end of file