Skip to content

Commit fcbf0b5

Browse files
committed
ci: proxy config check
Signed-off-by: CrazyMax <[email protected]>
1 parent d79fe12 commit fcbf0b5

3 files changed

Lines changed: 104 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,3 +302,93 @@ jobs:
302302
set: |
303303
t1.tags=localhost:5000/name/app:t1
304304
t2.tags=localhost:5000/name/app:t2
305+
306+
docker-config-malformed:
307+
runs-on: ubuntu-latest
308+
steps:
309+
-
310+
name: Checkout
311+
uses: actions/checkout@v4
312+
-
313+
name: Set malformed docker config
314+
run: |
315+
mkdir -p ~/.docker
316+
echo 'foo_bar' >> ~/.docker/config.json
317+
-
318+
name: Build
319+
uses: ./
320+
with:
321+
files: |
322+
./test/config.hcl
323+
324+
proxy-docker-config:
325+
runs-on: ubuntu-latest
326+
services:
327+
squid-proxy:
328+
image: ubuntu/squid:latest
329+
ports:
330+
- 3128:3128
331+
steps:
332+
-
333+
name: Check proxy
334+
run: |
335+
netstat -aptn
336+
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
337+
-
338+
name: Checkout
339+
uses: actions/checkout@v4
340+
-
341+
name: Set proxy config
342+
run: |
343+
mkdir -p ~/.docker
344+
echo '{"proxies":{"default":{"httpProxy":"http://127.0.0.1:3128","httpsProxy":"http://127.0.0.1:3128"}}}' > ~/.docker/config.json
345+
-
346+
name: Set up Docker Buildx
347+
uses: docker/setup-buildx-action@v2
348+
with:
349+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
350+
driver-opts: |
351+
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
352+
network=host
353+
buildkitd-flags: --debug
354+
-
355+
name: Build
356+
uses: ./
357+
with:
358+
files: |
359+
./test/config.hcl
360+
targets: app-proxy
361+
362+
proxy-buildkitd:
363+
runs-on: ubuntu-latest
364+
services:
365+
squid-proxy:
366+
image: ubuntu/squid:latest
367+
ports:
368+
- 3128:3128
369+
steps:
370+
-
371+
name: Check proxy
372+
run: |
373+
netstat -aptn
374+
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
375+
-
376+
name: Checkout
377+
uses: actions/checkout@v4
378+
-
379+
name: Set up Docker Buildx
380+
uses: docker/setup-buildx-action@v2
381+
with:
382+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
383+
driver-opts: |
384+
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
385+
network=host
386+
env.http_proxy=http://127.0.0.1:3128
387+
env.https_proxy=http://127.0.0.1:3128
388+
buildkitd-flags: --debug
389+
-
390+
name: Build
391+
uses: ./
392+
with:
393+
files: |
394+
./test/config.hcl

test/config.hcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ target "app-plus" {
3737
IAMPLUS = "true"
3838
}
3939
}
40+
41+
target "app-proxy" {
42+
inherits = ["app"]
43+
dockerfile = "proxy.Dockerfile"
44+
}

test/proxy.Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# syntax=docker/dockerfile:1
2+
FROM alpine
3+
RUN apk add --no-cache curl net-tools
4+
ARG HTTP_PROXY
5+
ARG HTTPS_PROXY
6+
RUN printenv HTTP_PROXY
7+
RUN printenv HTTPS_PROXY
8+
RUN netstat -aptn
9+
RUN curl --retry 5 --retry-all-errors --retry-delay 0 --connect-timeout 5 --proxy $HTTP_PROXY -v --insecure --head https://www.google.com

0 commit comments

Comments
 (0)