- 대규모 프로젝트 가져오기
- 대규모 프로젝트 내보내기
-
문제 해결
Exception: undefined method 'name' for nil:NilClass
Exception: undefined method 'full_path' for nil:NilClass
Exception: No such file or directory @ rb_sysopen - (filename)
Exception: Permission denied @ rb_sysopen - (filename)
Name can contain only letters, digits, emoji ...
Name has already been taken and Path has already been taken
Exception: Error importing repository into (namespace) - No space left on device
- 가져오기는 성공했지만
Total number of not imported relations: XX
메시지와 함께 이슈가 가져오지 않은 경우 - Gitaly 호출 오류 발생 시
프로젝트 가져오기 및 내보내기 Rake 작업
GitLab은 프로젝트 가져오기 및 내보내기를 위한 Rake 작업을 제공합니다.
호환 가능한 GitLab 인스턴스에서만 가져올 수 있습니다.
대규모 프로젝트 가져오기
이 스크립트는 대규모 GitLab 프로젝트 내보내기를 위해 GitLab 12.6에 도입되었습니다.
이 스크립트의 일부로, 우리는 직접 업로드를 비활성화합니다. 이를 통해 거대한 아카이브를 GCS에 업로드하지 않으므로 대기 트랜잭션 타임아웃을 초래할 수 있습니다.
터미널에서 이 스크립트를 실행할 수 있습니다.
매개변수:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
username
| 문자열 | 예 | 사용자 이름 |
namespace_path
| 문자열 | 예 | 네임스페이스 경로 |
project_path
| 문자열 | 예 | 프로젝트 경로 |
archive_path
| 문자열 | 예 | 가져올 내보낸 프로젝트 tarball의 경로 |
bundle exec rake "gitlab:import_export:import[root, group/subgroup, testingprojectimport, /path/to/file.tar.gz]"
리눅스 패키지 설치를 실행 중인 경우 다음 Rake 작업을 실행하세요.
gitlab-rake "gitlab:import_export:import[root, group/subgroup, testingprojectimport, /path/to/file.tar.gz]"
대규모 프로젝트 내보내기
- GitLab 12.9에서 도입되었습니다.
대규모 프로젝트를 내보내기 위해 Rake 작업을 사용할 수 있습니다.
매개변수:
속성 | 유형 | 필수 | 설명 |
---|---|---|---|
username
| 문자열 | 예 | 사용자 이름 |
namespace_path
| 문자열 | 예 | 네임스페이스 경로 |
project_path
| 문자열 | 예 | 프로젝트 이름 |
archive_path
| 문자열 | 예 | 내보낸 프로젝트 tarball을 저장할 파일 경로 |
gitlab-rake "gitlab:import_export:export[username, namespace_path, project_path, archive_path]"
문제 해결
가져오기/내보내기에 문제가 발생하는 경우 동일한 Rake 작업을 사용하여 디버그 모드를 활성화할 수 있습니다.
# 가져오기
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
사용자가 지정된 프로젝트 내보내기 파일에 액세스할 수 없습니다.
이 문제를 해결하려면:
- 파일 소유자를
git:git
로 설정합니다. - 파일 권한을
0400
으로 변경합니다. - 파일을 공용 폴더(예:
/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
와 같은 오류를 볼 수 있습니다. 그렇다면, 이슈의 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
를 설정합니다. 그런 다음 개발 환경을 재시작하고 다시 가져오기를 실행합니다.