From 17ebdd4d657fd1734938d25bc7ebb09e17f38430 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sun, 17 Apr 2022 17:14:42 +0200 Subject: [PATCH] ci: add jobs to check standalone behavior Signed-off-by: CrazyMax --- .github/workflows/ci.yml | 140 +++++++++++++++++++++++++++------------ 1 file changed, 97 insertions(+), 43 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5aed28b..30268f7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,21 +30,9 @@ jobs: uses: actions/checkout@v3 - name: Set up Docker Buildx - id: buildx uses: ./ with: version: ${{ matrix.buildx-version }} - - - name: Inspect builder - run: | - echo "Name: ${{ steps.buildx.outputs.name }}" - echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" - echo "Status: ${{ steps.buildx.outputs.status }}" - echo "Flags: ${{ steps.buildx.outputs.flags }}" - echo "Platforms: ${{ steps.buildx.outputs.platforms }}" - - - name: Dump context - uses: crazy-max/ghaction-dump-context@v1 multi: runs-on: ubuntu-latest @@ -54,28 +42,10 @@ jobs: uses: actions/checkout@v3 - name: Set up Docker Buildx 1 - id: buildx1 uses: ./ - - - name: Inspect builder 1 - run: | - echo "Name: ${{ steps.buildx1.outputs.name }}" - echo "Endpoint: ${{ steps.buildx1.outputs.endpoint }}" - echo "Status: ${{ steps.buildx1.outputs.status }}" - echo "Flags: ${{ steps.buildx1.outputs.flags }}" - echo "Platforms: ${{ steps.buildx1.outputs.platforms }}" - name: Set up Docker Buildx 2 - id: buildx2 uses: ./ - - - name: Inspect builder 2 - run: | - echo "Name: ${{ steps.buildx2.outputs.name }}" - echo "Endpoint: ${{ steps.buildx2.outputs.endpoint }}" - echo "Status: ${{ steps.buildx2.outputs.status }}" - echo "Flags: ${{ steps.buildx2.outputs.flags }}" - echo "Platforms: ${{ steps.buildx2.outputs.platforms }}" error: runs-on: ubuntu-latest @@ -328,18 +298,9 @@ jobs: platforms: ${{ matrix.qemu-platforms }} - name: Set up Docker Buildx - id: buildx uses: ./ with: version: ${{ matrix.buildx-version }} - - - name: Inspect builder - run: | - echo "Name: ${{ steps.buildx.outputs.name }}" - echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}" - echo "Status: ${{ steps.buildx.outputs.status }}" - echo "Flags: ${{ steps.buildx.outputs.flags }}" - echo "Platforms: ${{ steps.buildx.outputs.platforms }}" build-ref: runs-on: ubuntu-latest @@ -360,10 +321,6 @@ jobs: uses: ./ with: version: https://github.com/docker/buildx.git#${{ matrix.ref }} - - - name: Check version - run: | - docker buildx version - name: Create Dockerfile run: | @@ -375,3 +332,100 @@ jobs: uses: docker/build-push-action@master with: context: . + + standalone: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + buildx-version: + - latest + - "" + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Uninstall docker cli + run: | + sudo apt-get purge -y moby-cli moby-buildx + - + name: Set up Docker Buildx + uses: ./ + with: + version: ${{ matrix.buildx-version }} + - + name: Check available in path + if: matrix.standalone + run: | + buildx version + + standalone-install-error: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Uninstall docker cli + run: | + sudo apt-get purge -y moby-cli moby-buildx + - + name: Set up Docker Buildx + id: buildx + continue-on-error: true + uses: ./ + with: + install: true + - + name: Check + run: | + echo "${{ toJson(steps.buildx) }}" + if [ "${{ steps.buildx.outcome }}" != "failure" ] || [ "${{ steps.buildx.conclusion }}" != "success" ]; then + echo "::error::Should have failed" + exit 1 + fi + + standalone-kubernetes: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Uninstall moby + run: | + sudo apt-get purge -y moby-engine moby-cli moby-buildx + - + name: Setup k8s cluster + run: | + set -x + sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg + 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 + sudo apt-get update + sudo apt-get install -y kubelet kubeadm kubectl + sudo swapoff -a + sudo kubeadm init --cri-socket /run/containerd/containerd.sock + mkdir -p $HOME/.kube/ + sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config + sudo chown $USER $HOME/.kube/config + kubectl taint nodes --all node-role.kubernetes.io/master- + kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml + kubectl wait --for=condition=ready --timeout=30s node --all + kubectl get nodes -o wide + - + name: Create Dockerfile + run: | + cat > ./Dockerfile <