LoginSignup
0
0

More than 3 years have passed since last update.

Gitlab-CI でartifactのパス階層を浅くしたい

Posted at

概要

gitlab-ci.yml ではアーティファクト設定をすることができる。以下のような感じ。

pdf:
  script: xelatex mycv.tex
  artifacts:
    name: "app"
    paths:
      - hoge/moge/piyo/
    expire_in: 1 week

pathsにディレクトリを指定すると、自動でzipにしてくれるが、そのzipファイル内に、pathsに記載したパスすべてが含まれる仕様となっている。上の例だと、app.zipを解凍すると、hoge/moge/piyo/ というパス階層が現れるので、じゃまくさい。

対処法

単純にビルドファイルを移動することで対応した。

build:
  stage: build
  script:
    - ..
    - (build/path/に成果物ができたとする)
    - mkdir Artifact
    - robocopy build/path Artifact /s /e & set errorlevel=0
  artifact:
    - paths: Artifact

ランナーがLinuxならrobocopyじゃなくて、mv で問題なさそう。

参考 

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