【问题标题】:extract or unzip files in gitlab using ci/cd command line使用 ci/cd 命令行在 gitlab 中提取或解压缩文件
【发布时间】:2019-02-11 05:58:47
【问题描述】:

实际上,我在 gitlab 上有我的 zip 文件,我想使用 gitlab CI/CD 提取这些文件。我在 .gitlab-ci.yml 中尝试过:

image: docker

stages:
  - build
  - test

services:
  - docker:dind

build:
  before_script:
  - apk add p7zip

  script:
  - cd \kmfs
  - 7z x -oChassisA ChassisA.zip

输出

$ apk add p7zip
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
(1/3) Installing libgcc (6.4.0-r9)
(2/3) Installing libstdc++ (6.4.0-r9)
(3/3) Installing p7zip (16.02-r3)
Executing busybox-1.28.4-r3.trigger
OK: 11 MiB in 17 packages
$ cd \kmfs
$ 7z x -oChassisA ChassisA.zip

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=C.UTF-8,Utf16=on,HugeFiles=on,64 bits,1 CPU Intel(R) Xeon(R) CPU @ 2.30GHz (306F0),ASM,AES-NI)

Scanning the drive for archives:
1 file, 3638943 bytes (3554 KiB)

Extracting archive: ChassisA.zip
--
Path = ChassisA.zip
Type = zip
Physical Size = 3638943

Everything is Ok

Folders: 1
Files: 4
Size:       24070952
Compressed: 3638943
Job succeeded

它正在成功执行,但提取的文件未反映在 gitlab 存储库中,我无法使用在测试阶段编写的节点 js 代码访问这些文件。

因此,如果有人建议我使用命令或从 nodejs 代码中提取 .zip 文件的任何方法,那就太好了...

【问题讨论】:

  • 你发现了吗?

标签: continuous-integration extract unzip


【解决方案1】:

您需要在工作中使用工件来声明提取的 zip 的路径。这将允许后续作业访问这些文件。

artifacts:
when: always
expire_in: 1 week
paths:
  - zip files folder structure after its extracted

【讨论】:

    猜你喜欢
    • 2022-07-12
    • 2022-08-14
    • 1970-01-01
    • 2021-11-28
    • 2019-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多