<p>I am trying to push an image to AKS using the default Azure DevOps template:</p>
<pre><code>stages:
- stage: Build
  displayName: Build stage
  jobs:  
  - job: Build
    displayName: Build
    pool:
      vmImage: $(vmImageName)
    steps:
    - task: Docker@2
      displayName: Build and push an image to container registry
      inputs:
        command: buildAndPush
        repository: $(imageRepository)
        dockerfile: $(dockerfilePath)
        containerRegistry: $(dockerRegistryServiceConnection)
        tags: |
          $(tag)

    - upload: manifests
      artifact: manifests
</code></pre>
<p>Which results in the following error:</p>
<pre><code>##[error]Path does not exist: /home/vsts/work/1/s/manifests
</code></pre>
<p>I've tried using the default Publish task</p>
<pre><code>- task: PublishPipelineArtifact@1
  inputs:
    artifactName: 'manifests'
    path: 'manifests'
</code></pre>
<p>but this did not change anything. Can somebody please explain, what is happening here and why the default template from Msft is not working?</p>

<p>Ok - at this stage I have to admin, that I had a thorough misunderstanding about artifacts in build pipelines.</p>
<p>The <code>upload</code> (deprecated) and <code>publish</code> tasks are  short-hand for the Publish Pipeline Artifact task (<a href="https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&amp;tabs=yaml" rel="noreferrer">https://learn.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&amp;tabs=yaml</a>)</p>
<p>Second of all, the path behind the <code>publish</code> keyword is the relative folder, that will be published. If you use the Kubernetes service template from Azure DevOps, it will create a <code>manifest</code> folder on the root of your repo and pre-fill it with a deployment and service yml file.</p>
<p>I don't want them there (and must have deleted the folder subconciously), so I moved them and amended the path:</p>
<pre><code>- publish: $(System.DefaultWorkingDirectory)/Code/Database/Docker
  artifact: sql-drop
</code></pre>
<p>(The Docker folder is where I keep Dockerfiles, docker-compose, overrides and all te other jazz for spinning up containers)</p>
<p>Now in my deployment task, I need to be aware, that I cannot use the literal path from the repository. I need to download the artifact first, and then use the name of the artifact - &quot;sql-drop&quot; as the foldername:</p>
<pre><code>steps:
#current means the current pipline. shorthand sytnax
- download: current
  # name from the aritfact specifed above
  artifact: sql-drop
- task: KubernetesManifest@0
  displayName: Create imagePullSecret
  inputs:
    action: createSecret
    secretName: $(imagePullSecret)
    dockerRegistryEndpoint: $(dockerRegistryServiceConnection)
    
- task: KubernetesManifest@0
  displayName: Deploy to Kubernetes cluster
  inputs:
    action: deploy
    # Use sql-drop as folder name and specify manifests
    manifests: |
      $(Pipeline.Workspace)/sql-drop/his-sql.dev.deployment.yml
      $(Pipeline.Workspace)/sql-drop/his-sql.dev.service.yml
    imagePullSecrets: |
      $(imagePullSecret)
    containers: |
      $(containerRegistry)/$(imageRepository):$(tag)
</code></pre>
