nsc cache gradle create-token
nsc cache gradle create-token generates a revocable token that's pre-scoped to the
permissions needed to read from and write to your Gradle build cache,
so CI/CD pipelines and other non-interactive environments can authenticate
without going through the interactive login flow. It's a narrower,
purpose-built counterpart to nsc token create — instead
of specifying a --grant yourself, the token is automatically scoped to Gradle
cache access. This same command is also invokable as nsc gradle cache create-token.
The generated token is written to a JSON file that can be passed to
nsc cache gradle setup to
configure a Gradle init script that authenticates with it. Like other
revocable tokens, it can be revoked at any time from
cloud.namespace.so/user/sessions
or with nsc token revoke.
Usage
nsc cache gradle create-token [--cache_name <name>] [--expires_in <duration>] [--scope <tenant|user>] [--token <path>]Example
Create a token for the default Gradle cache with a 30-day expiration and write it to gradle-token.json:
$ nsc cache gradle create-token \
--token gradle-token.json \
--expires_in 30dThen pass the token file to nsc cache gradle setup to generate an init script that authenticates with it:
$ nsc cache gradle setup --token gradle-token.json --init-gradle=/tmp/init.gradleOptions
--cache_name
Select a Gradle cache to grant access to. By default, all Gradle caches can be accessed.
--expires_in
Duration until the token expires. Defaults to 2160h (90 days). Available
time units are: h (hours), d (days), w (weeks), and y (years).
--scope
Set the scope of the generated access token. Valid options: tenant, user.
Defaults to user. Tokens with user scope are bound to the tenant
membership of the current user; tenant scope isn't tied to a specific
user's workspace membership.
--token
Write the token to this file in JSON format. Defaults to token.json. Pass
this file to nsc cache gradle setup --token <path> to authenticate with it.
Related Topics
- nsc cache gradle setup - Set up a remote Gradle build cache
- nsc token create - Create a general-purpose revocable token with custom grants
- nsc token revoke - Revoke a token