如果在circleCI上带有“意外的文件结束”的语句

时间:2017-07-28 17:30:28

标签: bash continuous-integration circleci

如果我的分支名称为echo "showing dev branch"但是我收到此错误

,我正在尝试在我的测试中执行打印development的条件
if [ "${CIRCLE_BRANCH}" == "development"];  then echo "showing dev branch" fi
bash: -c: line 2: syntax error: unexpected end of file

if [ "${CIRCLE_BRANCH}" == "development"];  then echo "showing dev branch" fi returned exit code 1

请参阅下面的 circle.yml

general:
  artifacts:
    - "test_evidences"
  branches:
    only:
      - development

machine:
  node:
    version: 6.10.3

dependencies:
  pre:
    - curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    - sudo dpkg -i google-chrome.deb
    - sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
    - rm google-chrome.deb
    - npm install
    - npm install -g grunt grunt-cli
  override:
    - node_modules/.bin/webdriver-manager update

test:
  pre: 
    - sleep 60
  override:
    - if [ "${CIRCLE_BRANCH}" == "development"];  then 
        echo "showing dev branch" 
      fi
    - grunt apiTests
    - node_modules/.bin/protractor conf.js
    - sed -i -- 's,//,/,g' test_evidences/htmlReport.html

1 个答案:

答案 0 :(得分:0)

问题解决了!

我的新 circle.yml 文件是:

#!/usr/bin/env bash

general:
  artifacts:
    - "test_evidences"
  branches:
    only:
      - development

machine:
  node:
    version: 6.10.3

dependencies:
  pre:
    - curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    - sudo dpkg -i google-chrome.deb
    - sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
    - rm google-chrome.deb
    - npm install
    - npm install -g grunt grunt-cli
  override:
    - node_modules/.bin/webdriver-manager update

test:
  pre: 
    - sleep 60
  override:
    - if [ "${CIRCLE_BRANCH}" == "development" ];  then 
        echo "showing dev branch"; 
      fi
    - grunt apiTests
    - node_modules/.bin/protractor conf.js
    - sed -i -- 's,//,/,g' test_evidences/htmlReport.html