README
¶
gitlabctl
Be a rockstar and efficiently manage your team's gitlab.org or self-hosted Gitlab projects, groups, users and other resources.
Tested on Gitlab 10.7.4
Getting Started
Please see Commands Manual for a nice documentation of this project.
Installing
Get the download link of your preferred platform binary from RELEASES.
OSX
curl -Lo gitlabctl https://github.com/devopsctl/gitlabctl/releases/download/${VERSION}/gitlabctl-darwin-amd64 && chmod +x gitlabctl && sudo mv gitlabctl /usr/local/bin/
Linux
curl -Lo gitlabctl https://github.com/devopsctl/gitlabctl/releases/download/${VERSION}/gitlabctl-linux-amd64 && chmod +x gitlabctl && sudo mv gitlabctl /usr/local/bin/
Windows
Download the gitlabctl-windows-amd64.exe file, rename it to gitlabctl.exe and add it to your path.
Auto Complete
Enable auto complete for bash or zsh shell. ❤️
# follow the instructions from the command output
gitlabctl completion -h
Quickstart
Authenticating to Gitlab server
Using gitlabctl login to fetch personal access token
>> gitlabctl login
>> Enter gitlab host url: http://localhost:10080
>> Enter gitlab username: root
>> Enter gitlab password: *****
/Users/jb/.gitlabctl.yaml file has been created by login command
Using environment variables. See gitlabctl -h
Using the help commands
Use -h flag when possible.
gitlabctl [command] -h or gitlabctl [command] [subcommand] -h
Usage Examples
Fetching resources with using --output, -o formatter flag.
>> gitlabctl get groups
+----+------------------+------------------------------------------------+-----------+
| ID | PATH | URL | PARENT ID |
+----+------------------+------------------------------------------------+-----------+
| 13 | Group1 | http://localhost:10080/groups/Group1 | 0 |
| 14 | Group2 | http://localhost:10080/groups/Group2 | 0 |
| 16 | Group1/SubGroup2 | http://localhost:10080/groups/Group1/SubGroup2 | 13 |
| 15 | Group1/SubGroup1 | http://localhost:10080/groups/Group1/SubGroup1 | 13 |
| 17 | Group2/SubGroup3 | http://localhost:10080/groups/Group2/SubGroup3 | 14 |
| 18 | Group2/SubGroup4 | http://localhost:10080/groups/Group2/SubGroup4 | 14 |
+----+------------------+------------------------------------------------+-----------+
>> gitlabctl get groups -o json
[
{
"id": 13,
"name": "Group1",
"path": "Group1",
"description": "Updated by go test by id",
"visibility": "private",
"lfs_enabled": false,
"avatar_url": "",
"web_url": "http://localhost:10080/groups/Group1",
"request_access_enabled": false,
"full_name": "Group1",
"full_path": "Group1",
"parent_id": 0,
"projects": null,
"statistics": null
},
{
"id": 14,
"name": "Group2",
"path": "Group2",
"description": "",
"visibility": "private",
"lfs_enabled": true,
"avatar_url": "",
"web_url": "http://localhost:10080/groups/Group2",
"request_access_enabled": false,
"full_name": "Group2",
"full_path": "Group2",
"parent_id": 0,
"projects": null,
"statistics": null
},
]
>> gitlabctl get groups -o yaml
- avatar_url: ""
description: Updated by go test by id
full_name: Group1
full_path: Group1
id: 13
lfs_enabled: false
name: Group1
parent_id: 0
path: Group1
projects: null
request_access_enabled: false
statistics: null
visibility: private
web_url: http://localhost:10080/groups/Group1
- avatar_url: ""
description: ""
full_name: Group2
full_path: Group2
id: 14
lfs_enabled: true
name: Group2
parent_id: 0
path: Group2
projects: null
request_access_enabled: false
statistics: null
visibility: private
web_url: http://localhost:10080/groups/Group2
Creating resources.
# create a group
>> gitlabctl new group devopsctl
# create a project under devopsctl group
>> gitlabctl new project gitlab-cli --namespace=devopsctl
# create a new user with username john
>> gitlabctl new user john --name="John Smith" --password="john123456" --email=john@example.com --reset-password
Contributing
Contributors are welcomed with love! Please read CONTRIBUTING.md for the process for submitting pull requests to us.
Gitlab Commands Available
Authentication
- Authentication through environment variables.
- Authentication using
gitlabctl logincommand.
Completion
-
completion --bash -
completion --zsh
Group
-
get groups [flags] -
get groups --from-group [flags] -
describe group [group id or group path] [flags] -
new group [group name] [flags] -
delete group [group id or group path] -
edit group [group id or group path] [flags]
Project
-
get projects [flags] -
get projects --from-group [flags] -
describe project [project id or project path] -
new project [project name] [flags] -
edit project [project id or project path] [flags] -
delete project [project id or project path]
Project/Repository Branch
-
get branch [project id or project path] [flags] -
describe branch [branch name] [--project] [flags] -
new branch [branch name] [--project] [flags] -
delete branch [branch name] [--project] -
edit branch [branch name] [--project] [--protect] [flags] -
edit branch [branch name] [--project] [--unprotect] [flags]
Project/Repository Tags
-
get tags [project id or project path] [flags] -
describe tag [tag name] [--project] [flags] -
new tag [tag name] [--project] [flags] -
edit tag [tag name] [--project] [flags] -
delete tag [tag name] [--project]
Project Hooks
-
get project-hooks [project id or project path] [flags] -
new project-hook [project id or project path] [flags] -
edit project-hook [hook id] [--project] [flags] -
delete project-hook [hook id] [--project]
Users
-
get users [flags] -
describe user [user id or username] -
new user [username] [flags] -
delete user [user id or username] -
edit user [user id or username] [flags]
Users SSH Keys
-
get ssh-keys [flags] -
new ssh-key [flags] -
delete ssh-key [flags]
Members
-
get members --from-group [flags] -
get members --from-project [flags] -
describe member [username] --from-group [flags] -
describe member [username] --from-project [flags] -
new member [username] --from-group [flags] -
new member [username] --from-project [flags] -
delete member [username] --from-group -
delete member [username] --from-project -
edit member [username] --from-group [flags] -
edit member [username] --from-project [flags] -
remove all-members --from-group -
remove all-members --from-project
Documentation
¶
There is no documentation for this package.
