catalog icon indicating copy to clipboard operation
catalog copied to clipboard

kubernetes actions - [kubectl] error: the path "k8sdeploy.yaml" does not exist

Open lhmoraes opened this issue 1 year ago • 0 comments

Expected execution of thek8sdeploy.yaml file located in the shared-data workspace successfully cloned from the previous task

Actual Behavior, the files cloned through the previous task are not more available in the shared-data wokspace and kubernetes-actions task failed to execute the kubectl apply --filename k8sdeploy.yaml command

Reproduce the Problem

apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
  name: pipeline-parla
spec:

  params:
    - name: app-git-repo-url
      type: string
    - name: app-git-branch
      type: string
    - name: app-image-name
      type: string
    - name: app-builder-name
      type: string
    - name: app-builder-native-image
      type: string
    - name: app-builder-java-version
      type: string
    - name: app-builder-gradle-arguments
      type: string
    - name: app-builder-built-artifact
      type: string

  workspaces:
    - name: shared-data

  tasks:

    # Task: Fetch Git Source
    - name: task-git-source
      taskRef:
        name: git-clone
      params:
        - name: url
          value: $(params.app-git-repo-url)
        - name: revision
          value: $(params.app-git-branch)
        - name: deleteExisting
          value: "true"
      workspaces:
        - name: output
          workspace: shared-data

    # Task: Build Paketo Buildpacks
    - name: task-build-packs
      taskRef:
        name: buildpacks
      runAfter:
        - task-git-source
      params:
        - name: APP_IMAGE
          value: $(params.app-image-name)
        - name: BUILDER_IMAGE
          value: $(params.app-builder-name)
        - name: ENV_VARS
          value:
            - BP_NATIVE_IMAGE=$(params.app-builder-native-image)
            - BP_JVM_VERSION=$(params.app-builder-java-version)
            - BP_GRADLE_BUILD_ARGUMENTS=$(params.app-builder-gradle-arguments)
            - BP_GRADLE_BUILT_ARTIFACT=$(params.app-builder-built-artifact)
      workspaces:
        - name: source
          workspace: shared-data
        - name: cache
          workspace: shared-data

    # Task: Deploy Application
    - name: task-deploy-app
      taskRef:
        name: kubernetes-actions
      runAfter:
        - task-build-packs
      workspaces:
        - name: manifest-dir
          workspace: shared-data
      params:
        - name: SCRIPT
          value: |
            kubectl apply --filename k8sdeploy.yaml

lhmoraes avatar Oct 21 '23 15:10 lhmoraes