LoginSignup
5
5

More than 5 years have passed since last update.

digdag push が symlinks を辿ってくれないので自分で辿る

Last updated at Posted at 2019-02-18

やりたいこと

以下のようなディレクトリ構成にしたいとする。

つまり digdag project は異なるが、プロジェクト間である程度ファイルを symbolic links を使って共有したいような構成。

shared/
├── environment.yml
├── notification
│   ├── danger-template.yml
│   └── good-template.yml
└── tasks
    └── environment.rb
project/sample/
├── environment.yml -> ../../shared/environment.yml
├── notification
│   ├── danger-template.yml -> ../../../shared/notification/danger-template.yml
│   └── good-template.yml -> ../../../shared/notification/good-template.yml
├── sample.dig
└── tasks
    └── environment.rb -> ../../../shared/tasks/environment.rb
project/sample2/
├── environment.yml -> ../../shared/environment.yml
├── notification
│   ├── danger-template.yml -> ../../../shared/notification/danger-template.yml
│   └── good-template.yml -> ../../../shared/notification/good-template.yml
├── sample2.dig
└── tasks
    └── environment.rb -> ../../../shared/tasks/environment.rb

これは digdag push では扱えない。

Invalid symbolic link: Given path '../../shared/environment.yml' is outside of project directory

のようなエラーメッセージが出る。

対応

rsync -KL を使って symlinks を辿ったコピーをつくって digdag push すれば良い

$ PROJECT=sample
$ SRC_PROJECT_PATH="project/${PROJECT}"
$ PROJECT_PATH="tmp/project/${PROJECT}"
$ mkdir -p "${PROJECT_PATH}"
$ rsync -auvKL --delete "${SRC_PROJECT_PATH}/" "${PROJECT_PATH}/"
$ digdag push "${PROJECT} --project "${PROJECT_PATH}"

ひとこと

digdga にパッチを送ろうかと思ったが実装を眺めてみると、サポートするのが面倒な気持ちがわかったので使う側で対応した。
シンボリックリンク対応の実装をしようと思ったら、内部的に同等のことをすることになるはず。

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