Skip to end of banner
Go to start of banner

Examples

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 168 Next »

Action usage examples

Examples give users ideas on actual usage. We use automation to generate, test, and run these actions, so names and combinations may be odd or repetitive (wink). In many cases, other actions or environmental setup is required for the action to run, so you will need to adjust the action parameters and setup appropriate for your environment. 

Command line environments can be different, especially between Windows and non-Windows systems. Our Tips page talks about command line escaping differences and there are differences with respect to environment variable references ($ for non-Windows and %...% for Windows). These differences can impact examples, so recognize and adjust for your platform. In particular, all examples here are run with the standard bash shell on Linux.



addAccessToken

--action addAccessToken --name "ztokens" --permission "PROJECT_ADMIN, REPO_ADMIN"
--action addAccessToken --userId "admin" --name "ztokens" --permission "PROJECT_READ, REPO_READ" --user "admin" --password "***"

addBranch

--action addBranch --project "zcli" --repository "zcli-repo" --branch "add1" --id "bb589fae07590682ef2831520c068e8afeea5050" --message "addBranch action"
--action addBranch --project "zcli" --repository "zcli-repo" --branch "forRemove" --id "bb589fae07590682ef2831520c068e8afeea5050"

addGroup

--action addGroup --group "testgroup1" --preserveCase
--action addGroup --group "testgroup2" --preserveCase

addSshKey

--action addSshKey --userId "testuser1" --file "./src/itest/bitbucket/resources/sshkey.rsa.pub"
--action addSshKey --userId "testuser2" --file "-"

addUser

--action addUser --userId "automation" --userEmail "testuser@x.com1"
--action addUser --userId "testuser1" --userFullName "Test User1" --userEmail "testuser@x.com1" --userPassword "***"
--action addUser --userId "testuser2" --userFullName "Test User2" --userEmail "testuser@x.com2" --userPassword "***"
--action addUser --userId "testuser3" --userFullName "Test User3" --userEmail "testuser@x.com3" --userPassword "***"

addUserToGroup

--action addUserToGroup --userId "testuser3" --group "testgroup2" --autoGroup

createProject

--action createProject --project "zcli" --name "zcli name" --description "zcli description"
--action createProject --project "zcli2" --public

createPullRequest

--action createPullRequest --project "zcli" --repository "zcli-repo" --name "pr1" --from "zfeature1" --to "master"
--action createPullRequest --project "zcli" --repository "zcli-repo" --name "pr2" --description "pr2 description" --from "zfeature2" --to "master" --reviewers "user1,user2,user3"

createRepository

--action createRepository --project "zcli" --repository "zcli-repo" --name "zcli-repo"
--action createRepository --project "zcli" --repository "zcli2-repo" --public --forkable

declinePullRequest

--action declinePullRequest --project "zcli" --repository "zcli-repo" --pullRequest "pr1"

getAccessTokenList

--action getAccessTokenList
--action getAccessTokenList --regex "ztokens"
--action getAccessTokenList --userId "admin"

getBranch

--action getBranch --project "zcli" --repository "zcli-repo"

getBranchList

--action getBranchList --project "zcli" --repository "zcli-repo"

getBuildStatusList

--action getBuildStatusList --id "7a1de2bee9cedde1b27997c6acfcd2660e61a452" --dateFormat "yyyy-MM-dd HH:mm:ss"

getClientInfo

--action getClientInfo

getCommitList

--action getCommitList --project "zcli" --repository "zcli-repo"

getGroupList

--action getGroupList

getPermissionList

--action getPermissionList
--action getPermissionList --regex "testuser1"

getProject

--action getProject --project "919"
--action getProject --project "zcli name"
--action getProject --project "zcli"
--action getProject --project "zcli2"

getProjectList

--action getProjectList
--action getProjectList --permission "PROJECT_ADMIN"
--action getProjectList --permission "PROJECT_VIEW"
--action getProjectList --regex "ZCLI"
--action getProjectList --token "***"

getProjectPermissionList

--action getProjectPermissionList --project "zcli"
--action getProjectPermissionList --project "zcli" --regex "user1"

getPullRequest

