Commit 915f1bcd authored by Douwe Maan's avatar Douwe Maan

Merge branch 'fix-github-import' into 'master'

Fix token interpolation when setting the Github remote

See merge request !11311
parents db464758 851a8b1f
---
title: Fix token interpolation when setting the Github remote
merge_request:
author:
require_relative 'error' require_relative 'error'
module Github module Github
class Import class Import
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
...@@ -6,6 +7,7 @@ module Github ...@@ -6,6 +7,7 @@ module Github
class MergeRequest < ::MergeRequest class MergeRequest < ::MergeRequest
self.table_name = 'merge_requests' self.table_name = 'merge_requests'
self.reset_callbacks :create
self.reset_callbacks :save self.reset_callbacks :save
self.reset_callbacks :commit self.reset_callbacks :commit
self.reset_callbacks :update self.reset_callbacks :update
...@@ -16,6 +18,7 @@ module Github ...@@ -16,6 +18,7 @@ module Github
self.table_name = 'issues' self.table_name = 'issues'
self.reset_callbacks :save self.reset_callbacks :save
self.reset_callbacks :create
self.reset_callbacks :commit self.reset_callbacks :commit
self.reset_callbacks :update self.reset_callbacks :update
self.reset_callbacks :validate self.reset_callbacks :validate
...@@ -79,7 +82,7 @@ module Github ...@@ -79,7 +82,7 @@ module Github
def fetch_repository def fetch_repository
begin begin
project.create_repository unless project.repository.exists? project.create_repository unless project.repository.exists?
project.repository.add_remote('github', "https://{options.fetch(:token)}@github.com/#{repo}.git") project.repository.add_remote('github', "https://#{options.fetch(:token)}@github.com/#{repo}.git")
project.repository.set_remote_as_mirror('github') project.repository.set_remote_as_mirror('github')
project.repository.fetch_remote('github', forced: true) project.repository.fetch_remote('github', forced: true)
rescue Gitlab::Shell::Error => e rescue Gitlab::Shell::Error => e
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment