|
| 1 | +# |
| 2 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 3 | +# or more contributor license agreements. See the NOTICE file |
| 4 | +# distributed with this work for additional information |
| 5 | +# regarding copyright ownership. The ASF licenses this file |
| 6 | +# to you under the Apache License, Version 2.0 (the |
| 7 | +# "License"); you may not use this file except in compliance |
| 8 | +# with the License. You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, |
| 13 | +# software distributed under the License is distributed on an |
| 14 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | +# KIND, either express or implied. See the License for the |
| 16 | +# specific language governing permissions and limitations |
| 17 | +# under the License. |
| 18 | +# |
| 19 | + |
| 20 | +# waits: |
| 21 | +# first wait to have at least one of a type, then wait for all to be in a state; if waiting for state with empty set, kubectl fails |
| 22 | + |
| 23 | +name: Test skupper-router main |
| 24 | +description: Execute skupper integration testing |
| 25 | + |
| 26 | +inputs: |
| 27 | + |
| 28 | + qdrouterdImage: |
| 29 | + required: true |
| 30 | + description: Image to use in skupper integration tests |
| 31 | + |
| 32 | + skupperGitRef: |
| 33 | + required: false |
| 34 | + description: Reference to skupper version |
| 35 | + default: "0.8.7" |
| 36 | + |
| 37 | +runs: |
| 38 | + using: "composite" |
| 39 | + steps: |
| 40 | + |
| 41 | +# As of version 18.03, you can use host.docker.internal as the host's IP. |
| 42 | + |
| 43 | +# - name: push image |
| 44 | +# run: sudo microk8s ctr k8s.io image import myimage.tgz |
| 45 | + |
| 46 | +# Use currently built image |
| 47 | +# also consider https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane.md but likely overkill |
| 48 | +# $ docker save hello-web > hello-web.tar |
| 49 | +# sudo microk8s.ctr -n k8s.io image import hello-web.tar |
| 50 | +# sudo microk8s.ctr -n k8s.io images ls --name~=hello-web |
| 51 | +# sudo docker build . -t localhost:32000/hello-web:v3 |
| 52 | + |
| 53 | + - name: Get Go cache paths |
| 54 | + id: go-cache-paths |
| 55 | + run: | |
| 56 | + echo "::set-output name=go-build::$(go env GOCACHE)" |
| 57 | + echo "::set-output name=go-mod::$(go env GOMODCACHE)" |
| 58 | + shell: bash |
| 59 | + |
| 60 | + # https://microk8s.io/docs/addon-metallb |
| 61 | + - name: Install microk8s |
| 62 | + run: | |
| 63 | + sudo snap install microk8s --classic --channel=1.21/stable |
| 64 | + sudo microk8s enable dns ingress storage registry:size=20Gi host-access:ip=10.0.1.1 metallb:10.64.140.43-10.64.140.49 |
| 65 | + sudo microk8s status --wait-ready |
| 66 | + shell: bash |
| 67 | + |
| 68 | + - name: Export microk8s config |
| 69 | + if: "${{ always() }}" |
| 70 | + run: | |
| 71 | + mkdir -p $HOME/.kube |
| 72 | + sudo microk8s config > $HOME/.kube/config |
| 73 | + shell: bash |
| 74 | + |
| 75 | + - name: Push image into microk8s |
| 76 | + run: | |
| 77 | + docker tag "${{ inputs.qdrouterdImage }}" localhost:32000/skupper-router:registry |
| 78 | + timeout 5m bash -c 'until nc -z localhost 32000; do sleep 1; done' || : |
| 79 | + docker push localhost:32000/skupper-router:registry |
| 80 | + shell: bash |
| 81 | + |
| 82 | + - name: Checkout Skupper |
| 83 | + uses: actions/checkout@v2 |
| 84 | + with: |
| 85 | + repository: 'skupperproject/skupper' |
| 86 | + ref: "${{ inputs.skupperGitRef }}" |
| 87 | + path: 'skupper' |
| 88 | + |
| 89 | + - name: Restore Go cache |
| 90 | + uses: actions/cache@v2 |
| 91 | + with: |
| 92 | + path: | |
| 93 | + ${{ steps.go-cache-paths.outputs.go-build }} |
| 94 | + ${{ steps.go-cache-paths.outputs.go-mod }} |
| 95 | + key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }} |
| 96 | + |
| 97 | + - name: Compile Skupper |
| 98 | + run: | |
| 99 | + make all |
| 100 | + sudo install skupper /usr/local/bin |
| 101 | + working-directory: skupper |
| 102 | + shell: bash |
| 103 | + |
| 104 | + - name: Run Skupper integration tests |
| 105 | + run: | |
| 106 | + export PUBLIC_1_INGRESS_HOST=10.0.1.1 |
| 107 | + export QDROUTERD_IMAGE=localhost:32000/skupper-router:registry |
| 108 | +
|
| 109 | + go test -count=1 -p=1 -timeout=60m -tags=integration -v ./test/integration/... |
| 110 | + working-directory: skupper |
| 111 | + shell: bash |
| 112 | + |
| 113 | + # https://github.com/canonical/microk8s/issues/1660 |
| 114 | + - name: Dump microk8s log (apiserver) |
| 115 | + if: "${{ always() }}" |
| 116 | + run: | |
| 117 | + sudo journalctl -u snap.microk8s.daemon-apiserver |
| 118 | + shell: bash |
| 119 | + |
| 120 | + - name: Dump microk8s log (kubelet) |
| 121 | + if: "${{ always() }}" |
| 122 | + run: | |
| 123 | + sudo journalctl -u snap.microk8s.daemon-kubelet |
| 124 | + shell: bash |
| 125 | + |
| 126 | + - name: Dump microk8s log (kubelite) |
| 127 | + if: "${{ always() }}" |
| 128 | + run: | |
| 129 | + sudo journalctl -u snap.microk8s.daemon-kubelite |
| 130 | + shell: bash |
0 commit comments