Command Reference
dpteam
Work seamlessly with Dapla teams from the command line.
Use dpteam <command> <subcommand> --help
for more information about a command.
For an introduction to Dapla Team CLI, read the guide at https://statisticsnorway.github.io/dapla-team-cli/guide
Usage:
dpteam [OPTIONS] COMMAND [ARGS]...
Options:
--version
-v, --loglevel [DEBUG|INFO|WARN|ERROR|CRITICAL]
[default: LogLevel.WARN]
--install-completion [bash|zsh|fish|powershell|pwsh]
Install completion for the specified shell.
--show-completion [bash|zsh|fish|powershell|pwsh]
Show completion for the specified shell, to
copy it or customize the installation.
auth
Authenticate dpteam with Keycloak.
Usage:
dpteam auth [OPTIONS] COMMAND [ARGS]...
login
Authenticate with Keycloak.
The default authentication mode is a web-based browser flow. After completion, an access token will be stored internally.
Alternatively, use --with-token
to pass in a token on standard input.
You need to be logged in to communicate with backend APIs such as the dapla-team-api.
Usage:
dpteam auth login [OPTIONS]
Options:
-wt, --with-token TEXT Keycloak access token
status
Show information about the current authentication status.
Usage:
dpteam auth status [OPTIONS]
Options:
-t, --raw-token Print raw token
changelogs
Prints the n last release changelogs for 'dapla-team-cli'.
Usage:
dpteam changelogs [OPTIONS]
Options:
-n, --nlogs INTEGER Number of latest logs to show [default: 5]
doctor
Check your system for potential problems.
This could be e.g. if some required tooling is missing. The command provides advice and pointers to how to fix issues. Will exit with a non-zero status if any potential problems are found.
Usage:
dpteam doctor [OPTIONS]
groups
Interact with a team's auth group memberships.
Usage:
dpteam groups [OPTIONS] COMMAND [ARGS]...
create
Adds a team with respective groups.
Usage:
dpteam groups create [OPTIONS]
Options:
-tn, --team-name TEXT Team names separated by space (e.g. 'dev-stat-a demo-
stat-b')
delete
Removes a team with respective groups.
Usage:
dpteam groups delete [OPTIONS]
Options:
-tn, --team-name TEXT Team name (e.g. demo-enhjoern-a)
members
Commands for members
Usage:
dpteam groups members [OPTIONS] COMMAND [ARGS]...
add
Adds members to a group.
Usage:
dpteam groups members add [OPTIONS]
Options:
-tn, --team-name TEXT Team name (e.g. demo-enhjoern-a)
-m, --members TEXT Space separated list of users (e.g. 'abc@ssb.no
xyz@ssb.no'
list
List groups (and members) for a team.
Usage:
dpteam groups members list [OPTIONS]
Options:
-tn, --team-name TEXT Team name (e.g. demo-enhjoern-a)
remove
Removes member from a group.
Usage:
dpteam groups members remove [OPTIONS]
Options:
-tn, --team-name TEXT Team name (e.g. demo-enhjoern-a)
-m, --members TEXT Space separated list of users (e.g. 'abc@ssb.no
xyz@ssb.no')
pr
Do PR operations.
Usage:
dpteam pr [OPTIONS] COMMAND [ARGS]...
add
Create state file for existing PR´s
Usage:
dpteam pr add [OPTIONS] COMMAND [ARGS]...
urls
Creates a state for a list of existing PR´s.
Usage:
dpteam pr add urls [OPTIONS] [PR_URLS]...
Options:
-tbn, --target-branch-name TEXT
Branch name used in PR´s [default:
update/template]
[PR_URLS]... List of PR urls to create state file for.
apply
Deploy infrastructure changes by commenting 'atlantis apply' on PRs.
Usage:
dpteam pr apply [OPTIONS] [MAX_PRS]
Options:
[MAX_PRS] Max PRs to open in one run. [default: 9223372036854775807]
approve
Approves all pull requests.
Usage:
dpteam pr approve [OPTIONS]
janitor
Collection of commands that cleans up PRs
Usage:
dpteam pr janitor [OPTIONS] COMMAND [ARGS]...
close-prs
Closes all pull requests.
Usage:
dpteam pr janitor close-prs [OPTIONS]
Options:
--keep-remote-branches / --no-keep-remote-branches
Does not delete remote branches [default:
no-keep-remote-branches]
merge
Merges all pull requests.
Usage:
dpteam pr merge [OPTIONS]
Options:
-o, --override Yields an option to merge PRs that the state file records as
having already been merged
open
Opens a pull request for all folders in a given parent folder.
Usage:
dpteam pr open [OPTIONS]
Options:
-o, --override Yields an option to open PRs that the state
file records as having already been opened
-m, --max INTEGER Max PRs to open in one run. [default:
9223372036854775807]
-b, --target-branch-name TEXT Name of the branches in the opened pull
requests
-c, --commit-messsage TEXT Name of the commit message in the opened pull
requests
plan
Writes 'atlantis plan' on all PRs.
Usage:
dpteam pr plan [OPTIONS] [MAX_PRS]
Options:
[MAX_PRS] Max PRs to open in one run. [default: 9223372036854775807]
probe
Validate pull requests
Usage:
dpteam pr probe [OPTIONS] COMMAND [ARGS]...
apply
Probes atlantis apply was successful.
Updates statefile accordingly.
Usage:
dpteam pr probe apply [OPTIONS]
plan
Probes whether plans and checks were successful.
Updates statefile accordingly.
Usage:
dpteam pr probe plan [OPTIONS]
ready
Sets up the state file and prepares the run.
Usage:
dpteam pr ready [OPTIONS]
Options:
-f, --folder-path PATH Path to root folder containing all subfolders in
which pull requests are opened
-s, --state-name TEXT Name of the state file to generate
state
Reads, prints and edits state.
Usage:
dpteam pr state [OPTIONS] COMMAND [ARGS]...
remove
Removes the state file.
Usage:
dpteam pr state remove [OPTIONS]
show
Visualises the state of the run.
Usage:
dpteam pr state show [OPTIONS]
Options:
-rn, --repo-name TEXT The name of the repo you want to show the state for
secrets
Manage a team's GCP secrets.
Usage:
dpteam secrets [OPTIONS] COMMAND [ARGS]...
create
Create a new Secret Manager secret.
Usage:
dpteam secrets create [OPTIONS]
Options:
-p, --payload TEXT The secret data/payload
-sid, --secret-id TEXT ID of the secret, e.g. 'my-secret'
-pid, --project-id TEXT GCP project ID, e.g. 'dev-demo-example-1234'
tf
Inspect and modify a team's Terraform code.
Usage:
dpteam tf [OPTIONS] COMMAND [ARGS]...
iam-bindings
Create IAM Binding Terraform files that assign roles and permissions to a group of Dapla users.
You are prompted to supply information such as name of the group, environments, project roles, bucket roles and also a timeframe that the IAM binding should be constrained by. Terraform files are then created, one for each environment and auth group, keeping configuration neatly grouped and separated.
Example:
Let's say you want the support group of a team (e.g. demo-enhjoern-a
) to be able to administer Secret Manager
for a limited amount of time in both staging
and prod
environments. The output from this command would then
be two files: iam-support-staging.tf
and iam-support-prod.tf
.
Note that the command is strictly working with one auth group. You need to run the command multiple times if you want to create IAM bindings for multiple groups. Alternatively, you can record the config and re-run in non-interactive mode, only changing the name of the auth group between executions.
Usage:
dpteam tf iam-bindings [OPTIONS]
Options:
-g, --auth-group TEXT Name of "auth group", such as demo-enhjoern-a-
support
--github / --no-github True if the changes should be be pushed as a
branch to GitHub [default: github]
--source-config FILENAME Read config from json instead of prompting
interactively
--target-config FILENAME Name of target config json file (if you later want
to replay without interactive prompting)
-t, --team-name TEXT Name of the team you want to create bindings for
(without -iac suffix)
ts
Create or remove a Transfer Service
Usage:
dpteam ts [OPTIONS] COMMAND [ARGS]...
add
Add a transfer service for a team.
Usage:
dpteam ts add [OPTIONS]
Options:
-tn, --team-name TEXT Team name (e.g. demo-enhjoern-a)
remove
Remove a transfer service for a team.
Usage:
dpteam ts remove [OPTIONS]
Options:
-tn, --team-name TEXT Team name (e.g. demo-enhjoern-a)