From 380260b6c71426ccbdc566a1e9db45678f7c1df7 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 5 Jun 2023 11:35:09 +0200 Subject: [PATCH] ci: proxy config check Signed-off-by: CrazyMax --- .github/workflows/ci.yml | 71 ++++++++++++++++++++++++++++++++++++++++ test/proxy.Dockerfile | 9 +++++ 2 files changed, 80 insertions(+) create mode 100644 test/proxy.Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ac9849ea..0a794b009 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1001,3 +1001,74 @@ jobs: file: ./test/named-context.Dockerfile build-contexts: | alpine=docker-image://localhost:5000/my-base-image:latest + + proxy-docker-config: + runs-on: ubuntu-latest + services: + squid-proxy: + image: ubuntu/squid:latest + ports: + - 3128:3128 + steps: + - + name: Check proxy + run: | + netstat -aptn + curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set proxy config + run: | + mkdir -p ~/.docker + echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} + driver-opts: | + image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} + network=host + buildkitd-flags: --debug + - + name: Build + uses: ./ + with: + context: ./test + file: ./test/proxy.Dockerfile + + proxy-buildkitd: + runs-on: ubuntu-latest + services: + squid-proxy: + image: ubuntu/squid:latest + ports: + - 3128:3128 + steps: + - + name: Check proxy + run: | + netstat -aptn + curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy http://127.0.0.1:3128 -v --insecure --head https://www.google.com + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + with: + version: ${{ inputs.buildx-version || env.BUILDX_VERSION }} + driver-opts: | + image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }} + network=host + env.http_proxy=http://127.0.0.1:3128 + env.https_proxy=http://127.0.0.1:3128 + buildkitd-flags: --debug + - + name: Build + uses: ./ + with: + context: ./test + file: ./test/Dockerfile diff --git a/test/proxy.Dockerfile b/test/proxy.Dockerfile new file mode 100644 index 000000000..fa38863e0 --- /dev/null +++ b/test/proxy.Dockerfile @@ -0,0 +1,9 @@ +# syntax=docker/dockerfile:1 +FROM alpine +RUN apk add --no-cache curl net-tools +ARG HTTP_PROXY +ARG HTTPS_PROXY +RUN printenv HTTP_PROXY +RUN printenv HTTPS_PROXY +RUN netstat -aptn +RUN curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy $HTTP_PROXY -v --insecure --head https://www.google.com