circle-ci에서version 2.한번 써 보다
6439 단어 CircleCI2.0
tl;dr
version2.1은 편리한 기능이 많이 추가될 수 있으니 사용해 보세요.
아무튼 써볼게요.
.circleci/config.yml
version: 2.1
executors:
default:
working_directory: ~/repo
docker:
- image: circleci/php:7
commands:
composer_install_with_cache:
steps:
- restore_cache:
keys:
- v1-composer-deps-{{ checksum "composer.json" }}
- v1-composer-deps-
- run: composer install -n --prefer-dist
- save_cache:
key: v1-composer-deps-{{ checksum "composer.json" }}
paths:
- ./vendor
jobs:
checkout_code:
executor: default
steps:
- checkout
- composer_install_with_cache
- save_cache: # ソースコードをキャッシュ
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo
test:
executor: default
steps:
- restore_cache: # ソースコードの復元
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run: phpunit
workflows:
version: 2
build:
jobs:
- checkout_code
- test:
requires: # checkout_codeの後に実行する
- checkout_code
구성 파일 확인
기술 오류가 있는지 확인합니다.
단말기
$ circleci config validate
Config file at .circleci/config.yml is valid.
실행 결과
Workflow를 사용한 후 다음 두 가지 작업을 수행했습니다.
version2.1이 되면 각 처리를 유창하게 쓰는 게 좋은 느낌이에요.
로컬 실행 정보
로컬에서 실행하면 대응하지 않으면 오류가 발생합니다. 유감입니다.
단말기
$ circleci local execute
Error:
You attempted to run a local build with version '2.1' of configuration.
Local builds do not support that version at this time.
You can use 'circleci config process' to pre-process your config into a version that local builds can run (see 'circleci help config process' for more information)
하지만 다음 명령으로 2.0으로 전환하면 실행할 수 있다.단말기
# 設定ファイルの変換 (2.1 -> 2.0)
$ circleci config process .circleci/config.yml > process.yml
# チェックアウトのジョブを実行
$ circleci local execute -c process.yml --job checkout-code
・
・
・
====>> echo "compoer install."
#!/bin/bash -eo pipefail
compoer install -n --prefer-dist
====>> Saving Cache
Error:
Skipping cache - error checking storage: not supported
Step failed
Success!
# テストのジョブを実行
$ circleci local execute -c process.yml --job test
현금으로 오류가 발생하고 개별적으로 임무를 수행하는 등 시간이 좀 걸리면 곤란하다.참고 자료
Reference
이 문제에 관하여(circle-ci에서version 2.한번 써 보다), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/reflet/items/b3d91d08e253a2189efa텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)