我有以下CircleCi设置:
version: 2
environment:
TZ: '/usr/share/zoneinfo/UTC'
jobs:
build:
parallelism: 3
working_directory: ~/circleci-dashboard
docker:
- image: mat/circleci-dashboard:0.1.1
environment:
PGHOST: 127.0.0.1
PGUSER: ubuntu
RAILS_ENV: test
- image: circleci/postgres:9.6-alpine
environment:
POSTGRES_USER: ubuntu
POSTGRES_DB: circle_test
POSTGRES_PASSWORD: ''
- image: redis:2.8.19
resource_class: large
steps:
- checkout
- type: cache-restore
key: dashboard-{{ checksum "Gemfile.lock" }}
- run:
name: 'Install gems'
command: bundle install --jobs=4 --path /home/circleci/circleci-dashboard/vendor/bundle
- type: cache-save
key: dashboard-{{ checksum "Gemfile.lock" }}
paths:
- /home/circleci/circleci-dashboard/vendor/bundle
- run:
name: Update apt
working_directory: /
command: |
apt-get update -y
- run:
name: Install Chrome headless dependencies
working_directory: /
command: |
apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget default-jre --fix-missing
- run:
name: Install Chrome headless
working_directory: /
command: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list && \
apt-get update && \
apt-get install -y dbus-x11 google-chrome-stable && \
rm -rf /var/lib/apt/lists/*
- type: cache-restore
key: dashboard-{{ checksum "public/package.json" }}
- type: cache-restore
key: dashboard-{{ checksum "public/package-lock.json" }}
- run:
name: 'Install node_modules'
command: cd public && npm i
- type: cache-save
key: dashboard-{{ checksum "public/package.json" }}
paths:
- node_modules
- type: cache-save
key: dashboard-{{ checksum "public/package-lock.json" }}
paths:
- node_modules
- run:
name: 'Leave code review comments'
command: bundle exec pronto run -f github_status github_pr_review -c origin/master
- run:
name: 'Lint Polymer Components'
command: cd public && npm run lint
- run:
name: 'Unit-test Polymer Components'
command: cd public && npm test
- run:
name: 'Package Polymer Components'
command: cd public && npm run prod
- run:
name: 'Create database.yml'
command: mv config/database.ci.yml config/database.yml
- run:
name: Set up Dashboard database
command: bundle exec rake db:structure:load --trace
- run: mkdir ~/rspec
- run:
name: 'Run tests'
command: |
bundle exec rspec --format progress \
--format RspecJunitFormatter \
-o ~/rspec/rspec.xml \
$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
问题是,以下任务在每个容器中启动:
- run:
name: 'Lint Polymer Components'
command: cd public && npm run lint
是否可以将这一步骤配置为仅在一个容器中启动?