Skip to content

Instantly share code, notes, and snippets.

@sbose78
Created August 5, 2020 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbose78/3e4fe119489bb0839c376dc9a9c603a5 to your computer and use it in GitHub Desktop.
Save sbose78/3e4fe119489bb0839c376dc9a9c603a5 to your computer and use it in GitHub Desktop.
apiVersion: tekton.dev/v1alpha1
kind: ClusterTask
metadata:
name: buildah
spec:
inputs:
params:
- name: BUILDER_IMAGE
description: The location of the buildah builder image.
default: quay.io/buildah/stable:v1.11.0
- name: DOCKERFILE
description: Path to the Dockerfile to build.
default: ./Dockerfile
- name: TLSVERIFY
description: Verify the TLS on the registry endpoint (for push/pull to a non-TLS registry)
default: "true"
- name: BUILD_EXTRA_ARGS
description: Extra parameters passed for the push command when pushing images.
type: string
default: ""
resources:
- name: source
type: git
outputs:
resources:
- name: image
type: image
steps:
- name: build
image: $(inputs.params.BUILDER_IMAGE)
workingDir: /workspace/source
script: |
buildah bud $(inputs.params.BUILD_EXTRA_ARGS) --tls-verify=$(inputs.params.TLSVERIFY) --layers -f $(inputs.params.DOCKERFILE) -t $(outputs.resources.image.url) .
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
securityContext:
privileged: true
- name: push
image: $(inputs.params.BUILDER_IMAGE)
workingDir: /workspace/source
command: ['buildah', 'push', '--tls-verify=$(inputs.params.TLSVERIFY)', '$(outputs.resources.image.url)', 'docker://$(outputs.resources.image.url)']
volumeMounts:
- name: varlibcontainers
mountPath: /var/lib/containers
securityContext:
privileged: true
volumes:
- name: varlibcontainers
emptyDir: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment