Query Package
  • 14 May 2021
  • 1 Minute to read
  • Dark
    Light
  • PDF

Query Package

  • Dark
    Light
  • PDF

Article Summary

This is generated from the built in components of Otter 3.0.0, and may be different than what you have installed (especially if you have extensions); go to [User Icon] -> Documentation within your BuildMaster instance to see exactly what operations are available.

Query Package

Tests whether a universal package exists and optionally extracts its metadata.

Script usage:

UPack::Query-Package(
	[From: <text>],
	[Name: <text>],
	[Version: <text>],
	[Exists: <true/false>],
	[PackageFile: <text>],
	[FeedUrl: <text>],
	[UserName: <text>],
	[Password: <SecureString>],
	[Metadata: <%(key1: value1, ...)>]
);

Arguments:

NameFormatScript UsageUsage Notes
From package source
text
From
Package name
text
Name
Package version
text
Version
Package exists
true/false
Exists
When specified, this string variable will be set to "true" if the package exists or "false" if it does not.
Package file
text
PackageFile
When specified, FeedUrl, UserName, Password, PackageName, and PackageVersion are ignored.
Feed URL
text
FeedUrl
User name
text
UserName
Password
SecureString
Password
Package metadata
%(key1: value1, ...)
Metadata
When specified, this map variable will be assigned containing all of the package's metadata. If the package does not exist this value is not defined.

Example:

# test whether a package exists in a feed and capture its metadata
Query-Package
(
    Credentials: MyExternalFeed,
    PackageName: Group/Package,
    Exists => $exists,
    Metadata => %packageData
);

if $exists
{
    Log-Debug 'Package $(%packageData.name) exists. Latest version is $(%packageData.version).';
}

Was this article helpful?