--action getPullRequest --project "zcli" --repository "zcli-repo" --pullRequest "2"
--action getPullRequest --project "zcli" --repository "zcli-repo" --pullRequest "pr2" --dateFormat "yyyy-MM-dd HH:mm:ss"
--action getPullRequest --project "zcli" --repository "zcli-repo" --pullRequest "pr2xxx" --dateFormat "yyyy-MM-dd HH:mm:ss"

getPullRequestList

--action getPullRequestList --project "zcli" --repository "zcli-repo" --dateFormat "yyyy-MM-dd HH:mm:ss"
--action getPullRequestList --project "zcli" --repository "zcli-repo" --direction "INCOMING" --dateFormat "yyyy-MM-dd HH:mm:ss"
--action getPullRequestList --project "zcli" --repository "zcli-repo" --direction "outgoing" --dateFormat "yyyy-MM-dd HH:mm:ss" --verbose
--action getPullRequestList --project "zcli" --repository "zcli-repo" --regex "NOT_FOUND" --dateFormat "yyyy-MM-dd HH:mm:ss"
--action getPullRequestList --project "zcli" --repository "zcli-repo" --regex "pr2" --dateFormat "yyyy-MM-dd HH:mm:ss"
--action getPullRequestList --project "zcli" --repository "zcli-repo" --state "ALL" --dateFormat "yyyy-MM-dd HH:mm:ss"
--action getPullRequestList --project "zcli" --repository "zcli-repo" --state "MERGED" --dateFormat "yyyy-MM-dd HH:mm:ss"

getRepository

--action getRepository --project "zcli" --repository "669"
--action getRepository --project "zcli" --repository "zcli-repo updated"
--action getRepository --project "zcli" --repository "zcli-repo"
--action getRepository --project "zcli" --repository "zcli2-repo"

getRepositoryList

--action getRepositoryList --project "zcli"
--action getRepositoryList --project "zcli" --regex "NOT_FOUND"

getRepositoryPermissionList

--action getRepositoryPermissionList --project "zcli" --repository "zcli-repo"
--action getRepositoryPermissionList --project "zcli" --repository "zcli-repo" --regex "user1"

getServerInfo

--action getServerInfo --outputFormat 2 --dateFormat "yyyy-MM-dd HH:mm"
--action getServerInfo --outputFormat 999
--action getServerInfo --user "anonymous"

getSshKeyList

--action getSshKeyList --userId "testuser1"
--action getSshKeyList --userId "testuser1" --regex "xxx"

getUser

--action getUser --dateFormat "yyyy-MM-dd"
--action getUser --userId "testuser1"
--action getUser --userId "testuser3"

getUserList

--action getUserList --dateFormat "yyyy-MM-dd"
--action getUserList --group "testgroup2"
--action getUserList --group "testgroup2" --regex "testuser3"

grantPermissions

--action grantPermissions --permission "ADMIN" --userId "testuser1"
--action grantPermissions --permission "PROJECT_CREATE" --group "testgroup1"

grantProjectPermissions

--action grantProjectPermissions --project "zcli" --permission "PROJECT_ADMIN" --userId "user1"
--action grantProjectPermissions --project "zcli" --permission "PROJECT_READ" --userId "user1,user2,user3"
--action grantProjectPermissions --project "zcli" --permission "PROJECT_WRITE" --group "group1"
--action grantProjectPermissions --project "zcli2" --permission "PROJECT_ADMIN" --userId "user2"

grantRepositoryPermissions

--action grantRepositoryPermissions --project "zcli" --repository "zcli-repo" --permission "REPO_ADMIN" --userId "user1"
--action grantRepositoryPermissions --project "zcli" --repository "zcli-repo" --permission "REPO_READ" --userId "user1,user2,user3"
--action grantRepositoryPermissions --project "zcli" --repository "zcli-repo" --permission "REPO_WRITE" --group "group1"

mergePullRequest

--action mergePullRequest --project "zcli" --repository "zcli-repo" --pullRequest "pr2"

removeAccessToken

--action removeAccessToken --userId "admin" --name "596635929545"

removeBranch

--action removeBranch --project "zcli" --repository "zcli-repo" --branch "forRemove"

removeSshKey

--action removeSshKey --id "312"

