@google-github-actions/setup-cloud-sdk / Exports / index
- authenticateGcloudSDK
- bestVersion
- computeBestVersion
- computeGcloudVersion
- gcloudRun
- gcloudRunJSON
- getLatestGcloudSDKVersion
- getToolCommand
- installComponent
- installGcloudSDK
- isAuthenticated
- isInstalled
- isProjectIdSet
- setProject
Re-exports TEST_SA_KEY_CREDS_FILE
Re-exports TEST_SDK_VERSION
Re-exports TEST_SDK_VERSIONS
Re-exports TEST_WIF_CREDS_FILE
Re-exports TestToolCache
Ƭ ExecOptions: ActionsExecOptions
ExecOptions is a type alias to core/exec ExecOptions.
Ƭ ExecOutput: Object
ExecOutput is the output returned from a gcloud exec.
Name | Type |
---|---|
output |
string |
stderr |
string |
stdout |
string |
• Const
userAgentString: string
userAgentString is the UA to use for this installation. It dynamically pulls the app version from the package declaration.
▸ authenticateGcloudSDK(filepath
): Promise
<void
>
Authenticates the gcloud tool using the provided credentials file.
Name | Type | Description |
---|---|---|
filepath |
string |
Path to the credentials file. |
Promise
<void
>
▸ bestVersion(spec
): Promise
<string
>
bestVersion takes a version constraint and gets the latest available version that satisfies the constraint.
Name | Type | Description |
---|---|---|
spec |
string |
Version specification |
Promise
<string
>
Resolved version
▸ computeBestVersion(spec
, versions
): string
computeBestVersion computes the latest available version that still satisfies the spec. This is a helper function and is only exported for testing.
Name | Type | Description |
---|---|---|
spec |
string |
Version specification |
versions |
string [] |
List of versions |
string
Best version or an error if no matches are found
▸ computeGcloudVersion(version?
): Promise
<string
>
computeGcloudVersion computes the appropriate gcloud version for the given string. If the string is the empty string or the special value "latest", it returns the latest known version of the Google Cloud SDK. Otherwise it returns the provided string. It does not validate that the string is a valid version.
This is most useful when accepting user input which should default to "latest" or the empty string when you want the latest version to be installed, but still want users to be able to choose a specific version to install as a customization.
Deprecated
Callers should use installGcloudSDK('> 0.0.0.')
instead.
Name | Type | Description |
---|---|---|
version? |
string |
String (or undefined) version. The empty string or other falsey values will return the latest gcloud version. |
Promise
<string
>
String representing the latest version.
▸ gcloudRun(cmd
, options?
): Promise
<ExecOutput
>
gcloudRun executes the given gcloud command using actions/exec under the hood. It handles non-zero exit codes and throws a more semantic error on failure.
Name | Type | Description |
---|---|---|
cmd |
string [] |
The command to run. |
options? |
ExecOptions |
Any options. |
Promise
<ExecOutput
>
ExecOutput
▸ gcloudRunJSON(cmd
, options?
): Promise
<any
>
gcloudRunJSON runs the gcloud command with JSON output and parses the result as JSON. If the parsing fails, it throws an error.
Name | Type | Description |
---|---|---|
cmd |
string [] |
The command to run. |
options? |
ExecOptions |
Any options. |
Promise
<any
>
Parsed JSON as an object (or array).
▸ getLatestGcloudSDKVersion(): Promise
<string
>
getLatestGcloudSDKVersion fetches the latest version number from the API.
Promise
<string
>
The latest stable version of the gcloud SDK.
▸ getToolCommand(): string
Returns the correct gcloud command for OS.
string
gcloud command.
▸ installComponent(component
): Promise
<void
>
Install a Cloud SDK component.
Name | Type | Description |
---|---|---|
component |
string | string [] |
gcloud component group to install ie alpha, beta. |
Promise
<void
>
CMD output
▸ installGcloudSDK(version
): Promise
<string
>
Installs the gcloud SDK into the actions environment.
Name | Type | Description |
---|---|---|
version |
string |
The version or version specification to install. If a specification is given, the most recent version that still matches the specification is installed. |
Promise
<string
>
The path of the installed tool.
▸ isAuthenticated(): Promise
<boolean
>
Checks if gcloud is authenticated.
Promise
<boolean
>
true is gcloud is authenticated.
▸ isInstalled(version?
): boolean
Checks if gcloud is installed.
Name | Type | Description |
---|---|---|
version? |
string |
(Optional) Cloud SDK version. |
boolean
true if gcloud is found in toolpath.
▸ isProjectIdSet(): Promise
<boolean
>
Checks if the project Id is set in the gcloud config.
Promise
<boolean
>
true is project Id is set.
▸ setProject(projectId
): Promise
<void
>
Sets the GCP Project Id in the gcloud config.
Name | Type |
---|---|
projectId |
string |
Promise
<void
>
project ID.