选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

在代理服务器中运行程序包管理器和其他工具

聚焦模式
在代理服务器中运行程序包管理器和其他工具 - AWS CodeBuild

按照以下过程在代理服务器中运行软件包管理器和其他工具。

要在代理服务器中运行一个工具,如程序包管理器,请执行以下操作:
  1. 通过将语句添加到您的 squid.conf 文件中,将该工具添加到代理服务器的允许列表中。

  2. 在 buildspec 文件中添加指向代理服务器的私有终端节点的命令行。

以下示例演示了如何为 apt-getcurlmaven 执行此操作。如果您使用其他工具,则相同的原则将适用。将它添加到 squid.conf 文件中的允许列表中,并向 buildspec 文件添加一个命令以使 CodeBuild 了解您的代理服务器的端点。

在代理服务器中运行 apt-get
  1. 将以下语句添加到您的 squid.conf 文件中,以便将 apt-get 添加到代理服务器中的允许列表。前三行允许 apt-get 在构建环境中运行。

    acl allowed_sites dstdomain ppa.launchpad.net # Required for apt-get to run in the build environment acl apt_get dstdom_regex .*\.launchpad.net # Required for CodeBuild to run apt-get in the build environment acl apt_get dstdom_regex .*\.ubuntu.com # Required for CodeBuild to run apt-get in the build environment http_access allow localnet allowed_sites http_access allow localnet apt_get
  2. 在构建规范文件中添加以下语句,以便 apt-get 命令在 /etc/apt/apt.conf.d/00proxy 中查找代理配置。

    echo 'Acquire::http::Proxy "http://<private-ip-of-proxy-server>:3128"; Acquire::https::Proxy "http://<private-ip-of-proxy-server>:3128"; Acquire::ftp::Proxy "http://<private-ip-of-proxy-server>:3128";' > /etc/apt/apt.conf.d/00proxy
在代理服务器中运行 curl
  1. 将以下内容添加到您的 squid.conf 文件中,以便将 curl 添加到构建环境中的允许列表。

    acl allowed_sites dstdomain ppa.launchpad.net # Required to run apt-get in the build environment acl allowed_sites dstdomain google.com # Required for access to a webiste. This example uses www.google.com. http_access allow localnet allowed_sites http_access allow localnet apt_get
  2. 在 buildspec 文件中添加以下语句,以便 curl 使用专用代理服务器访问您添加到 squid.conf 的网站。在此示例中,网站为 google.com

    curl -x <private-ip-of-proxy-server>:3128 https://www.google.com
在代理服务器中运行 maven
  1. 将以下内容添加到您的 squid.conf 文件中,以便将 maven 添加到构建环境中的允许列表。

    acl allowed_sites dstdomain ppa.launchpad.net # Required to run apt-get in the build environment acl maven dstdom_regex .*\.maven.org # Allows access to the maven repository in the build environment http_access allow localnet allowed_sites http_access allow localnet maven
  2. 在 buildspec 文件中添加以下语句。

    maven clean install -DproxySet=true -DproxyHost=<private-ip-of-proxy-server> -DproxyPort=3128
隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。