removeSshKeys

--action removeSshKeys --userId "testuser1"
--action removeSshKeys --userId "testuser2"

removeUserFromGroup

--action removeUserFromGroup --userId "testuser3" --group "testgroup2"

revokePermissions

--action revokePermissions --userId "testuser1"

revokeProjectPermissions

--action revokeProjectPermissions --project "zcli" --userId "user1"

revokeRepositoryPermissions

--action revokeRepositoryPermissions --project "zcli" --repository "zcli-repo" --userId "user1"

run

--action run -i "-a getServerInfo --outputFormat 2 --outputType text" -i "-a getReplacementVariableList --outputType text"
--action run --file "./src/itest/bitbucket/resources/run.txt"
--action run --file "./src/itest/bitbucket/resources/runWithFindReplace.txt" --findReplace "##action##:getServerInfo"
--action run --input "upm -a getAppList --token OTUwNzA3NTg2NjkwOgJvDJWt8w/FChSK4aItFeJgfpMe"
--action run --token "***" --input "upm -a getAppList"

runFromBranchList

--action runFromBranchList --project "zcli" --repository "zcli-repo" --common "-a getBranch --project zcli --repository zcli-repo --branch @branch@"
--action runFromBranchList --project "zcli" --repository "zcli-repo" --order "Alphabetical" --common "-a getBranch --project zcli --repository zcli-repo --branch @branch@"

runFromGroupList

--action runFromGroupList --limit 1 --common "-a getUserList --group @group@" --regex "testgroup2"

runFromList

--action runFromList --list "Client, Server" --common "-a get@entry@Info"

runFromProjectList

--action runFromProjectList --common "-a getProject --project \"@project@\"" --regex "EXPERIMENT" --continue
--action runFromProjectList --common "-a getProject --project \"@projectId@\"" --continue --regex "EXPERIMENT"
--action runFromProjectList --permission "PROJECT_ADMIN" --common "--action getProject --project @project@"

runFromRepositoryList

--action runFromRepositoryList --project "@all" --common "-a getRepository --project @projectId@ --repository @repositoryId@"
--action runFromRepositoryList --project "@all" --common "-a getRepository --project @projectId@ --repository @repositoryId@" --limit 1
--action runFromRepositoryList --project "EXPERIMENT" --common "-a getRepository --project @project@ --repository \"@repository@\"" --continue
--action runFromRepositoryList --project "EXPERIMENT" --common "-a getRepository --project @projectId@ --repository \"@repositoryId@\"" --continue --regex "ex1"

runFromUserList

--action runFromUserList --group "testgroup2" --input "-a getUser --userId \"@userId@\"" --input "-a getUser --userId @userKey@" --input "-a getUser --userId \"@userDisplayName@\""
--action runFromUserList --input "-a getUser --userId \"@userId@\"" --input "-a getUser --userId @userKey@" --input "-a getUser --userId \"@userDisplayName@\""

setBuildStatus

--action setBuildStatus --id "7a1de2bee9cedde1b27997c6acfcd2660e61a452" --state "INPROGRESS" --key "myKey" --url "http://xxx"
--action setBuildStatus --id "7a1de2bee9cedde1b27997c6acfcd2660e61a452" --state "successful" --key "myKey" --url "http://xxx"

updateProject

--action updateProject --project "zcli" --name "zcli name updated"
--action updateProject --project "zcli2" --private

updatePullRequest

--action updatePullRequest --project "zcli" --repository "zcli-repo" --pullRequest "pr2" --name "pr2xxx"
--action updatePullRequest --project "zcli" --repository "zcli-repo" --pullRequest "pr2xxx" --name "pr2"

updateRepository

--action updateRepository --project "zcli" --repository "zcli-repo updated" --name "zcli-repo"
--action updateRepository --project "zcli" --repository "zcli-repo" --name "zcli-repo updated"
--action updateRepository --project "zcli" --repository "zcli2-repo" --private --notForkable

updateUser

--action updateUser --userId "testuser1" --userEmail "former.employee.testuser@x.com1"
--action updateUser --userId "testuser1" --userFullName "Test User1" --userEmail "testuser@x.com1"

validateLicense

--action validateLicense
  • No labels