Skip to content
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

Config from private github repository via raw #186

Open
Jasstkn opened this issue Apr 5, 2021 · 6 comments
Open

Config from private github repository via raw #186

Jasstkn opened this issue Apr 5, 2021 · 6 comments

Comments

@Jasstkn
Copy link

Jasstkn commented Apr 5, 2021

Hi!

I'm trying to configure getting configuration as a code from private repository in my organization.

I was able to successfully add config with temporary token like:
https://raw.githubusercontent.com/ORG/REPO/BRANCH/config.yaml?token=XXXXX

But this token expires every 7 days and I want to replace it via access token from my service account user.
I've created token using doc here: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token, and paste url in format:

https://[email protected]/ORG/REPO/BRANCH/config.yaml

And I've got 404. I'm gonna to dig into this problem a bit later, but maybe you already have a solution? If not I would like to contribute to allow pass some headers to this script: https://github.com/odavid/my-bloody-jenkins/blob/master/bin/fetchconfig.py

@Jasstkn
Copy link
Author

Jasstkn commented Apr 5, 2021

I've been playing around and found out that if you use Basic auth it works fine and return 200.

>>> headers = {'Authorization': 'token XXXXXX'}
>>> requests.get(source, headers=header)
<Response [404]>
>>> requests.get(source, auth=('user', 'access_token'))
<Response [200]>

@odavid what do you think about such problem? I see not many solutions for that but the main blocker from my point of view is to map auth configuration with the exact URL from the list of URLs...

@odavid
Copy link
Owner

odavid commented Apr 13, 2021

Hi @Jasstkn
I think that maybe we need to have an environment variable named

JENKINS_ENV_FETCH_CONF_HTTP_HEADERS="HEADER: VAL, HEADER2, VAL2..."

Then in the script we can check if this env var exists, parse it and add the headers to the request.
Hope it helps

@Jasstkn
Copy link
Author

Jasstkn commented Apr 13, 2021

Hi @Jasstkn
I think that maybe we need to have an environment variable named

JENKINS_ENV_FETCH_CONF_HTTP_HEADERS="HEADER: VAL, HEADER2, VAL2..."

Then in the script we can check if this env var exists, parse it and add the headers to the request.
Hope it helps

Oh, it's actually a quite nice solution. Don't you mind if I try to contribute?

@odavid
Copy link
Owner

odavid commented Apr 13, 2021

Hi @Jasstkn
I think that maybe we need to have an environment variable named

JENKINS_ENV_FETCH_CONF_HTTP_HEADERS="HEADER: VAL, HEADER2, VAL2..."

Then in the script we can check if this env var exists, parse it and add the headers to the request.
Hope it helps

Oh, it's actually a quite nice solution. Don't you mind if I try to contribute?

Will be nice...

@Jasstkn
Copy link
Author

Jasstkn commented Apr 13, 2021

Hi @Jasstkn
I think that maybe we need to have an environment variable named

JENKINS_ENV_FETCH_CONF_HTTP_HEADERS="HEADER: VAL, HEADER2, VAL2..."

Then in the script we can check if this env var exists, parse it and add the headers to the request.
Hope it helps

Oh, it's actually a quite nice solution. Don't you mind if I try to contribute?

Will be nice...

Ok, I'll try to do it then. Thank you for the great idea!

@gfnord
Copy link

gfnord commented Jul 6, 2022

Hi @Jasstkn, have you been able to implement the JENKINS_ENV_FETCH_CONF_HTTP_HEADERS? If not, can I help?
Thanks!

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

No branches or pull requests

3 participants