Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Abandon the gitlab CLI#1461

gpocentek started this conversation inGeneral
Feb 22, 2019· 14 comments· 3 replies
Discussion options

The CLI is not in a good shape today, compared the rest of the library. Alternatives exist and seem to do a better job.

@max-wittig and I don't use the CLI, and don't have much to improve it so we are considering removing it from the python-gitlab code.

The decision is not made, and we hope to get some feedback from users in this issue.

You must be logged in to vote

Replies: 14 comments 3 replies

Comment options

I'd be a bit sad to see this go. We're just getting ready to launch aGitLab instance on our campus, and for my team, having quick CLI tools tohelp with some administrative work has the potential to be extremelyhelpful, as we've already seen with some of our other services like Googleand Box. If the CLI is to be removed, could anyone make a suggestion as toa good alternative?
On Fri, Feb 22, 2019 at 9:51 AM Gauvain Pocentek ***@***.***> wrote: The CLI is not in a good shape today, compared the rest of the library. Alternatives exist and seem to do a better job.@max-wittig <https://github.com/max-wittig> and I don't use the CLI, and don't have much to improve it so we are considering removing it from the python-gitlab code. The decision is not made, and we hope to get some feedback from users in this issue. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#708>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AjpHj7QsBuDJTl4srbYf3E6oDvzFPsfIks5vQAP1gaJpZM4bJwDk> .
-- *Rob Carleski*ITS Collaboration ServicesUniversity of Michigan734.764.2777
You must be logged in to vote
0 replies
Comment options

Like mentioned above, we haven't made a final decision yet. Buthttps://github.com/michaellihs/golab seems to be pretty good.

You must be logged in to vote
0 replies
Comment options

I was just about to fill a couple of bugs in the gitlab CLI. They can be fixed easily.

What exactly is meant by "not in a good shape"? Does it mean that the code is so buggy that it is not worth fixing? Or that there are some bugs but no one to fix them? Or that the CLI API is incomplete?

If the CLI is in relatively good shape but some functionalities are missing or do not work because of simple bugs, then I'd vote for fixing them and letting the CLI alive.

I actually found your project a couple of days ago because I was searching for a command-line gitlab client. I like yours, especially because it is written in python which I know (in contrast to ruby or go).

You must be logged in to vote
0 replies
Comment options

Thanks for your opinion on this. The thing about CLI programs is that they are language independent and we're just two people maintaining this library (and neither of use uses the CLI). It would be cool, if we would get more people to help here.

You must be logged in to vote
0 replies
Comment options

I was shortly looking at golab docs, and I'm missing such basic functionality like listing groups hierarchy. However, I haven't installed golab yet, so maybe golab shows the group hierarchy in its console output. But the docs for command "golab group ls" do not suggest anything like that.

You must be logged in to vote
0 replies
Comment options

@xarx00 here is a list of bugs if you want to look into fixing the CLI:https://github.com/python-gitlab/python-gitlab/issues?q=is%3Aissue+is%3Aopen+label%3Acli

We can of course help if you have questions :)

Thanks!

You must be logged in to vote
0 replies
Comment options

I'm afraid I have no capacity to contribute, but I do use the CLI and I'd like to see the functionality preserved if possible. I'd much rather install a single library with a unified conceptual approach than have to install two packages which are based on different languages and, inevitably, different conceptual approaches to the CLI.

You must be logged in to vote
0 replies
Comment options

Hi all,

Not much progress on this in the last 3 months. Here is the status:

  • basic CLI stuff works OK
  • we have a bunch of open bugs, and some CLI commands don't work at all
  • CLI help is not good
  • we agreed that we need switch to another CLI lib, argparse is not good enough for what we need
  • I had a look at other CLI projects, most (all?) of them are not actively maintained

Today the CLI and lib are tightly linked (plenty of attributes defined in the python classes), and the CLI code uses lib introspection to handle argument parsing. It is painful, and doesn't work well. I think we should keep the lib simple since it works fine this way, and we should move the "complexities" (types, mandatory/option arguments, ...) to the CLI, where it makes more sense.

