You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
1.5 KiB
61 lines
1.5 KiB
apiVersion: tekton.dev/v1beta1
|
|
kind: Task
|
|
metadata:
|
|
name: buildah
|
|
spec:
|
|
params:
|
|
- name: buildahVersion
|
|
type: string
|
|
- name: outputContainerImage
|
|
type: string
|
|
workspaces:
|
|
- name: src
|
|
mountPath: /src
|
|
- name: containers
|
|
mountPath: /var/lib/containers
|
|
steps:
|
|
- name: buildah
|
|
image: quay.io/containers/buildah:$(params.buildahVersion)
|
|
workingDir: /src
|
|
env:
|
|
- name: TARGET_IMAGE
|
|
value: "$(params.outputContainerImage)"
|
|
securityContext:
|
|
capabilities:
|
|
add:
|
|
- 'SYS_ADMIN'
|
|
privileged: true
|
|
script: |
|
|
#!/bin/bash
|
|
|
|
set -Eeuo pipefail
|
|
|
|
function build () {
|
|
echo "========================================================="
|
|
echo " buildah build $TARGET_IMAGE
|
|
echo "========================================================="
|
|
echo
|
|
|
|
extra_args=""
|
|
if [ -n "${CONTAINERFILE:-}" ]; then
|
|
extra_args="$extra_args --file $CONTAINERFILE"
|
|
fi
|
|
|
|
buildah bud --storage-driver vfs --manifest tekton -t $TARGET_IMAGE $extra_args .
|
|
echo
|
|
}
|
|
|
|
function push () {
|
|
echo "========================================================="
|
|
echo " buildah push $1"
|
|
echo "========================================================="
|
|
echo
|
|
buildah manifest push --storage-driver vfs --all tekton "docker://$1"
|
|
echo
|
|
}
|
|
|
|
build
|
|
|
|
push "$TARGET_IMAGE:latest"
|
|
|
|
exit 0
|
|
|