Поделиться через


Archive Files task

TFS 2017

Use this task to create an archive file from a source folder. A range of standard archive formats are supported including .zip, .jar, .war, .ear, .tar, .7z, and more.

Demands

None

Arguments

Argument Description
rootFolderOrFile
Root folder or file to archive
(Required) Enter the root folder or file path to add to the archive. If a folder, everything under the folder will be added to the resulting archive
Default value: $(Build.BinariesDirectory)
includeRootFolder
Prepend root folder name to archive paths
(Required) If selected, the root folder name will be prefixed to file paths within the archive. Otherwise, all file paths will start one level lower.
For example, suppose the selected root folder is: /home/user/output/classes/, and contains: com/acme/Main.class.
  • If selected, the resulting archive would contain: classes/com/acme/Main.class
  • Otherwise, the resulting archive would contain: com/acme/Main.class..
archiveType
Archive type
(Required) Specify the compression scheme used. To create foo.jar, for example, choose zip for the compression, and specify foo.jar as the archive file to create. For all tar files (including compressed ones), choose tar.
  • zip - default, zip format, choose this for all zip compatible types, (.zip, .jar, .war, .ear)
  • 7z - 7-Zip format, (.7z)
  • tar - tar format, choose this for compressed tars, (.tar.gz, .tar.bz2, .tar.xz)
  • wim - wim format, (.wim)
sevenZipCompression
7z compression
Optionally choose a compression level, or choose None to create an uncompressed 7z file
Default value: Normal
Options:
  • Ultra
  • Maximum
  • Normal
  • Fast
  • Fastest
  • None
tarCompression
Tar compression
Optionally choose a compression scheme, or choose None to create an uncompressed tar file.
  • gz - default, gzip compression (.tar.gz, .tar.tgz, .taz)
  • bz2 - bzip2 compression (.tar.bz2, .tz2, .tbz2)
  • xz - xz compression (.tar.xz, .txz)
  • None - no compression, choose this to create a uncompressed tar file (.tar)

Default value: gz
archiveFile
Archive file to create
(Required) Specify the name of the archive file to create.
For example, to create foo.tgz, select the tar archive type and gz for tar compression.
Default value: $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
replaceExistingArchive
Replace existing archive
(Required) If an existing archive exists, specify whether to overwrite it. Otherwise, files will be added to it as long as it is not a compressed tar.
If adding to an existing archive, these types are supported:
  • zip
  • 7z
  • tar - uncompressed only
  • wim
verbose
Forces verbose output
(Optional) If set to true, forces tools to use verbose output. Overrides 'quiet'.
Default value: false
quiet
Forces quiet output
(Optional) If set to true, forces tools to use quiet output. Can be overridden by 'verbose'.
Default value: false

Open source

This task is open source on GitHub. Feedback and contributions are welcome.

FAQ

Q: I'm having issues with publishing my artifacts. How can I view the detailed logs?

To enable detailed logs for your pipeline:

  1. Edit your pipeline and select Variables
  2. Add a new variable with the name System.Debug and value true
  3. Save

Q: Which variables are available to me?

A: $(Build.SourcesDirectory) and $(Agent.BuildDirectory) are just few of the variables you can use in your pipeline. Variables are available as expressions or scripts.

See Define variables, predefined variables, and Classic release and artifacts variables to learn about the different types of variables.

Q: Task allows me to publish artifacts in deployment job in yaml pipeline, but I am not able to use it in downstream pipeline?

A: Deployment jobs do not have the context of source branches and are hence not appropriate for publishing artifacts. They have been primarily designed to consume artifacts. A workaround would be to isolate that logic into a separate job (with dependencies on your deployment jobs).

Do I need an agent?

You need at least one agent to run your build or release.

I'm having problems. How can I troubleshoot them?

See Troubleshoot Build and Release.

I can't select a default agent pool and I can't queue my build or release. How do I fix this?

See Agent pools.

My NuGet push task is failing with the following error: "Error: unable to get local issuer certificate". How can I fix this?

This can be fixed by adding a trusted root certificate. You can either add the NODE_EXTRA_CA_CERTS=file environment variable to your build agent, or you can add the NODE.EXTRA.CA.CERTS=file task variable in your pipeline. See Node.js documentation for more details about this variable. See Set variables in a pipeline for instructions on setting a variable in your pipeline.

I use TFS on-premises and I don't see some of these features. Why not?

Some of these features are available only on Azure Pipelines and not yet available on-premises. Some features are available on-premises if you have upgraded to the latest version of TFS.