아티팩트를 다른 스테이지로 어떻게 전달할 수 있습니까?
.gitlab-ci.yml 파일과 함께 GitLab CI를 사용하여 별도의 스크립트로 다른 단계를 실행하고 싶습니다. 첫 번째 단계는 테스트를 수행하기 위해 이후 단계에서 사용해야하는 도구를 생성합니다. 생성 된 도구를 이슈로 선언했습니다.
이제 이후 단계 작업에서 해당 도구를 어떻게 실행할 수 있습니까? 올바른 경로는 무엇이며 그 주변에 어떤 파일이 있습니까?
예를 들어 첫 번째 단계는 artifacts / bin / TestTool / TestTool.exe를 빌드하고 해당 디렉토리에는 다른 필수 파일 (DLL 및 기타)이 포함되어 있습니다. 내 .gitlab-ci.yml 파일은 다음과 같습니다.
releasebuild:
script:
- chcp 65001
- build.cmd
stage: build
artifacts:
paths:
- artifacts/bin/TestTool/
systemtests:
script:
- chcp 65001
- WHAT TO WRITE HERE?
stage: test
관련이있는 경우 빌드 및 테스트는 Windows에서 실행됩니다.
사용 dependencies
. 이 구성 테스트 단계를 통해 빌드 단계에서 생성 된 추적되지 않은 파일을 다운로드합니다.
build:
stage: build
artifacts:
untracked: true
script:
- ./Build.ps1
test:
stage: test
dependencies:
- build
script:
- ./Test.ps1
모든 이전 단계의 아티팩트가 기본적으로 전달되기 때문에 올바른 순서로 단계를 정의하기 만하면됩니다. 이해하는 데 도움이 될 수있는 아래 예를 시도해보세요.
image: ubuntu:18.04
stages:
- build_stage
- test_stage
- deploy_stage
build:
stage: build_stage
script:
- echo "building..." >> ./build_result.txt
artifacts:
paths:
- build_result.txt
expire_in: 1 week
unit_test:
stage: test_stage
script:
- ls
- cat build_result.txt
- cp build_result.txt unittest_result.txt
- echo "unit testing..." >> ./unittest_result.txt
artifacts:
paths:
- unittest_result.txt
expire_in: 1 week
integration_test:
stage: test_stage
script:
- ls
- cat build_result.txt
- cp build_result.txt integration_test_result.txt
- echo "integration testing..." >> ./integration_test_result.txt
artifacts:
paths:
- integration_test_result.txt
expire_in: 1 week
deploy:
stage: deploy_stage
script:
- ls
- cat build_result.txt
- cat unittest_result.txt
- cat integration_test_result.txt
다른 단계의 작업간에 아티팩트 를 전달하는 경우 문서 에서 설명한대로 아티팩트 와 함께 종속성 을 사용 하여 아티팩트 를 전달할 수 있습니다 .
그리고 더 간단한 예 :
image: ubuntu:18.04
build:
stage: build
script:
- echo "building..." >> ./result.txt
artifacts:
paths:
- result.txt
expire_in: 1 week
unit_test:
stage: test
script:
- ls
- cat result.txt
- echo "unit testing..." >> ./result.txt
artifacts:
paths:
- result.txt
expire_in: 1 week
deploy:
stage: deploy
script:
- ls
- cat result.txt
참고 URL : https://stackoverflow.com/questions/38140996/how-can-i-pass-artifacts-to-another-stage
'Program Tip' 카테고리의 다른 글
대용량 Java 힙 덤프 분석 도구 (0) | 2020.10.27 |
---|---|
루비의 문자열 연결과 보간 (0) | 2020.10.27 |
다른 수정 사항은 그대로두고 단일 파일을 커밋하고 푸시하는 가장 쉬운 방법은 무엇입니까? (0) | 2020.10.27 |
JavaScript를 사용하여 Safari에서 키보드 이벤트 실행 (0) | 2020.10.27 |
Heroku 서버 상태 이해 143 (0) | 2020.10.27 |