LoginSignup
8
9

More than 5 years have passed since last update.

GitLabとdrone.ioのversion 0.4を利用してhiveのCI環境作成にトライする(Part 1) ~環境構築編~

Posted at

以前の投稿で、hiveserver2のdockerイメージを作成しました。

このイメージと、drone 0.4を連携して、hiveクエリのCIができないかな、ということで試してみました。

1. 結論

できちゃいそう

2. [.drone.yml]

利用した.drone.ymlは下記の通り、metasotre用のmysqldをスタートしてるあたり、まだこなれてないのですが今後改善予定です。

build:
  image: letusfly85/hiveserver2
  commands:
    - sudo /etc/init.d/mysql start
    - hive -e 'create table hoge(name string)'

compose:
  zookeeper:
    image: jplock/zookeeper:latest

3. drone 0.4の構築について

備忘のためにメモを残します。

3-0. 環境情報

Ubuntu 14.04
Docker 1.9
docker-compose 1.5.0
Golang 1.5
GitLab 8.1.2

3-1. goenvのインストール

git clone https://github.com/wfarr/goenv.git ~/.goenv

echo 'export PATH=/root/.goenv/bin:\$PATH' >> ~/.bashrc
echo 'eval "$(goenv init -)"' >> ~/.bashrc

3-2. Golangのインストール

goenv install 1.5

echo 'goenv global 1.5' >> ~/.bashrc
echo 'export GOPATH=/root/go' >> ~/.bashrc
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc

echo 'export GO15VENDOREXPERIMENT=1' >> ~/.bashrc

source ~/.bashrc

3-3. drone 0.4のビルド

mkdir -p $GOPATH/src/github.com/drone

git clone https://github.com/drone/drone $GOPATH/src/github.com/drone/drone

apt-get install gcc make g++

cd $GOPATH/src/github.com/drone/drone
make deps
./contrib/setup-sassc.sh

make all

上記を実行すると「$GOPATH/src/github.com/drone/drone」にdroneという実行可能なバイナリファイルが出来上がります。

3-4. GitLab連携

環境変数を用意します。

  • /etc/profile.d/drone.shなるものを用意しました。

中身は以下の通り

export SERVER_ADDR=:80
export REMOTE_DRIVER=gitlab
client_id=*******************************
client_secret=*******************************
export REMOTE_CONFIG="https://gitlab.test.com"
client_id=${client_id}&client_secret=${client_secret}&skip_verify=false&open=false&search=true"

3-5 drone起動

オプション[--debug]でわらわらとログが出力されます。

cd $GOPATH/src/github.com/drone/drone

./drone --debug

4. 実行してみた

[.drone.yml]を、リポジトリに格納して、masterにpushしました。

結果は下記の通り。行けそうですね。

hive-de-ci.png

5. 課題

  • JDBCドライバとDBUnitつかってテストできるかどうかを検証する
  • metastore管理はderbyでいいし、zookeeperも一つのコンテナにまとめれば済むなのでもっとコンパクトに
  • 成果物のデプロイ連携をどうするかを検討する
8
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
9