我尝试使用圆圈ci的工作流语法级联一系列任务。出于某种原因,只有构建作业似乎运行 - 但我的其他工作没有。
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
steps:
- checkout
- restore_cache:
keys:
- sfdx-version-41-local
- run:
name: Install SFDX
command: pwd
- save_cache:
key: sfdx-version-41-local
paths:
- node_modules
auth:
steps:
- run:
name: Authenticate
command: ls -a
validate:
steps:
- run:
name: Validate
command: mkdir whocares
clean:
steps:
- run:
name: Remove Server Key
when: always
command: pwd
workflows:
version: 2
authenticate-and-deploy:
jobs:
- build
- auth
- validate
- clean
理想情况下,我希望在转到下一步之前确保每个步骤都使用非零退出代码完成。但我不确定构建后的后续步骤是否正在执行。
谢谢,
答案 0 :(得分:0)
如果您由于某种原因确实想要所有这些作业,则工作流程配置缺少要求,并且每个作业都缺少其执行程序。我也修了缩进。你可以这样做:
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
steps:
- checkout
- restore_cache:
keys:
- sfdx-version-41-local
- run:
name: Install SFDX
command: pwd
- save_cache:
key: sfdx-version-41-local
paths:
- node_modules
auth:
docker:
- image: circleci/node:latest
steps:
- run:
name: Authenticate
command: ls -a
validate:
docker:
- image: circleci/node:latest
steps:
- run:
name: Validate
command: mkdir whocares
clean:
docker:
- image: circleci/node:latest
steps:
- run:
name: Remove Server Key
when: always
command: pwd
workflows:
version: 2
authenticate-and-deploy:
jobs:
- build
- auth:
requires: build
- validate:
requires: auth
- clean:
requires: validate
答案 1 :(得分:0)
Here is what I ended up doing:
job-definition: &jobdef
docker:
- image: circleci/openjdk:latest-node-browsers
steps:
- checkout
- restore_cache:
keys:
- sfdx-6.8.2-local
- run:
name: Print branch
command: |
echo $CIRCLE_BRANCH
if [[$CIRCLE_BRANCH == 'master']];
then
echo "master";
else
echo "notMaster";
fi
- save_cache:
key: sfdx-6.8.2-local
paths:
- node_modules
- run:
name: "Validate Build"
command: |
#node_modules/sfdx-cli/bin/run force:mdapi:deploy -d src/ -u $USERNAME -c --testlevel RunLocalTests
echo CIRCLE_BRANCH
- run:
name: Push to Codecov.io
command: |
cp ~/tests/apex/test-result-codecoverage.json .
bash <(curl -s https://codecov.io/bash)
- store_artifacts:
path: ~/tests
- store_test_results:
path: ~/tests
version: 2
jobs:
static-analysis:
docker:
- image: circleci/openjdk:latest
steps:
- checkout
- restore_cache:
keys:
- pmd-v6.0.1
- run:
name: Install PMD
command: |
if [ ! -d pmd-bin-6.0.1 ]; then
curl -L "https://github.com/pmd/pmd/releases/download/pmd_releases/6.0.1/pmd-bin-6.0.1.zip" -o pmd-bin-6.0.1.zip
unzip pmd-bin-6.0.1.zip
rm pmd-bin-6.0.1.zip
fi
- save_cache:
key: pmd-v6.0.1
paths:
- pmd-bin-6.0.1
- run:
name: Run Static Analysis
command: |
pmd-bin-6.0.1/bin/run.sh pmd -d ./src/ -R $RULESET -f text -l apex -r static-analysis.txt -no-cache
- store_artifacts:
path: static-analysis.txt
build-enterprise:
<<: *jobdef
environment:
SCRATCH_DEF: workspace-scratch-def.json
URL: https://login.salesforce.com
NAME: $PROD_USERNAME
build-developer:
<<: *jobdef
environment:
SCRATCH_DEF: developer.json
URL: https://test.salesforce.com
NAME: $EVANDEV_USERNAME
workflows:
version: 2
test_and_static:
jobs:
- build-enterprise
#- build-developer
#- static-analysis
我正在尝试做的另外两件事: 1.庄严化构建 2.在PR上运行构建