catalog
catalog copied to clipboard
Buildah bud build fails when using an Image WITH Tag as param
Expected Behavior
Buildah should successfully build & push a container image. In fact it does when I just use an IMAGE param WITHOUT any Tag, like : image-registry.openshift-image-registry.svc:5000/petclinic/petclinic-config-server
But if I use a Image with Tag as param : image-registry.openshift-image-registry.svc:5000/petclinic/petclinic-config-server:ed13010e173ea680a4a6eba3a22096664b65159f
it fails with: [build-image : build] /tekton/scripts/script-0-hq88j: line 7: .: filename argument required [build-image : build] .: usage: . filename [arguments]
[build-image : push] 2022/02/28 11:38:58 Skipping step because a previous step failed
Actual Behavior
task build-image has failed: "step-build" exited with code 2 (image: "registry.redhat.io/rhel8/buildah@sha256:6f5c9e8d4cffef48bb484ecc0c3d60a5218e56bd2d31f9cbeb76c97a7340b482"); for logs run: kubectl -n petclinic logs build-and-deploy-run-vj5kg-build-image-krllr-pod-lrs86 -c step-build
[build-image : build] + buildah --storage-driver=vfs bud --format=oci --tls-verify=false --no-cache -f docker/petclinic-config-server/Dockerfile -t image-registry.openshift-image-registry.svc:5000/petclinic/petclinic-config-server:ed13010e173ea680a4a6eba3a22096664b65159f
[build-image : build] STEP 1: FROM mcr.microsoft.com/openjdk/jdk:11-mariner AS builder
[build-image : build] Trying to pull mcr.microsoft.com/openjdk/jdk:11-mariner...
[build-image : build] Getting image source signatures
[build-image : build] Copying blob sha256:cc41e592f31bec309c8daf9f1261cfd38914fb874ead4a6716c92daf86874858
[build-image : build] Copying blob sha256:21dbd756a9ab69ec5d6499cf9f366bc6b3b42262e5b5b925fb30add5d9ef3c46
[build-image : build] Copying config sha256:e60f42804e16e8d7b9c2d3ee876d458bde71a8240c421b794758127ea25a9c33
[build-image : build] Writing manifest to image destination
[build-image : build] Storing signatures
[build-image : build] STEP 3: LABEL Description="PetClinic Config Server: Java Spring Boot microservice built from MS OpenJDK 11-Mariner"
[build-image : build] STEP 4: RUN mkdir /tmp/app
[build-image : build] STEP 5: WORKDIR /tmp/app
[build-image : build] STEP 6: COPY "./spring-petclinic-config-server/target/*.jar" /tmp/app/app.jar
[build-image : build] STEP 7: RUN java -Djarmode=layertools -jar "/tmp/app/app.jar" extract
[build-image : build] STEP 8: FROM mcr.microsoft.com/openjdk/jdk:11-mariner
[build-image : build] STEP 9: WORKDIR /tmp/app
[build-image : build] STEP 10: COPY --from=builder /tmp/app/dependencies/ ./
[build-image : build] STEP 11: COPY --from=builder /tmp/app/snapshot-dependencies/ ./
[build-image : build] STEP 12: COPY --from=builder /tmp/app/spring-boot-loader/ ./
[build-image : build] STEP 13: COPY --from=builder /tmp/app/application/ ./
[build-image : build] STEP 14: EXPOSE 80 8080 8081 8082 8083 8084 8888 9090
[build-image : build] STEP 15: ENV SPRING_PROFILES_ACTIVE docker,mysql
[build-image : build] STEP 16: ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher", "--server.port=8888", "--spring.profiles.active=docker,mysql"]
[build-image : build] STEP 17: COMMIT image-registry.openshift-image-registry.svc:5000/petclinic/petclinic-config-server:ed13010e173ea680a4a6eba3a22096664b65159f
[build-image : build] --> 0c0ec163363
[build-image : build] Successfully tagged image-registry.openshift-image-registry.svc:5000/petclinic/petclinic-config-server:ed13010e173ea680a4a6eba3a22096664b65159f
[build-image : build] 0c0ec163363812c2de5a701f21fac2e9384cd133c90123c414b844740c9ef038
[build-image : build] + .
[build-image : build] /tekton/scripts/script-0-hq88j: line 7: .: filename argument required
[build-image : build] .: usage: . filename [arguments]
[build-image : push] 2022/02/28 11:38:58 Skipping step because a previous step failed
failed to get logs for task build-image : container step-push has failed : [{"key":"StartedAt","value":"2022-02-28T11:38:58.784Z","type":3}]
Tasks Completed: 4 (Failed: 1, Cancelled 0), Skipped: 4
Steps to Reproduce the Problem
1.Repros temps on my repo 2. Look at the Pipeline Line 98 3. Run
tkn pipeline start build-and-deploy \
-w name=shared-workspace,volumeClaimTemplateFile=cicd/tkn/cnf/persistent_volume_claim.yaml \
-w name=maven-settings,config=maven-settings \
-p deployment-name=config-server \
-p git-url=https://github.com/ezYakaEagle442/aro-java-petclinic-mic-srv \
-p git-revision=master \
-p DOCKERFILE=docker/petclinic-config-server/Dockerfile \
-p CONTEXT=. \
-p IMAGE=image-registry.openshift-image-registry.svc:5000/$projectname/petclinic-config-server \
-p FORMAT=oci \
-p subdirectory=spring-petclinic-config-server \
-p manifest_dir=spring-petclinic-config-server/k8s \
-p ING_HOST=$ING_HOST
Additional Info
See https://github.com/tektoncd/catalog/blob/v1beta1/buildah/buildah.yaml#L39
Pipeline
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: build-and-deploy
spec:
workspaces:
- name: shared-workspace
- name: maven-settings
params:
- name: deployment-name
type: string
description: name of the deployment to be patched
- name: git-url
type: string
description: url of the git repo for the code of deployment
- name: git-revision
type: string
description: revision to be used from repo of the code for deployment
default: "master"
- name: IMAGE
type: string
description: image to be build from the code
- name: subdirectory
type: string
description: Subdirectory inside the `output` Workspace to clone the repo into
- name: DOCKERFILE
type: string
description: Path to the Dockerfile to build.
- name: CONTEXT
type: string
description: Path to the directory to use as context.
- name: FORMAT
type: string
description: The format of the built container, oci or docker
- name: manifest_dir
description: The directory in source that contains yaml manifests
type: string
default: "k8s"
- name: ING_HOST
description: The Ingress Router HostName like petclinic-xxx-<namespace>.apps.<domain>.<location>.aroapp.io
type: string
tasks:
- name: fetch-repository
taskRef:
name: git-clone
kind: ClusterTask
workspaces:
- name: output
workspace: shared-workspace
params:
- name: url
value: $(params.git-url)
- name: subdirectory
value: ""
- name: deleteExisting
value: "true"
- name: revision
value: $(params.git-revision)
- name: maven-build
taskRef:
name: maven
kind: ClusterTask
params:
- name: GOALS
value:
- -DskipTests
- clean
- package
workspaces:
- name: source
workspace: shared-workspace
- name: maven-settings
workspace: maven-settings
runAfter:
- fetch-repository
- name: check-mvn
taskRef:
name: check-mvn-output
workspaces:
- name: output
workspace: shared-workspace
runAfter:
- maven-build
- name: build-image
taskRef:
name: buildah
kind: ClusterTask
params:
- name: TLSVERIFY
value: "false"
- name: IMAGE
value: $(params.IMAGE):$(tasks.check-mvn.results.GIT_COMMIT_ID)
- name: DOCKERFILE
value: $(params.DOCKERFILE)
- name: CONTEXT
value: $(params.CONTEXT)
workspaces:
- name: source
workspace: shared-workspace
runAfter:
- check-mvn
- name: apply-manifests
taskRef:
name: apply-manifests
params:
- name: manifest_dir
value: $(params.manifest_dir)
- name: ING_HOST
value: $(params.ING_HOST)
workspaces:
- name: source
workspace: shared-workspace
runAfter:
- build-image
- name: update-deployment
taskRef:
name: update-deployment
params:
- name: deployment
value: $(params.deployment-name)
- name: IMAGE
value: $(params.IMAGE)
- name: IMAGE_DIGEST
value: $(tasks.build-image.results.IMAGE_DIGEST)
- name: IMAGE_TAG
value: $(tasks.check-mvn.results.GIT_COMMIT_ID)
runAfter:
- apply-manifests
- name: get-tag
taskRef:
name: get-tag
params:
- name: IMAGE
value: $(params.IMAGE)
runAfter:
- update-deployment
- name: list-tags
taskRef:
name: list-tags
params:
- name: IMAGE
value: $(params.IMAGE)
- name: IMAGE_TAG
value: $(tasks.get-tag.results.IMAGE_TAG)
runAfter:
- get-tag
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen
with a justification.
/lifecycle stale
Send feedback to tektoncd/plumbing.
Stumbled onto this issue myself and was investigating...in my specific scenario the contents from the tag variable (I was using commit message and commit hash also) has a line break at the end of the parameter that is being injected. Since the image tag is immediately before the context parameter which defaults to .
if not set, it attempts to run .
as another command/line in the script being executed which gave me the error above.
line 7: .: filename argument required
To test this I created another task that simply outputs the parameter via some echo commands to validate my assumption that this was the case:
- name: display-parameter-value
image: docker.io/alpine:latest
script: |
echo '########## START ##########'
echo '$(params.parameter-test)'
echo '########### END ###########'
echo ''
echo ''
echo '"$(params.parameter-test)"'
echo ''
echo ''
echo '#### $(params.parameter-test) ####'
echo '-LAST LINE-'
The results I saw were as follows:
########## START ##########
private-registry/truncated/image:tag
########### END ###########
"private-registry/truncated/image:tag
"
#### private-registry/truncated/image:tag
####
-LAST LINE-
Thus this was problematic on my end, not the buildah task or tool. Hope this helps find the root cause on your side as well.
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
with a justification.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen
with a justification.
/lifecycle rotten
Send feedback to tektoncd/plumbing.
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen
with a justification.
Mark the issue as fresh with /remove-lifecycle rotten
with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen
with a justification.
/close
Send feedback to tektoncd/plumbing.
@tekton-robot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity. Reopen the issue with
/reopen
with a justification. Mark the issue as fresh with/remove-lifecycle rotten
with a justification. If this issue should be exempted, mark the issue as frozen with/lifecycle frozen
with a justification./close
Send feedback to tektoncd/plumbing.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.