Skip to content

Commit 17ebdd4

Browse files
committed
ci: add jobs to check standalone behavior
Signed-off-by: CrazyMax <[email protected]>
1 parent 3472856 commit 17ebdd4

File tree

1 file changed

+97
-43
lines changed

1 file changed

+97
-43
lines changed

.github/workflows/ci.yml

Lines changed: 97 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,9 @@ jobs:
3030
uses: actions/checkout@v3
3131
-
3232
name: Set up Docker Buildx
33-
id: buildx
3433
uses: ./
3534
with:
3635
version: ${{ matrix.buildx-version }}
37-
-
38-
name: Inspect builder
39-
run: |
40-
echo "Name: ${{ steps.buildx.outputs.name }}"
41-
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
42-
echo "Status: ${{ steps.buildx.outputs.status }}"
43-
echo "Flags: ${{ steps.buildx.outputs.flags }}"
44-
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
45-
-
46-
name: Dump context
47-
uses: crazy-max/ghaction-dump-context@v1
4836

4937
multi:
5038
runs-on: ubuntu-latest
@@ -54,28 +42,10 @@ jobs:
5442
uses: actions/checkout@v3
5543
-
5644
name: Set up Docker Buildx 1
57-
id: buildx1
5845
uses: ./
59-
-
60-
name: Inspect builder 1
61-
run: |
62-
echo "Name: ${{ steps.buildx1.outputs.name }}"
63-
echo "Endpoint: ${{ steps.buildx1.outputs.endpoint }}"
64-
echo "Status: ${{ steps.buildx1.outputs.status }}"
65-
echo "Flags: ${{ steps.buildx1.outputs.flags }}"
66-
echo "Platforms: ${{ steps.buildx1.outputs.platforms }}"
6746
-
6847
name: Set up Docker Buildx 2
69-
id: buildx2
7048
uses: ./
71-
-
72-
name: Inspect builder 2
73-
run: |
74-
echo "Name: ${{ steps.buildx2.outputs.name }}"
75-
echo "Endpoint: ${{ steps.buildx2.outputs.endpoint }}"
76-
echo "Status: ${{ steps.buildx2.outputs.status }}"
77-
echo "Flags: ${{ steps.buildx2.outputs.flags }}"
78-
echo "Platforms: ${{ steps.buildx2.outputs.platforms }}"
7949

8050
error:
8151
runs-on: ubuntu-latest
@@ -328,18 +298,9 @@ jobs:
328298
platforms: ${{ matrix.qemu-platforms }}
329299
-
330300
name: Set up Docker Buildx
331-
id: buildx
332301
uses: ./
333302
with:
334303
version: ${{ matrix.buildx-version }}
335-
-
336-
name: Inspect builder
337-
run: |
338-
echo "Name: ${{ steps.buildx.outputs.name }}"
339-
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
340-
echo "Status: ${{ steps.buildx.outputs.status }}"
341-
echo "Flags: ${{ steps.buildx.outputs.flags }}"
342-
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
343304

344305
build-ref:
345306
runs-on: ubuntu-latest
@@ -360,10 +321,6 @@ jobs:
360321
uses: ./
361322
with:
362323
version: https://github.com/docker/buildx.git#${{ matrix.ref }}
363-
-
364-
name: Check version
365-
run: |
366-
docker buildx version
367324
-
368325
name: Create Dockerfile
369326
run: |
@@ -375,3 +332,100 @@ jobs:
375332
uses: docker/build-push-action@master
376333
with:
377334
context: .
335+
336+
standalone:
337+
runs-on: ubuntu-latest
338+
strategy:
339+
fail-fast: false
340+
matrix:
341+
buildx-version:
342+
- latest
343+
- ""
344+
steps:
345+
-
346+
name: Checkout
347+
uses: actions/checkout@v3
348+
-
349+
name: Uninstall docker cli
350+
run: |
351+
sudo apt-get purge -y moby-cli moby-buildx
352+
-
353+
name: Set up Docker Buildx
354+
uses: ./
355+
with:
356+
version: ${{ matrix.buildx-version }}
357+
-
358+
name: Check available in path
359+
if: matrix.standalone
360+
run: |
361+
buildx version
362+
363+
standalone-install-error:
364+
runs-on: ubuntu-latest
365+
steps:
366+
-
367+
name: Checkout
368+
uses: actions/checkout@v3
369+
-
370+
name: Uninstall docker cli
371+
run: |
372+
sudo apt-get purge -y moby-cli moby-buildx
373+
-
374+
name: Set up Docker Buildx
375+
id: buildx
376+
continue-on-error: true
377+
uses: ./
378+
with:
379+
install: true
380+
-
381+
name: Check
382+
run: |
383+
echo "${{ toJson(steps.buildx) }}"
384+
if [ "${{ steps.buildx.outcome }}" != "failure" ] || [ "${{ steps.buildx.conclusion }}" != "success" ]; then
385+
echo "::error::Should have failed"
386+
exit 1
387+
fi
388+
389+
standalone-kubernetes:
390+
runs-on: ubuntu-latest
391+
steps:
392+
-
393+
name: Checkout
394+
uses: actions/checkout@v3
395+
-
396+
name: Uninstall moby
397+
run: |
398+
sudo apt-get purge -y moby-engine moby-cli moby-buildx
399+
-
400+
name: Setup k8s cluster
401+
run: |
402+
set -x
403+
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
404+
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
405+
sudo apt-get update
406+
sudo apt-get install -y kubelet kubeadm kubectl
407+
sudo swapoff -a
408+
sudo kubeadm init --cri-socket /run/containerd/containerd.sock
409+
mkdir -p $HOME/.kube/
410+
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
411+
sudo chown $USER $HOME/.kube/config
412+
kubectl taint nodes --all node-role.kubernetes.io/master-
413+
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
414+
kubectl wait --for=condition=ready --timeout=30s node --all
415+
kubectl get nodes -o wide
416+
-
417+
name: Create Dockerfile
418+
run: |
419+
cat > ./Dockerfile <<EOL
420+
FROM alpine
421+
RUN echo hello
422+
EOL
423+
-
424+
name: Set up Docker Buildx
425+
uses: ./
426+
with:
427+
driver: kubernetes
428+
-
429+
name: Build
430+
run: |
431+
buildx build .

0 commit comments

Comments
 (0)