2

Gitlab CI でビルド スクリプトを実行しようとしていますが、理解できない構文エラーが表示されます。

これは、Gitlab で構成したスクリプトです。

# test syntax of all *.php and *.ctp files
for f in $(find . -name "*.php" -or -name "*.ctp")
do 
    php -l $f
done

これは、コミット後の Gitlab の出力です。

cd /opt/gitlab-runner/embedded/service/gitlab-runner/tmp/builds/project-1 && git reset --hard && git clean -fdx && git remote set-url origin http://gitlab-ci-token:xxxxxx@git01.peoplefone.com/web/portals.git && git fetch origin
HEAD is now at da5f9b9 test CI 7
From http://git01.peoplefone.com/web/portals
   da5f9b9..559f74b  develop    -> origin/develop
cd /opt/gitlab-runner/embedded/service/gitlab-runner/tmp/builds/project-1 && git reset --hard && git checkout 559f74be65167b67cd7761cb8cbae8bcb528dd40
HEAD is now at da5f9b9 test CI 7
Previous HEAD position was da5f9b9... test CI 7
HEAD is now at 559f74b... test CI 8
# test syntax of all *.php and *.ctp files
for f in $(find . -name "*.php" -or -name "*.ctp")
/tmp/executor20150409-17218-twsoje: line 12: syntax error near unexpected token `echo'

ご覧のとおり、スクリプトに「echo」ステートメントがありません。誰か助けてもらえますか? どうもありがとう。

4

1 に答える 1

2

少し試した後、次のスクリプトが機能しました。

# test syntax of all *.php and *.ctp files
for file in $(find . -name *.php -or -name *.ctp); do
    php -l $file;
done

しかし、私はまだ上記のエラーを理解していません..

于 2015-04-09T10:02:07.117 に答える