You must be logged in to vote
0 replies
Comment options

Let's preserve the CLI, even though it might be worse than something likehttps://github.com/michaellihs/golab, but people still use the python-gitlab CLI a lot.

You must be logged in to vote
0 replies
Comment options

I recently stumbled upon this project as I was looking for a tool to help me do some basic GitLab admin from the command line (most notably checking up on runners and seeing job failures).

The fact that there were extensive docs to go hand-in-hand with the API docs gave me a warm feeling. I found the CLI easy to pick up largely because of the docs, although the help for the entire list of resources is a little unwieldy and I see a couple of issues already raised around that. Aside from that it's been pretty easy from using the docs to work out what--scope and--sudo are about. Yes, they could be nicer, e.g. listing the values for--scope but it's not a showstopper for me.

My only real stumbling block with the CLI was the sparsity of the output in the default (legacy) mode. I was confused by the lack of properties on display and spent ages looking into the--fields argument to try and get more data out before finally realising (after trying the JSON output) that that was all there really was to see. I'm not sure what role the legacy output plays but I'm not sure it's a good default or useful. (I'm used to theFormat-List andFormat-Table outputs in PowerShell for initial exploration and simple summaries.)

Once I had the JSON output it was just a hop, skip, and jump to add somejq andcolumn magic to give me the tabular output I wanted (with the essential attributes). I've now wrapped these one-liners up into some simple bash scripts that anyone can easily consume.

While the library is nice to have as a fallback I do not really know Python and so the CLI is more useful to someone like myself coming from thecurl/bash angle. I've found it much easier it explore the API by usinggitlab --help | grep --color=always <resource> and then drilling into the specific resources and verbs with--help before turning to the GitLab API docs for the finer details.

I'm just one data point but I thought I'd add my vote for it's usefulness as it stands (#593 notwithstanding 🙂). Thanks again for all your hard work, whatever happens.

Note: I was not even aware ofgolab until reading this thread. I'm going to try it out as Go is something I'm more au fait with but it looks like I've still got to do thejq dance so I'm not sure what else it'll buy me.

You must be logged in to vote
0 replies
Comment options

If you are interested, you may look at my forkhttps://github.com/xarx00/python-gitlab. I fixed some bugs, improved the outputs and implemented various new functions there. The new functions are mainly related to the correspondence between the remote GitLab and its local copy.

But I had to change the core slightly, so this fork is now incompatible with the original and cannot be merged easily. If there is enough interest, I can make it mergeable, but the behaviour of the CLI changed a little, which might be a problem for the python-gitlab maintainers. You should be aware, however, that I'm not going to maintain an official clone if this fork won't be merged in to the original python-gitlab.

If you're going to test it anyway, you'll need to create a.gitlab file in the root directory of your Gitlab subtree copy. It should look like this:

[global]default = originbase_group = BI/ESBtimeout = 5api_version = 4[origin]url = https://gitlab.yourdomain.comssl_verify = W:\MyProject\config\ca-bundle.crtprivate_token = ZX3252U9D5xTV5DUQUzT

Thebase_group property must contain the gitlab path for the root folder of the local copy. (The idea is that you have a local copy of a subtree structure of the remote Gitlab repo. It is not necessary that all git repos from this subtree are copied locally.) Use the-c @ command-line parameter to refer to the.gitlab file (if your current directory is within the local tree), or use-h for help. The main new command-group (command-object) is namedbulk. So, for example

gitlab -c @ bulk pull --group-path BI/ESB/dev/servicesgitlab -c @ bulk status --group-path BI/ESB/dev/services --no-git-errors=true --no-ci-errors=true

Tested on Windows, only.

You must be logged in to vote
0 replies
Comment options

@xarx00 Please contribute here if you have some fixes.

You must be logged in to vote
0 replies
Comment options

I've already contributed several fixes. The other fixes would require more or less substantial changes in the core. I don't remember the details, as it is already several months since I made last changes. But that was why I forked, because I was unable to make the fixes and improvements backwards compatible.

