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

import/export issue from self hosted gitlab instance ? #65

Open
dtrckd opened this issue Feb 5, 2020 · 6 comments
Open

import/export issue from self hosted gitlab instance ? #65

dtrckd opened this issue Feb 5, 2020 · 6 comments

Comments

@dtrckd
Copy link

dtrckd commented Feb 5, 2020

Hi,

Is it possible to use the import/export functionality to work with self hosted instance of gitlab with given url ?
I couldn't manage to do it.

Great code !

@dspinellis
Copy link
Owner

Thank you! I see that the https://gitlab.com/api API endpoint URL is hard-coded in a number of places. We'd need to add a -u option to set the API endpoint URL for the import and export commands. I'd welcome a pull request to add this functionality.

@dtrckd
Copy link
Author

dtrckd commented Feb 6, 2020

Thanks for your response @dspinellis.

I checked the code and I could change the endpoint by adding manually a variable in the config file present in the issues folder and the corresponding parser in import-export.sh.
It seems to works well and prevent for entering the endpoint/url option again and again.
What do you think about this approach ?

PS: I think I found a bug. My server returns a HEADER start with HTTP/2 200 , but in the line 96 (*) of import-export.sh it throw an "connection failure" because it looks for string "Status" but this string is not present in the header...

(*) if ! grep -q '^\(Status: 200\|HTTP/[[:digit:]].[[:digit:]] 200 OK\)' "$prefix-header" ; then

@dspinellis
Copy link
Owner

Thank you for the feedback!

Let's keep the header problem in a separate issue. (I believe the header status is mandatory, so the problem may be something else.)

Storing the endpoint in the configuration file is a good idea. However, I'd like to have a way to set it from the command line, as is done with git-config. Is there a precedent for Git setting options only by directly editing the file? (I am doing it, but I understand there are better alternatives.)

@dtrckd
Copy link
Author

dtrckd commented Feb 6, 2020

Yes, I think having something like git issue config provider_domain http://myowngitlab.xyz would be great.

In git I believe we can directly change the config either with the command line or by editing the config file.

It's probably not the better way to do it, but still, this if it can help, here is the main modification I did in the import-export.sh file to check the config file :

GITLAB_PROVIDER="https://gitlab.com"                                                                                                                                                                               
while read -r name value                                                                                                                                                                                           
do                                                                                                                                                                                                                 
    if [ "$name" = "provider_domain" ]; then                                                                                                                                                                       
        GITLAB_PROVIDER=$(echo $value | sed  "s/^ *= *//")                                                                                                                                                         
    fi                                                                                                                                                                                                             
    if [ "$name" = "gitlab_token" ]; then                                                                                                                                                                          
        GL_CURL_AUTH="PRIVATE-TOKEN: $(echo $value | sed  "s/^ *= *//")"                                                                                                                                           
    fi                                                                                                                                                                                                             
    if [ "$name" = "github_token" ]; then                                                                                                                                                                          
        GH_CURL_AUTH="Authorization: token $(echo $value | sed  "s/^ *= *//")"                                                                                                                                     
    fi                                                                                                                                                                                                             
done < .issues/config 

@dspinellis
Copy link
Owner

Nice! If you use case rather than if and expr rather than echo | sed it will be perfect. Are the variables visible outside the while loop?

@dtrckd
Copy link
Author

dtrckd commented Feb 6, 2020

Yes, at the beginning of the script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants