2017-07-25 28 views
-1

我用下面的.gitlab-ci.yml配置工作:.gitlab-ci.yml語法錯誤

image: node:latest 

stages: 
    - build 
    - test 

build: 
    stage: build 
    script: 
    - npm install 

test: 
    stage: test 
    script: 
    - ./testing/test.js 

當推到GitLab,我收到了「您的管道爲失敗」的錯誤,當我看看是什麼失敗了,它的一個yaml錯誤:

Status: syntax is incorrect 

Error: (<unknown>): did not find expected key while parsing a block mapping 
at line 1 column 1 

據我所知,image:node:latest是正確的。任何幫助,這將是偉大的。

回答

1

問題是你測試工作的縮進。這個問題是讓你的整個yml中斷,因此提高了第1行的錯誤。只要刪除像下面的代碼過多的空白,它會沒事的。

image: node:latest 

stages: 
    - build 
    - test 

build: 
    stage: build 
    script: 
    - npm install 

test: 
stage: test 
script: 
    - ./testing/test.js 

。注意,在YAML壓痕用於表示的結構。所以重要的是要注意它。

+0

哦親愛的上帝!對我來說是多麼渺小。感謝您糾正:)。問題解決了。 – sudodashell