mirror of
https://github.com/docker/bake-action.git
synced 2025-07-14 12:41:53 +02:00
ci: proxy config check
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
90
.github/workflows/ci.yml
vendored
90
.github/workflows/ci.yml
vendored
@ -302,3 +302,93 @@ jobs:
|
||||
set: |
|
||||
t1.tags=localhost:5000/name/app:t1
|
||||
t2.tags=localhost:5000/name/app:t2
|
||||
|
||||
docker-config-malformed:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set malformed docker config
|
||||
run: |
|
||||
mkdir -p ~/.docker
|
||||
echo 'foo_bar' >> ~/.docker/config.json
|
||||
-
|
||||
name: Build
|
||||
uses: ./
|
||||
with:
|
||||
files: |
|
||||
./test/config.hcl
|
||||
|
||||
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@v4
|
||||
-
|
||||
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:
|
||||
files: |
|
||||
./test/config.hcl
|
||||
targets: app-proxy
|
||||
|
||||
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@v4
|
||||
-
|
||||
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:
|
||||
files: |
|
||||
./test/config.hcl
|
||||
|
@ -37,3 +37,8 @@ target "app-plus" {
|
||||
IAMPLUS = "true"
|
||||
}
|
||||
}
|
||||
|
||||
target "app-proxy" {
|
||||
inherits = ["app"]
|
||||
dockerfile = "proxy.Dockerfile"
|
||||
}
|
||||
|
9
test/proxy.Dockerfile
Normal file
9
test/proxy.Dockerfile
Normal file
@ -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
|
Reference in New Issue
Block a user