Home > OS >  the path "/home/vsts/work/1/s/javapipetest13/Orchestration/dev/deployment.yaml" does not e
the path "/home/vsts/work/1/s/javapipetest13/Orchestration/dev/deployment.yaml" does not e

Time:07-29

I am getting the following error while running pipeline

==============================================================================
/usr/local/bin/kubectl apply -n default -f /home/vsts/work/1/s/javapipetest13/Orchestration/dev/deployment.yaml -o json
error: the path "/home/vsts/work/1/s/javapipetest13/Orchestration/dev/deployment.yaml" does not exist
##[error]error: the path "/home/vsts/work/1/s/javapipetest13/Orchestration/dev/deployment.yaml" does not exist
commandOutput
##[error]The process '/usr/local/bin/kubectl' failed with exit code 1
Finishing: Kubernetes

I have the file deployment.yml in the correct path,but I am not sure why the pipeline failed to say path not found

enter image description here

This is my docker file

FROM java:8-alpine
ENV APP_FILE='*-0.0.1-SNAPSHOT.jar'
#COPY ./lib/elastic-apm-agent-1.28.1.jar /lib
ENV APP_HOME=/usr/app
RUN mkdir /usr/app && touch /tmp/spring.log && chmod 777 /tmp/spring.log
EXPOSE 8080 8090 8091
COPY target/$APP_FILE $APP_HOME/
CMD java -jar $APP_HOME/$APP_FILE

Here is the pipeline step that spins up the deployment file,but getting error in this step

- task: Kubernetes@1
    inputs:
      connectionType: 'Azure Resource Manager'
      azureSubscriptionEndpoint: 'sc-icndp'
      azureResourceGroup: 'eus-icndp-rg'
      kubernetesCluster: 'icndp-aks'
      namespace: 'default'
      command: 'apply'
      arguments: '-f $(Build.SourcesDirectory)/$(Build.Repository.Name)/Orchestration/dev/deployment.yaml'

CodePudding user response:

From your YAML sample and the screenshot of the Repo, you need to confirm if you are checking out single repo in your pipeline.

If yes, the file path will not contain the repo name.

You can change the path: $(Build.SourcesDirectory)/Orchestration/dev/deployment.yaml

Refer to this doc: Checkout path

Single repository: If you have a single checkout step in your job, or you have no checkout step which is equivalent to checkout: self, your source code is checked out into a directory called s located as a subfolder of (Agent.BuildDirectory). If (Agent.BuildDirectory) is C:\agent_work\1, your code is checked out to C:\agent_work\1\s.

Multiple repositories: If you have multiple checkout steps in your job, your source code is checked out into directories named after the repositories as a subfolder of s in (Agent.BuildDirectory). If (Agent.BuildDirectory) is C:\agent_work\1 and your repositories are named tools and code, your code is checked out to C:\agent_work\1\s\tools and C:\agent_work\1\s\code.

  • Related