Bitbucket管道容易停止工作

时间:2019-03-26 19:06:45

标签: bitbucket bitbucket-pipelines bitbucket-cloud

我的Bitbucket管道已配置了一段时间,但今天我的构建开始因apt-get命令而失败:

我使用Java 8 docker映像:

 image: java:8

我需要安装python

 # Install python
 - echo "Install python"
 - apt-get update
 - apt-get install python-pip -q -y

并且构建开始因“ apt-get”命令而失败:

+ apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Ign http://deb.debian.org jessie InRelease
Ign http://deb.debian.org jessie-updates InRelease
Ign http://deb.debian.org jessie-backports InRelease
Get:2 http://deb.debian.org jessie Release.gpg [2420 B]
Ign http://deb.debian.org jessie-updates Release.gpg
Ign http://deb.debian.org jessie-backports Release.gpg
Get:3 http://deb.debian.org jessie Release [148 kB]
Ign http://deb.debian.org jessie-updates Release
Ign http://deb.debian.org jessie-backports Release
Err http://deb.debian.org jessie-backports/main amd64 Packages

Get:4 http://security.debian.org jessie/updates/main amd64 Packages [822 kB]
Get:5 http://deb.debian.org jessie/main amd64 Packages [9098 kB]
Err http://deb.debian.org jessie-updates/main amd64 Packages
404  Not Found
Err http://deb.debian.org jessie-backports/main amd64 Packages
404  Not Found
Fetched 10.1 MB in 7s (1395 kB/s)
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://deb.debian.org/debian/dists/jessie-backports/main/binary-amd64/Packages  404  Not Found

E: Some index files failed to download. They have been ignored, or old ones used instead.
Skipping cache upload for failed step
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.

有什么改变吗?我需要调整配置吗?

4 个答案:

答案 0 :(得分:3)

参考其他答案,Jessie and Wheezy repositories have been removed from their normal locations。尝试在某些Docker映像上运行apt-get update时,这将导致404错误。

除非您在Docker映像中有非常特定的需求,否则建议您将其更改为使用Debian Stretch存储库的一个。

在您的情况下,对于java:8图片,deprecated偏爱openjdk image。我已经测试过openjdk:8,发现它使用了Stretch并运行了apt-get update

我还写了一个official post on Atlassian Community,内容类似。如果发现其他与解决此问题有关的其他事项,我们将更新本文。

答案 1 :(得分:1)

Jessie和Wheezy由于年龄原因已从其正常回购地点中删除。

请参见以下问题的解决方案:https://unix.stackexchange.com/questions/508724/failed-to-fetch-jessie-backports-repository

答案 2 :(得分:1)

也要对此进行处理(因为它是在Pipeline的机器上,甚至不在我自己的机器上)。

我在apt-get更新之前运行了此命令:sed -i '/jessie-updates/d' /etc/apt/sources.list

pipelines.yml的这一部分看起来像这样:

   - sed -i '/jessie-updates/d' /etc/apt/sources.list # Debian mirror-network drops Jessie, so don't use it
   - apt-get update # required to install zip
   - apt-get install -y zip # required for packaging up the application

完整答案here(引用另一个)

答案 3 :(得分:0)

对我来说,解决方案是更改

image: python:3.5.1

image: python:3.5.7