0
1

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.

jenkinsのPIPELINE実行中にで作業ディレクトリを移動する

Posted at

dir ()を使えば良い

Jenkins ver. 2.190.1
# 作業ディレクトリを移動する
dir ("${JENKINS_HOME}/testdir") {
   # 環境変数を更新する
   env.WORKSPACE = "${JENKINS_HOME}/testdir"
}

ディレクトリがない場合はコマンドラインからディレクトリを作成しておく。

# shellscriptを実行する
sh "mkdir -p ${JENKINS_HOME}/testdir"

参考

Jenkins Pipeline メモ
Jenkinsではジョブを並列実行すると@がついたworkspaceが複数作成されるので容量に気をつけよう
Build creates new workspace@2 (and so on) when option concurrent builds NOT checked

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?