My aim was to add functionality related to local copy of the remote repository, hence the functionality that is not part of the GitLab REST API. I needed to "bend" some functionality in python-gitlab in order I was able to do that. And, along the way, I did also several fixes and improvements.

You must be logged in to vote
0 replies
Comment options

I know of two active CLI tools out there:

You must be logged in to vote
3 replies
@nejch
Comment options

I think it probably doesn't make sense to abandon the CLI entirely, because it seems no other gitlab CLI client covers nearly as many endpoints, exceptgitbeaker (which might cover more, not sure).golab hasn't been maintained since 2018,glab is closer togh and covers only a few project-related endpoints (but has a slick interface), andlab is almost a gitlab wrapper forgit (likehub is with github). So it seems there's not much overlap between API wrappers and git client wrappers.

A comparison of core commands below (python-gitlab and gitbeaker also nest a lot more subcommands under the core commands, see alsohttps://python-gitlab.readthedocs.io/en/latest/cli-objects.html). *this table's not fair to gitbeaker, because it nests some commands under core ones and combines project/group resources of the same type.

python-gitlabgitbeakergolabglab
applicationapplication-settingsbranchesmr
application-appearancebranchescommitsissue
application-settingsbroadcast-messagesdeploy-keyspipeline
audit-eventcommit-discussionsenvironmentsrelease
broadcast-messagecommitsgendocrepo
current-usercontainer-registrygrouplabel
current-user-emaildeploy-keysgroup-membersalias
current-user-gp-gkeydeploymentslabels
current-user-keyenvironmentslogin
current-user-statusepic-discussionsmerge-requests
deploy-keyepic-issuesnamespaces
deploy-tokenepic-notesopen
dockerfileepicspersonal-access-token
eventeventsproject
featurefeature-flagsprotected-branches
geo-nodefreeze-periodsuser
gitignoregeo-nodesversion
gitlabciymlgitlabci-yml-templateszsh-completion
groupgitignore-templates
group-access-requestgroup-access-requests
group-audit-eventgroup-badges
group-badgegroup-custom-attributes
group-boardgroup-deploy-tokens
group-board-listgroup-issue-boards
group-clustergroup-labels
group-custom-attributegroup-members
group-deploy-tokengroup-milestones
group-epicgroup-runners
group-epic-issuegroup-variables
group-epic-resource-label-eventgroups
group-exportissue-award-emojis
group-importissue-discussions
group-issueissue-note-award-emojis
group-labelissue-notes
group-memberissues
group-merge-requestissues-statistics
group-milestonejobs
group-notification-settingskeys
group-packagelabels
group-projectlicense
group-runnerlicense-templates
group-subgrouplint
group-variablemarkdown
hookmerge-request-approvals
issuemerge-request-award-emojis
l-da-pgroupmerge-request-discussions
licensemerge-request-notes
merge-requestmerge-requests
namespacenamespaces
notification-settingsnotification-settings
pages-domainpackages
personal-access-tokenpages-domains
projectpipeline-schedule-variables
project-access-requestpipeline-schedules
project-additional-statisticspipelines
project-approvalproject-access-requests
project-approval-ruleproject-badges
project-audit-eventproject-custom-attributes
project-badgeproject-deploy-tokens
project-boardproject-hooks
project-board-listproject-import-export
project-branchproject-issue-boards
project-clusterproject-members
project-commitproject-milestones
project-commit-commentproject-snippet-award-emojis
project-commit-discussionproject-snippet-discussions
project-commit-discussion-noteproject-snippet-notes
project-commit-statusproject-snippets
project-custom-attributeproject-variables
project-deploy-tokenprojects
project-deploymentprotected-branches
project-environmentprotected-tags
project-eventpush-rules
project-exportrelease-links
project-filereleases
project-forkrepositories
project-hookrepository-files
project-importrunners
project-issuesearch
project-issue-award-emojiservices
project-issue-discussionsidekiq-metrics
project-issue-discussion-notesnippets
project-issue-linksystem-hooks
project-issue-notetags
project-issue-note-award-emojitodos
project-issue-resource-label-eventtriggers
project-issue-resource-milestone-eventuser-custom-attributes
project-issue-resource-state-eventuser-emails
project-issues-statisticsuser-gpg-keys
project-jobuser-impersonation-tokens
project-keyuser-s-s-h-keys
project-labelusers
project-memberversion
project-merge-requestvulnerability-findings
project-merge-request-approvalwikis
project-merge-request-approval-rule
project-merge-request-award-emoji
project-merge-request-diff
project-merge-request-discussion
project-merge-request-discussion-note
project-merge-request-note
project-merge-request-note-award-emoji
project-merge-request-resource-label-event
project-merge-request-resource-milestone-event
project-merge-request-resource-state-event
project-milestone
project-note
project-notification-settings
project-package
project-package-file
project-pages-domain
project-pipeline
project-pipeline-bridge
project-pipeline-job
project-pipeline-schedule
project-pipeline-schedule-variable
project-pipeline-variable
project-protected-branch
project-protected-tag
project-push-rules
project-registry-repository
project-registry-tag
project-release
project-release-link
project-remote-mirror
project-runner
project-service
project-snippet
project-snippet-award-emoji
project-snippet-discussion
project-snippet-discussion-note
project-snippet-note
project-snippet-note-award-emoji
project-tag
project-trigger
project-user
project-variable
project-wiki
runner
runner-job
snippet
todo
user
user-activities
user-custom-attribute
user-email
user-event
user-gp-gkey
user-impersonation-token
user-key
user-membership
user-project
user-status
variable

However, we just got access tohttps://pypi.org/project/gitlab/ (seepypi/support#793 (comment)) for more details). Originally, the idea was this solves the confusion with people doingpip install gitlab.

But I had the idea it could be used to split the project into a core API library (this project, which can then focus only on covering API endpoints) and a high-level wrapper providing a CLI and maybe other goodies that people request sometimes, likehttps://github.com/boto/botocore is a core API library used by aws-cli and boto3.

Then all the custom command building and formatting in the CLI (which is quite painful to maintain for edge cases) can go away in favor ofclick or similar, without adding any dependencies to python-gitlab. people doingpip install gitlab would then get the CLI but also the core library.

Any thoughts on this? Of course the naming of repos would be a question then :D Just throwing this out here since a lot of the CLI related issues have been open for a while, this might help resolve things.

@profclems
Comment options

glab provides thealias andapi commands which helps users to write their custom commands.

Theapi command gives users direct authenticated access to the GitLab API. So as aglab user, I can define aliases for custom commands that are not provided byglab.

For instance,glab currently has no command to manage GitLab packages:delete,upload.

Since these commands are not available yet, you can set an aliases for each of them with theapi command. For example:

glab alias set delete-package 'api projects/:id/packages/$1 -X DELETE'

You can then use it as:

glab delete-package 5678

You can have an alias to theapi command to upload generic packages

glab alias set upload-package 'api projects/:id/packages/generic/$1 -X PUT --input $2'

With this, you have two arguments with the first and second arguments takingpackage_name/package_version/file_name andpath_to_file respectively

glab upload-package myprog/1.0.0/myprog-w64.zip myprog-w64.zip
@ernstki
Comment options

I know of two active CLI tools out there:

* https://github.com/profclems/glab/* https://github.com/zaquestion/lab

…and as of this writing, neither supports GitLab running on a subdirectory off the root. So the CLI frompython-gitlab is key for me. I hope it's able to hang in there.:)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
General
Labels
None yet
11 participants
@gpocentek@bufferoverflow@JohnVillalovos@chrisoldwood@ernstki@max-wittig@xarx00@nejch@jamesquilty@carleski@profclems
Converted from issue

This discussion was converted from issue #708 on May 17, 2021 17:45.


[8]ページ先頭

©2009-2025 Movatter.jp