0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

メモ:windowsでjenkins

Posted at

CodePipelineは使っていたが、jenkinsは使った事がないので一応触ってみておいたメモ。
とりあえず手元で使えるWindowsServer2012で初歩だけ試す。
Jenkins 2.319.1

インストール

公式からLTS版Windows用をダウンロード
.msiをダブルクリックでインストール。
今回はポートを4040にしたので
http://localhost:4040/
でアクセスできる事を確認。
指定されたファイルのパスワードを入力

プロキシを設定しないとプラグインが入らないので、OffLine画面が出たらプロキシ設定をする。
Install suggested pluginsを選択してプラグインインストール
adminユーザを設定して完了

ジョブ作成

ジョブ作成からフリースタイルを選択。
とりあえず確認のためにWindowsコマンドecho 'HelloWorld'のジョブを作成して、ビルド実行。
成功すればOK

パイプライン

フリースタイルでジョブの作成をすると一連の管理が難しくなりそうなので、自分で書けるパイプラインを使った方が良さそう。
こことかこことかで基本がある。

.batを叩くのは単純に書くだけなので

node{
  stage('gitpull'){
    echo "dir"
    bat 'dir'
  }
  stage('build') {
    bat  'C:/Jenkins/test.bat'
  }
}

のようにコマンドを実行出来る。
windowsでもバックスラッシュではなく普通のスラッシュでパスを書く。
パイプラインそのものはジョブ作成から。
パイプラインを変更したい場合は「設定」を開く。

jenkinsと直接関係はないが、codecommitに接続する場合は公式に載っている。
httpsならAWSのCLIのクレデンシャルにxxxの名前でセットしておいて

git config --global credential.helper '!aws xxx codecommit credential-helper $@'
git config --global credential.UseHttpPath true

上はLinuxやMacで、Windowsだと実行されないので、その場合はこっちを見る。
引用符が違うだけ。

git config --global credential.helper "!aws xxx codecommit credential-helper $@"
git config --global credential.UseHttpPath true

プラグイン等を組み合わせる事で色々な処理も可能。

マネージドのcodepipelineが使える環境ならそっちにするかも。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?