redhat-buildpacks / testing

Project aiming to help us to perform e2e tests using Buildpacks
Apache License 2.0
0 stars 3 forks source link

Tekton buildpack step fails : buildpack API version '0.7' is incompatible with the lifecycle Step failed #10

Closed cmoulliard closed 1 year ago

cmoulliard commented 1 year ago

Issue

The execution of the following test case https://github.com/redhat-buildpacks/testing/blob/main/README.md#3-tekton-and-pipeline-as-a-code fails

Pod's log

ERROR: failed to : set API for buildpack 'paketo-buildpacks/ca-certificates@3.6.1': buildpack API version '0.7' is incompatible with the lifecycle

Step failed

using this pipelinerun

IMAGE_NAME=kind-registry.local:5000/quarkus-hello
BUILDER_IMAGE=paketobuildpacks/builder:tiny

kubectl delete PipelineRun/buildpacks-phases
kubectl delete pvc/env-vars-ws-pvc
cat <<EOF | kubectl apply -f -
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: env-vars-ws-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 500Mi
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: buildpacks-phases
  labels:
    app.kubernetes.io/description: "Buildpacks-PipelineRun"
spec:
  pipelineSpec:
    workspaces:
      - name: source-ws
      - name: cache-ws
    tasks:
      - name: fetch-repository
        taskRef:
          name: git-clone
        workspaces:
          - name: output
            workspace: source-ws
        params:
          - name: url
            value: https://github.com/quarkusio/quarkus-quickstarts.git
          - name: subdirectory
            value: "getting-started"
          - name: deleteExisting
            value: "true"
      - name: buildpacks
        taskRef:
          name: buildpacks-phases
        runAfter:
          - fetch-repository
        workspaces:
          - name: source
            workspace: source-ws
          - name: cache
            workspace: cache-ws
        params:
          - name: CNB_PLATFORM_API
            value: 0.10
          - name: APP_IMAGE
            value: ${IMAGE_NAME}
          - name: SOURCE_SUBPATH
            value: getting-started
          - name: BUILDER_IMAGE
            value: ${BUILDER_IMAGE}
          - name: ENV_VARS
            value:
              - BP_NATIVE_IMAGE="false"
              - BP_MAVEN_BUILT_ARTIFACT="target/quarkus-app/lib/ target/quarkus-app/*.jar target/quarkus-app/app/ target/quarkus-app/quarkus/" 
              - BP_MAVEN_BUILD_ARGUMENTS="package -DskipTests=true -Dmaven.javadoc.skip=true -Dquarkus.package.type=fast-jar"
          - name: PROCESS_TYPE
            value: ""
  workspaces:
    - name: source-ws
      subPath: source
      persistentVolumeClaim:
        claimName: env-vars-ws-pvc
    - name: cache-ws
      subPath: cache
      persistentVolumeClaim:
        claimName: env-vars-ws-pvc
EOF

As the param was not overidden

env:
  - name: CNB_PLATFORM_API
    value: '0.4'
  - name: HOME
    value: /tekton/home

How can we fix that ?

cmoulliard commented 1 year ago

The solution to resolve the issue is to pass for every phase the following env var

      env:
        - name: CNB_PLATFORM_API
          value: $(params.CNB_PLATFORM_API)

see code: https://github.com/redhat-buildpacks/testing/blob/ebdf03fdad4902d99548aa43cef1e6db4a779ee9/k8s/shipwright/unsecured/clusterbuildstrategy.yml#L149-L151