質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Circle CI

Circle CIは、クラウド上に簡単にCI環境を構築できるWebサービスです。GitHubと連携させ、CIしたいリポジトリーを選択しビルド・テストを行います。チャット等を利用して結果を確認することが可能です。

Q&A

1回答

415閲覧

CircleCIで異なる条件でジョブを実行させる方法

退会済みユーザー

退会済みユーザー

総合スコア0

Circle CI

Circle CIは、クラウド上に簡単にCI環境を構築できるWebサービスです。GitHubと連携させ、CIしたいリポジトリーを選択しビルド・テストを行います。チャット等を利用して結果を確認することが可能です。

0グッド

0クリップ

投稿2018/10/27 13:02

編集2018/10/27 14:42

以下yamlで実現したいことは。

masterにマージされた時、build-job及び、deploy-stageを実行します。
tagをきった場合には、circleCI上での承認を求め、承認されたら、deploy-productを実行させたいです。

version: 2 jobs: build-job: docker: - image: centos:7 working_directory: ~/repo steps: - checkout deploy-stage: docker: - image: centos:7 steps: - checkout deploy-product: docker: - image: centos:7 steps: - checkout workflows: version: 2 build-deploy: jobs: - build-job - deploy-stage: requires: - build-job filters: branches: only: master - approve_deploy: type: approval filters: branches: ignore: /.*/ tags: only: /^v.*/ - deploy-product: requires: - approve_deploy filters: branches: ignore: /.*/ tags: only: /^v.*/

しかし、deploy-productのみジョブが失敗してしまいます。
以下エラーです。

Either git or ssh (required by git to clone through SSH) is not installed in the image. Falling back to CircleCI's native git client but the behavior may be different from official git. If this is an issue, please use an image that has official git and ssh installed. Counting objects: 8227, done. Compressing objects: 100% (5060/5060), done. Total 8227 (delta 3409), reused 7119 (delta 2769) object not found

条件としては正しいと思うのですが、何が原因なのでしょうか?
ご教授お願いします。


追記

どうやら、タグをトリガーとしたビルドやデプロイの際こけるようです。
この時、dockerで使用するimageをcircleci/php:7.1-browsersにすれば実行されることを確認しました。
しかし、centos7で実行したいコマンドがあるので、circleci/php:7.1-browsersを使用することはできません。
これは一体何が原因なのでしょうか?

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

先ず、メッセージを見ましょう。

Either git or ssh (required by git to clone through SSH) is not installed in the image. Falling back to CircleCI's native git client but the behavior may be different from official git. If this is an issue, please use an image that has official git and ssh installed.

によると、

Translation

1クローンするには必須になるgitかsshがイメージにインストールされてないようです。CircleCIのネイティブgitクライアントを実行します。しかし、公式なgitの動作と違いがある可能性があります。もし、それは原因であれ場合、公式なgitとsshが入っているイメージをご利用ください。

centos:7のどイメージを見ると、

FROM scratch ADD centos-7-docker.tar.xz / LABEL org.label-schema.schema-version="1.0" \ org.label-schema.name="CentOS Base Image" \ org.label-schema.vendor="CentOS" \ org.label-schema.license="GPLv2" \ org.label-schema.build-date="20181205" CMD ["/bin/bash"]

本当に、sshとgitは入っていません。

似たよう問題を解決した方の記事:Rails リポジトリに CircleCI 2.0 を導入した

以下の部分を確認してください。

yaml

1 name: Install System Dependencies 2 # See also https://circleci.com/docs/2.0/custom-images/#required-tools 3 command: apk add --update --no-cache build-base postgresql-dev postgresql-libs nodejs tzdata tar gzip - checkout

投稿2018/12/20 02:44

vanderlvov

総合スコア685

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問