Skip to content

feat(config): option to configure a helper to lookup the token #1359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 18, 2021

Conversation

klorenz
Copy link
Contributor

@klorenz klorenz commented Mar 6, 2021

I have stored my personal access token with all other secrets in UNIX password store.
For not having the token stored on the disk, I have implemented the option to let tokens be
looked up from a helper program.

Example:

[my_config]
url = https://gitlab.server
private_token = helper: ~/bin/pass-helper.sh
api_version = 4

whith a helper script ~/bin/pass-helper.sh:

#!/bin/bash
pass show path/to/token | head -n 1

@klorenz klorenz changed the title Option to configure a helper to lookup the token feat(config): option to configure a helper to lookup the token Mar 6, 2021
@nejch nejch self-assigned this Mar 6, 2021
@klorenz klorenz force-pushed the feat_token_lookup branch from 3479b9c to 8ecf559 Compare March 6, 2021 11:10
@codecov-io
Copy link

codecov-io commented Mar 6, 2021

Codecov Report

Merging #1359 (732e49c) into master (aa13214) will decrease coverage by 0.23%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1359      +/-   ##
==========================================
- Coverage   80.21%   79.98%   -0.24%     
==========================================
  Files          73       73              
  Lines        3801     4021     +220     
==========================================
+ Hits         3049     3216     +167     
- Misses        752      805      +53     
Flag Coverage Δ
unit 79.98% <100.00%> (-0.24%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/config.py 94.16% <100.00%> (+0.50%) ⬆️
gitlab/client.py 79.12% <0.00%> (-1.56%) ⬇️
gitlab/mixins.py 77.92% <0.00%> (-0.94%) ⬇️
gitlab/base.py 84.66% <0.00%> (+0.42%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa13214...732e49c. Read the comment docs.

@klorenz
Copy link
Contributor Author

klorenz commented Mar 6, 2021

Hi @nejch ,

to fix commitlinting issues, I have squashed my commits and created better commit messages.

Copy link
Member

@nejch nejch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this feature, this is really really neat :) People have requested native keyring support but I think this might be even more flexible as it can be used with any backend/CLI client like vault etc.

I've just added a few comments, sorry it's just a very user-facing feature so I thought it'd be good to agree on the approach from the start.

Also I think this deserves a mention in the docs, would you mind adding a section in https://github.com/python-gitlab/python-gitlab/blob/master/docs/cli-usage.rst?

@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (master@aa13214). Click here to learn what that means.
The diff coverage is 86.95%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1359   +/-   ##
=========================================
  Coverage          ?   80.10%           
=========================================
  Files             ?       73           
  Lines             ?     4061           
  Branches          ?        0           
=========================================
  Hits              ?     3253           
  Misses            ?      808           
  Partials          ?        0           
Flag Coverage Δ
unit 80.10% <86.95%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
gitlab/config.py 92.61% <86.95%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa13214...91ffb8e. Read the comment docs.

@klorenz
Copy link
Contributor Author

klorenz commented Apr 18, 2021 via email

@nejch nejch merged commit af781c1 into python-gitlab:master Apr 18, 2021
@nejch nejch mentioned this pull request Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants