はじめてのConcourse CI
hello.yml
jobs:
- name: hello-world
plan:
- task: say-hello
config:
platform: linux
image_resource:
type: docker-image
source:
repository: ubuntu
run:
path: bash
args:
- -c
- |
echo "Hello, world!"
flyコマンド
基本構成
fly [OPTIONS] <command>
ログインする
# -t lite => http://192.168.100.4:8080のConcourseへのエイリアスになる
# そのためログイン移行はこのエイリアスを使用して対象のConcourseを指定する
fly -t lite login -c http://192.168.100.4:8080
パイプラインを登録にする
# -p hello => パイプライン名
# -c hello.yml => パイプラインの構成ファイル
fly -t lite set-pipeline -p hello -c hello.yml
パイプラインを削除する
# -p hello => パイプライン名
fly -t lite destroy-pipeline -p hello
パイプラインを有効にする
# -p hello => パイプライン名
fly -t lite unpause-pipeline -p hello
hello-worldジョブを実行
# -j hello/hello-world => 構成のyamlファイルの中のjob名を指定
# --watch => 実行内容をコンソールに出力(指定しなければ出力されない)
fly -t lite trigger-job -j hello/hello-world --watch
output
started hello/hello-world #1
initializing
# ...
Successfully pulled ubuntu@sha256:dd7808d8792c9841d0b460122f1acf0a2dd1f56404f8d1e56298048885e45535.
running bash -c echo "Hello, world!"
Hello, world!
succeeded
One-Off Taskを実行する
- Concouseには登録されないので、タスクの開発時などに使う
hello.yml
---
platform: linux
image_resource:
type: docker-image
source:
repository: alpine
run:
path: echo
args: ["Hello", "World"]
# -c hello.yml => 実行ターゲットの
fly -t lite execute -c hello.yml
#
#
#
#