CI/CD 유지 관리 콘솔 명령어
CI/CD 유지 관리 콘솔 명령어에 대해 설명합니다.
다음 명령어는 Rails 콘솔 에서 실행됩니다. Warning 데이터를 직접 변경하는 명령은 올바르게 또는 올바른 조건 하에서 실행되지 않으면 손상을 일으킬 수 있습니다. 만약을 대비해 인스턴스의 백업을 준비하고 테스트 환경에서 먼저 실행하는 것을 강력히 권장합니다. 실행 중인 모든 파이프라인 및 job 취소 # admin = User .find(user_id) # 파이프라인을 취소하려는 관리자의 id로 user_id를 교체 # 각 취소 가능한 파이프라인 순회 Ci : :Pipeline .cancelable.find_each do | pipeline | Ci::CancelPipelineService .new( pipeline: pipeline, current_user: user, cascade_to_children: false # 자식은 외부 루프에 포함됨 ) end 멈춘 대기 중인 파이프라인 취소 # project = Project .find_by_full_path( '<project_path>' ) Ci : :Pipeline .where( project_id: project.id).where( status: 'pending' ).count Ci : :Pipeline .where( project_id: project.id).where( status: 'pending' ).each {| p | p.cancel if p.stuck?} Ci : :Pipeline .where( project_id: project.id).where( status: 'pending' ).count 머지 리퀘스트 연동 테스트 # project = Project .find_by_full_path( '<project_path>' ) mr = project.merge_requests.find_by( iid: <merge_request_iid>) mr.project.try( :ci_integration ) .gitlab-ci.yml 파일 검증 # project = Project .find_by_full_path( '<project_path>' ) content = project.ci_config_for(project.repository.root_ref_sha) Gitlab::Ci::Lint .new( project: project, current_user: User .first).validate(content) 기존 프로젝트에서 AutoDevOps 비활성화 # Project .all.each do | p | p.auto_devops_attributes={ "enabled" => "0" } p.save end 파이프라인 스케줄 수동 실행 # Rails 콘솔을 통해 파이프라인 스케줄을 수동으로 실행하여 일반적으로 표시되지 않는 오류를 확인할 수 있습니다. # schedule_id는 파이프라인 스케줄 편집 페이지에서 얻을 수 있음 schedule = Ci : :PipelineSchedule .find_by( id: <schedule
