gpt4 book ai didi

java - 找不到 gitlab runner 中下载的文件

转载 作者:行者123 更新时间:2023-11-30 05:44:27 28 4
gpt4 key购买 nike

我正在为 gradle 项目设置 GitLab CI。下载 gradle 后,尽管下载成功,但 unzip 命令报告未找到 zip 文件。我添加了 ls 只是为了查看目录的内容,但我的 zip 文件不存在。下面是我的 .gitlab-ci.yml 文件

image: docker:latest

stages:
- build

before_script:
- cd /usr/lib
- curl https://services.gradle.org/distributions/gradle-2.10-bin.zip -o gradle-2.10-bin.zip
- unzip "gradle-2.10-bin.zip"
- ln -s "/usr/gradle-2.10/bin/gradle" /usr/bin/gradle
- rm "gradle-2.10-bin.zip"
- export GRADLE_HOME=usr/lib/gradle-2.10
- export PATH=$PATH:$GRADLE_HOME/bin

build_job:
image: java:8
stage: build
script:
- gradle -v

这是作业的错误输出

$ unzip "gradle-2.10-bin.zip" unzip: cannot find or open gradle-2.10-bin.zip, gradle-2.10-bin.zip.zip or gradle-2.10-bin.zip.ZIP. ERROR: Job failed: exit code 1

最佳答案

这不是该命令的完整错误输出,这是:

$ unzip "gradle-2.10-bin.zip"
Archive: gradle-2.10-bin.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of gradle-2.10-bin.zip or
gradle-2.10-bin.zip.zip, and cannot find gradle-2.10-bin.zip.ZIP, period.

如果我们检查该文件是空的。如果我们在该 url 上执行 curl -I ,我们会得到 301,因此您需要将 -L 添加到该 curl 命令以遵循重定向:

curl -L https://services.gradle.org/distributions/gradle-2.10-bin.zip

关于java - 找不到 gitlab runner 中下载的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55090807/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com