diff options
3 files changed, 12 insertions, 0 deletions
diff --git a/changelogs/unreleased/sh-fix-github-importer-cache-expiry.yml b/changelogs/unreleased/sh-fix-github-importer-cache-expiry.yml new file mode 100644 index 00000000000..936482e8654 --- /dev/null +++ b/changelogs/unreleased/sh-fix-github-importer-cache-expiry.yml @@ -0,0 +1,5 @@ +--- +title: Flush the repository cache after GitHub importer runs +merge_request: +author: +type: fixed diff --git a/lib/gitlab/github_import/importer/repository_importer.rb b/lib/gitlab/github_import/importer/repository_importer.rb index 9cf2e7fd871..602abcd0dba 100644 --- a/lib/gitlab/github_import/importer/repository_importer.rb +++ b/lib/gitlab/github_import/importer/repository_importer.rb @@ -47,6 +47,7 @@ module Gitlab refmap = Gitlab::GithubImport.refmap project.repository.fetch_as_mirror(project.import_url, refmap: refmap, forced: true, remote_name: 'github') + project.repository.after_import true rescue Gitlab::Git::Repository::NoRepository, Gitlab::Shell::Error => e diff --git a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb index 168e5d07504..5eb0aef7a02 100644 --- a/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb +++ b/spec/lib/gitlab/github_import/importer/repository_importer_spec.rb @@ -165,6 +165,9 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do .to receive(:ensure_repository) expect(repository) + .to receive(:after_import) + + expect(repository) .to receive(:fetch_as_mirror) .with(project.import_url, refmap: Gitlab::GithubImport.refmap, forced: true, remote_name: 'github') @@ -175,6 +178,9 @@ describe Gitlab::GithubImport::Importer::RepositoryImporter do expect(project).to receive(:ensure_repository) .and_raise(Gitlab::Git::Repository::NoRepository) + expect(repository) + .not_to receive(:after_import) + expect(importer) .to receive(:fail_import) .and_return(false) |