Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- grafana dashboard
- 정규식 문자열 출력
- 백준
- semanage
- 1697
- c3 초
- influxdb 설치
- gcc 업데이트
- 정규식 컴파일
- telegraf
- linux시간으로 변경
- gcc regex
- CentOS7
- selinux port 등록
- subporcess path
- c3 축 없애기
- c++ 정규식
- g++ 업데이트
- c3 step graph
- 정규식 활용
- c3 second
- python subprocess
- snmp test
- python popen
- InfluxDB
- regex_search
- centos pyhon 설치
- snmp
- c3 축 가리기
- python os
Archives
- Today
- Total
리셋 되지 말자
gitlab runner shell executor 본문
dind에서 shell로 변경
기존 .gitlab-ci.yml 스크립트
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
build-job: # This job runs in the build stage, which runs first.
stage: build
image: docker:20.10.13
services:
- docker:20.10.13-dind
script:
- echo "Start build"
- export AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID"
- export AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY"
- export AWS_DEFAULT_REGION="$AWS_DEFAULT_REGION"
- export ECR_URL="$ECR_URL"
- date "+%Y-%m-%d %I:%M:%S %p"
- apk add --no-cache python3 py3-pip
- pip3 install --upgrade pip
- pip3 install awscli
- aws --version
- aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${ECR_URL}
- date "+%Y-%m-%d %I:%M:%S %p"
- python3 get_max_swap_size.py &
- export GET_SWAP_PID=$!
- time docker build --build-arg AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID --build-arg AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY --build-arg AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION --build-arg ECR_URL=$ECR_URL -t ${ECR_URL}/csapi/celery:latest celery/
- echo "Used Max Swap Size of Build"
- cat swap_size
- echo "Start Unit Test"
- time docker run -i --rm ${ECR_URL}/csapi/celery:latest python -m unittest csapi/unit_test.py
- echo "Used Max Swap Size of Unit Test"
- cat swap_size
- echo "After script"
- aws s3api delete-object --bucket csapi-bucket --key images/separated-images/test_output.png
- echo "Deploy docker image"
- time docker push ${ECR_URL}/csapi/celery:latest
- echo $GET_SWAP_PID
- ps -ef | grep get_max_swap_size
- kill $GET_SWAP_PID
- ls
- cat swap_size
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 60 seconds."
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
# tags:
# - "gitlab-org-docker"
변경 후 스크립트
사전작업 - python3.8 설치, alias 설정
sudo amazon-linux-extras install python3.8
alias python=python3.8
'GitLab' 카테고리의 다른 글
CI 파이프라인에 사용된 최대 swap memory 크기 구하기 (0) | 2022.05.17 |
---|---|
docker, gitlab runner 설치 및 테스트 스크립트 (0) | 2022.05.12 |
gitlab runner 특정 버전 로컬 설치 (0) | 2022.05.11 |
[GitLab CI] docker gitlab-runner 등록 및 간단 예제 (2) | 2021.02.18 |
Comments