Skip to content

XAML PostTest script

Codeblack edited this page Mar 12, 2017 · 2 revisions

This is a script that is to be used as the post-test script in a build-workflow. It uses the Get-Build to determine if the build succeeded (so far), New-NuGetPackage & Push-NuGetPackage functions to create & push NuGet-packages and Invoke-Release to initiate a release.

Select this script as the 'Post-test script path' process parameter. It is in the 'Advanced' sub-section of the 'Test' section, which is collapsed by default. The actual path depends on how you installed the scripts into your version-control.

The parameters for the script are provided as the 'Post-test script arguments' process parameter. See the description of the New-NuGetPackage, Push-NuGetPackage and Invoke-Release functions to see what parameters are available. Especially check the description of the New-NuGetPackage function to learn how to specify the base-path for the files in the nuspec-file and how to use a pre-package script. The SourcesDirectory and BinariesDirectory parameters for the New-NuGetPackage function, and the DropDirectory parameter for both functions are provided by this script and taken from the build-environment; it cannot be provided to this script. The other parameters are passed to the New-NuGetPackage and Push-NuGetPackage functions as appropriate.

Packages are only created and pushed when the compilation- and test-status of the build is 'Succeeded'. To actually push any packages, you need to specify the Source- and Push-parameters.

A release is also only initiated when the compilation- and test-status of the build is 'Succeeded'. To actually initiate a release, you need to specify the Release- and RMServer-parameters. The Team Foundation Server url is taken from the environment-variables provided by the build-engine. This url must exactly match that of the TFS connection in Release Management Server. If it doesn't match, e.g. because the FQDN is (or isn't) used, provide it explicitly using the TeamFoundationServerUrl-parameter.

The image below shows an example of explicitly provided parameters. (This is a build-definition for a Git-repository.) Note that the BasePath-parameter specifies a pre-packaging folder, so a pre-package script should be provided for each nuspec-file.

PostTest-script in build-definition

Parameters

NuspecFilePath

Specifies the file-path for one or more nuspec-files, relative to the sources-directory. If not provided, all nuspec-files in the sources-directory will be processed.

BasePath

Specifies the path to use as the base-path for the files in the nuspec-file(s), relative to the drop- or binaries-directory. If the drop-directory is present and populated, the base-path is relative to the drop-directory; otherwise it is relative to the binaries-directory. If not provided, or empty, the base-path is the drop- or binaries-directory itself.

OutputPath

Specifies the path to use as the output-path for the package(s), relative to the drop-directory. Default is 'Package'.

AdditionalPackOptions

Specifies additional command-line options for the pack-command. The '-Verbosity' options is added automatically, with value 'Detailed', if the Verbose parameter is provided to this script.

Source

Specifies the package-source to push the package(s) to.

ApiKey

Specifies the API-key to use when pushing the package(s).

Package

Specifies whether the package(s) should be created. If creating package(s) is disabled, pushing will be skipped.

Push

Specifies whether the package(s) should be pushed. Creating package(s) must be enabled for the package(s) to be pushed.

RMServer

Specifies the name of the Release Management server to use for initiating the release.

RMPort

Specifies the name of the Release Management server to use for initiating the release. Default is 1000.

TeamFoundationServerUrl

Specifies the url of the Team Project Collection, containing the Team Project for which to initiate the release.

TargetStageName

Specifies the target stage for the release. Leave blank to allow the release to go through all the stages in the release path.

Disabled

Specifies that no changes should be made.

Verbose

Specifies that more detailed logging should be provided.

Clone this wiki locally