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

Merge upstream buildan 0.7 and 0.8 changes #94

Merged
Merged
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
14 changes: 10 additions & 4 deletions scripts/buildah-bud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ phase "Inspecting context '${PARAMS_CONTEXT}'"
[[ ! -d "${PARAMS_CONTEXT}" ]] &&
fail "CONTEXT param is not found at '${PARAMS_CONTEXT}', on source workspace"

phase "Building build args"
BUILD_ARGS=()
for buildarg in "$@"; do
BUILD_ARGS+=("--build-arg=$buildarg")
done

# Handle optional dockerconfig secret
if [[ "${WORKSPACES_DOCKERCONFIG_BOUND}" == "true" ]]; then

Expand Down Expand Up @@ -73,10 +79,10 @@ phase "Building '${PARAMS_IMAGE}' based on '${DOCKERFILE_FULL}'"

_buildah bud ${PARAMS_BUILD_EXTRA_ARGS} \
$ENTITLEMENT_VOLUME \
--no-cache \
"${BUILD_ARGS[@]}" \
--file="${DOCKERFILE_FULL}" \
--tag="${PARAMS_IMAGE}" \
${PARAMS_CONTEXT}
"${PARAMS_CONTEXT}"

if [[ "${PARAMS_SKIP_PUSH}" == "true" ]]; then
phase "Skipping pushing '${PARAMS_IMAGE}' to the container registry!"
Expand All @@ -98,8 +104,8 @@ declare -r digest_file="/tmp/buildah-digest.txt"

_buildah push ${PARAMS_PUSH_EXTRA_ARGS} \
--digestfile="${digest_file}" \
${PARAMS_IMAGE} \
docker://${PARAMS_IMAGE}
"${PARAMS_IMAGE}" \
"docker://${PARAMS_IMAGE}"

#
# Results
Expand Down
8 changes: 8 additions & 0 deletions templates/task-buildah.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ spec:
default: ./Dockerfile
description: |
Path to the `Dockerfile` (or `Containerfile`) relative to the `source` workspace.
- name: BUILD_ARGS
type: array
default:
- ""
description: |
Dockerfile build arguments, array of key=value

{{- include "params_buildah_common" . | nindent 4 }}
{{- include "params_common" . | nindent 4 }}
Expand Down Expand Up @@ -81,6 +87,8 @@ spec:
- name: build
image: {{ .Values.images.buildah }}
workingDir: /workspace/source
args:
- $(params.BUILD_ARGS[*])
command:
- /scripts/buildah-bud.sh
securityContext:
Expand Down