프로젝트 가져오기 및 내보내기 레이크 작업

Tier: Free, Premium, Ultimate Offering: Self-Managed

GitLab은 프로젝트 가져오기 및 내보내기를 위한 레이크 작업을 제공합니다.

호환 가능한 GitLab 인스턴스에서만 가져올 수 있습니다.

대형 프로젝트 가져오기

  • 레이크 작업은 GitLab 12.6에서 도입되었으며, GitLab.com 루비 스크립트를 대체했습니다.

이 스크립트는 GitLab 12.6에서 대형 GitLab 프로젝트 내보내기를 위해 도입되었습니다.

이 스크립트의 일부로 우리는 직접 업로드를 비활성화합니다. 이는 거대한 아카이브를 GCS에 업로드하여 idle 트랜잭션 시간 초과가 발생하는 것을 피하기 위한 조치입니다.

터미널에서 이 스크립트를 실행할 수 있습니다:

매개변수:

속성 유형 필수 설명
username 문자열 사용자 이름
namespace_path 문자열 네임스페이스 경로
project_path 문자열 프로젝트 경로
archive_path 문자열 가져올 내보낸 프로젝트 tarball의 경로
bundle exec rake "gitlab:import_export:import[root, group/subgroup, testingprojectimport, /path/to/file.tar.gz]"

Linux 패키지 설치를 사용하는 경우 다음 레이크 작업을 실행합니다:

gitlab-rake "gitlab:import_export:import[root, group/subgroup, testingprojectimport, /path/to/file.tar.gz]"

대형 프로젝트 내보내기

  • GitLab 12.9에서 도입되었습니다.

레이크 작업을 사용하여 대형 프로젝트를 내보낼 수 있습니다.

매개변수:

속성 유형 필수 설명
username 문자열 사용자 이름
namespace_path 문자열 네임스페이스 경로
project_path 문자열 프로젝트 이름
archive_path 문자열 내보낸 프로젝트 tarball을 저장할 파일 경로
gitlab-rake "gitlab:import_export:export[username, namespace_path, project_path, archive_path]"

문제 해결

가져오기/내보내기에 문제가 있는 경우 동일한 레이크 작업을 사용하여 디버그 모드를 활성화할 수 있습니다:

# 가져오기
IMPORT_DEBUG=true gitlab-rake "gitlab:import_export:import[root, group/subgroup, testingprojectimport, /path/to/file_to_import.tar.gz]"

# 내보내기
EXPORT_DEBUG=true gitlab-rake "gitlab:import_export:export[root, group/subgroup, projectnametoexport, /tmp/export_file.tar.gz]"

아래에 나열된 일반 오류를 확인하고, 그 의미와 해결 방법을 확인하세요.

Exception: undefined method 'name' for nil:NilClass

username이 유효하지 않습니다.

Exception: undefined method 'full_path' for nil:NilClass

namespace_path가 존재하지 않습니다. 예를 들어, 그룹 또는 하위 그룹 중 하나가 잘못 입력되었거나 누락되었거나, 또는 경로에서 프로젝트 이름을 지정했습니다.

이 작업은 프로젝트만 생성합니다. 새 그룹 또는 하위 그룹에 가져오려면 먼저 그룹을 생성하세요.

Exception: No such file or directory @ rb_sysopen - (filename)

archive_path에 지정된 프로젝트 내보내기 파일이 없습니다.

Exception: Permission denied @ rb_sysopen - (filename)

git 사용자가 지정된 프로젝트 내보내기 파일에 액세스할 수 없습니다.

문제를 해결하려면:

  1. 파일 소유자를 git:git로 설정합니다.
  2. 파일 권한을 0400으로 변경합니다.
  3. 파일을 공용 폴더(예: /tmp/)로 이동합니다.

Name can contain only letters, digits, emoji ...

Name can contain only letters, digits, emoji, '_', '.', '+', dashes, or spaces. It must start with a letter,
digit, emoji, or '_', and Path can contain only letters, digits, '_', '-', or '.'. It cannot start
with '-', end in '.git', or end in '.atom'.

project_path에 지정된 프로젝트 이름이 지정된 이유 중 하나로 유효하지 않습니다.

project_path에는 프로젝트 이름만 입력하세요. 예를 들어, 하위 그룹의 경로를 제공하면 실패하며 이 오류가 발생합니다 /는 프로젝트 이름에 유효하지 않은 문자입니다.

Name has already been taken and Path has already been taken

해당 이름의 프로젝트가 이미 존재합니다.

Exception: Error importing repository into (namespace) - No space left on device

디스크에 충분한 공간이 없어 가져오기를 완료할 수 없습니다.

가져오는 동안 tarball은 구성된 shared_path 디렉터리에 캐시됩니다. 디스크에 충분한 여유 공간이 있는지 확인하여 캐시된 tarball과 디스크의 풀어진 프로젝트 파일 둘 다 수용할 수 있도록 합니다.

가져오기는 성공적이지만 Total number of not imported relations: XX 메시지가 표시되며 가져오는 동안 이슈가 생성되지 않음

만약 Total number of not imported relations: XX 메시지를 받고 가져오는 동안 이슈가 생성되지 않는다면 exceptions_json.log을 확인하세요. N is out of range for ActiveModel::Type::Integer with limit 4 bytes와 같은 에러가 나타날 수 있습니다. 여기서 N은 4바이트 정수 제한을 초과하는 정수를 나타냅니다. 만약 그렇다면, 이슈의 relative_position 필드의 재배치 문제에 부딪힌 것입니다.

# 현재 relative_position의 최대 값 확인
Issue.where(project_id: Project.find(ID).root_namespace.all_projects).maximum(:relative_position)

# 재배치 프로세스 실행 및 relative_position의 최대 값이 변경되었는지 확인
Issues::RelativePositionRebalancingService.new(Project.find(ID).root_namespace.all_projects).execute
Issue.where(project_id: Project.find(ID).root_namespace.all_projects).maximum(:relative_position)

가져오기를 다시 시도하고 이슈들이 성공적으로 가져와졌는지 확인하세요.

가져오기 중 Gitaly 호출 오류 발생 시

개발 환경으로 대량 프로젝트를 가져오려는 경우, Gitaly에서 호출이 너무 많다는 오류가 발생할 수 있습니다. 예를 들어:

Error importing repository into qa-perf-testing/gitlabhq - GitalyClient#call called 31 times from single request. Potential n+1?

이 오류는 개발 환경에서 n+1 호출 제한으로 인한 것입니다. 이 오류를 해결하려면 환경 변수로 GITALY_DISABLE_REQUEST_LIMITS=1을 설정하세요. 그런 다음, 개발 환경을 다시 시작하고 가져오기를 다시 진행하세요.