GitLab CI/CDにおけるジョブは「.gitlab-ci.yml」に定義する
.gitlab-ci.yml
job01:
  script:
    - uname -r
    - ps
    - hostname
Job02:
  script:
    - ./build.sh
    - ./test.sh
– Scriptパラメータ利用例
job01:
  script:
    - uname -a
    - ./scripts/build.sh
    - bundle exec rspec spec/requests/
– only, expectパラメータ
job01:
  only:
    - /^script-.*$/
  except:
    - tags
only, exceptで使用できるオプション
branches, tags, pushes, schedules, web
– variablesパラメータ
job01:
  variables:
    PROXY_PATH: 'http://proxy.example.com'
    FLAGS: '-0'
  script:
    - 'https_proxy=$PROXY_PATH curl $FLAGS https://gitlab.com/gitlab-org/gitlab-ce/repository/archive.tar.gz'
– tagパラメータ
プロジェクト内で実行可能なRunnerのリストから特定のRunnerを選択する際に使用
指定したタグを利用し、それにマッチしたRunnerだけにジョブを渡す
job01:
  tags:
    - shell
    - gitlab-runner01
– artifactsパラメータ
ジョブの実行結果をアーティファクトとして保存する際の定義を行う
name, untracked, when, expire_in
job01:
  artifacts:
    name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
    untracked: true
    expire_in: 10 min
    paths:
      - ./artifacts
### pythonを実行するサンプル
job01:
  script:
    - python ./scripts/hello.py
  only:
    - master
  tags:
    - shell
    - gitlab-runner01
.gitlab-ci.ymlでbuildとテストを自動化するところまではわかった。
.gitlab-ci.ymlでDockerのbuildをどうやるかが問題か…
