Azure-devops-docs: .artifactignore seems not to work at all?

Created on 18 Apr 2019  Â·  11Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

I have tried both gitignore (extact same content as a .gitignore file which works with Git) syntax and the syntax used by a CopyFiles taks. But both does not have any effect. All files are uploaded to the aritfact.

So whats the matter with the .artifactignore file? Should it work as described above or is this perhabs not even implemented in the preview yet?!

Thanks for clarifying...


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 devops-cictech devopprod

Most helpful comment

Ok, my fault. The .artifactignore file has to be in the same directory as defined as target path of the publish pipeline artifact task. (Not only int the root of the repo like the azure-pipelines.yml as I first thought...)

Maybe worth to mention in the documentation to make it clear?

All 11 comments

Ok, my fault. The .artifactignore file has to be in the same directory as defined as target path of the publish pipeline artifact task. (Not only int the root of the repo like the azure-pipelines.yml as I first thought...)

Maybe worth to mention in the documentation to make it clear?

Making it more explicit in the docs: #4012

@J0F3 - Hi there, I am having the same issue - can you post a yaml of how you are referencing this file? I am not sure how to set up the build for this. Any screenshot would be a total help. Thanks!

@kirikintha Here you go 😉: https://www.jfe.cloud/control-pipeline-artifacts-with-artifactignore-file/
The key is really to place the file in the same folder as also the 'upload' task is pointing to. Only then the file is interpreted by the task.

there is no way actually to make .artifactignore file works I tried everything putting it in every folders is just doesn't work

@nmaaruf So which path have you defined in the settings of the Publish Pipeline Artifact task in the pipeline and where do you have saved the .artifactignore file?
What ist the content of your .artifactignore file?

  • task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: Frontend'
    inputs:
    path: $(System.DefaultWorkingDirectory)/frontend
    artifact: Frontend

and I have .artifactignore inside frontend, I just need to ignore node_modules after build

- task: PublishBuildArtifacts@1
    displayName: 'Publish Artifact: Frontend'
    inputs:
      path: $(System.DefaultWorkingDirectory)/frontend
      artifact: Frontend

and I have .artifactignore inside frontend, I just need to ignore node_modules after build

Ah, you're using the old PublishBuildArtifacts task. Switch to PublishPipelineArtifact@1

I hate to cross pollinate a closed ticket, so I wrote up a stack on this: https://stackoverflow.com/questions/57042995/publishpipelineartifact-artifact-ignore-not-recognized/57051248?noredirect=1#comment100719362_57051248 - I got it working for my Angular project. Thanks!

thanks guys works great now!

Was this page helpful?
0 / 5 - 0 ratings