Skip to content

Commit

Permalink
Merge upstream buildan 0.7 and 0.8 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjones2 authored and openshift-merge-bot[bot] committed Aug 2, 2024
1 parent c6526ad commit 66a238b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
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

0 comments on commit 66a238b

Please sign in to comment.