|
| 1 | +name: Smoke Run (reusable) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + container-runtime: |
| 7 | + description: 'Container runtime to use (docker or podman)' |
| 8 | + type: string |
| 9 | + required: true |
| 10 | + install-optional-components: |
| 11 | + description: 'Whether to install optional CF components' |
| 12 | + type: string |
| 13 | + required: true |
| 14 | + artifact-name: |
| 15 | + description: 'Name of the uploaded test report artifact' |
| 16 | + type: string |
| 17 | + required: true |
| 18 | + fresh-validation: |
| 19 | + description: 'Use versions of cf-deployment from the develop branch' |
| 20 | + type: boolean |
| 21 | + required: false |
| 22 | + default: false |
| 23 | + |
| 24 | +jobs: |
| 25 | + smoke-run: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + id-token: write |
| 29 | + contents: read |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v6 |
| 32 | + with: |
| 33 | + fetch-depth: 0 |
| 34 | + - name: Check if only ignored paths changed |
| 35 | + id: check_changes |
| 36 | + run: | |
| 37 | + if [ "${{ github.event_name }}" == "pull_request" ]; then |
| 38 | + CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) |
| 39 | + RELEVANT_FILES=$(echo "$CHANGED_FILES" | grep -v -E '.*\.Dockerfile|^releases/.*/files/|^\.github/|^docs/|\.md$|^renovate\.json$' || true) |
| 40 | + if [ -z "$RELEVANT_FILES" ]; then |
| 41 | + echo "Only ignored paths were changed. Skipping workflow." |
| 42 | + echo "skip=true" >> $GITHUB_OUTPUT |
| 43 | + else |
| 44 | + echo "skip=false" >> $GITHUB_OUTPUT |
| 45 | + fi |
| 46 | + else |
| 47 | + echo "skip=false" >> $GITHUB_OUTPUT |
| 48 | + fi |
| 49 | + - name: Pin nip.io domains to localhost |
| 50 | + if: steps.check_changes.outputs.skip != 'true' |
| 51 | + run: | |
| 52 | + # nip.io is an external DNS service; CI runners sometimes can't resolve it. |
| 53 | + printf '127.0.0.1 api.127-0-0-1.nip.io\n127.0.0.1 uaa.127-0-0-1.nip.io\n127.0.0.1 login.127-0-0-1.nip.io\n127.0.0.1 apps.127-0-0-1.nip.io\n127.0.0.1 doppler.127-0-0-1.nip.io\n127.0.0.1 log-stream.127-0-0-1.nip.io\n' | sudo tee -a /etc/hosts |
| 54 | + - name: Set kernel settings |
| 55 | + if: steps.check_changes.outputs.skip != 'true' |
| 56 | + run: | |
| 57 | + sudo sysctl -w fs.inotify.max_user_instances=512 |
| 58 | + sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80 |
| 59 | + - name: Set kernel settings (Podman extras) |
| 60 | + if: steps.check_changes.outputs.skip != 'true' && inputs.container-runtime == 'podman' |
| 61 | + run: | |
| 62 | + # Mount BPF filesystem on the host (needed by kindnet on some kernels) |
| 63 | + sudo mount bpffs /sys/fs/bpf -t bpf -o nosuid,nodev,noexec,relatime || true |
| 64 | + - name: Install podman-compose |
| 65 | + if: steps.check_changes.outputs.skip != 'true' && inputs.container-runtime == 'podman' |
| 66 | + run: | |
| 67 | + sudo apt-get update -qq |
| 68 | + sudo apt-get install -y podman-compose |
| 69 | + # Ensure podman-compose is used instead of the docker-compose plugin shim |
| 70 | + sudo ln -sf /usr/bin/podman-compose /usr/local/bin/podman-compose |
| 71 | + - name: Install dependencies |
| 72 | + if: steps.check_changes.outputs.skip != 'true' |
| 73 | + run: | |
| 74 | + mkdir -p $HOME/.local/bin && echo "$HOME/.local/bin" >> "$GITHUB_PATH" |
| 75 | + curl -L https://kind.sigs.k8s.io/dl/v${KIND_VERSION}/kind-linux-amd64 -o $HOME/.local/bin/kind |
| 76 | + chmod +x $HOME/.local/bin/kind |
| 77 | + curl -L https://github.com/helmfile/helmfile/releases/download/v${HELMFILE_VERSION}/helmfile_${HELMFILE_VERSION}_linux_amd64.tar.gz | tar -zx |
| 78 | + mv helmfile $HOME/.local/bin/helmfile |
| 79 | + curl -L "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${CF_CLI_VERSION}&source=github" | tar -zx |
| 80 | + mv cf8 $HOME/.local/bin/cf |
| 81 | + env: |
| 82 | + # renovate: dataSource=github-releases depName=cloudfoundry/cli |
| 83 | + CF_CLI_VERSION: "8.18.3" |
| 84 | + # renovate: dataSource=github-releases depName=kubernetes-sigs/kind |
| 85 | + KIND_VERSION: "0.32.0" |
| 86 | + # renovate: dataSource=github-releases depName=helmfile/helmfile |
| 87 | + HELMFILE_VERSION: "1.5.3" |
| 88 | + - name: Use develop versions of cf-deployment |
| 89 | + id: pre_validation |
| 90 | + if: steps.check_changes.outputs.skip != 'true' && inputs.fresh-validation == true |
| 91 | + env: |
| 92 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + run: | |
| 94 | + pip3 install -r scripts/requirements.txt |
| 95 | + python3 scripts/sync-cf-deployment-versions.py --ref develop |
| 96 | + - name: Run make up |
| 97 | + if: steps.check_changes.outputs.skip != 'true' |
| 98 | + run: make up |
| 99 | + env: |
| 100 | + CONTAINER_RUNTIME: ${{ inputs.container-runtime }} |
| 101 | + INSTALL_OPTIONAL_COMPONENTS: ${{ inputs.install-optional-components }} |
| 102 | + - name: Login |
| 103 | + if: steps.check_changes.outputs.skip != 'true' |
| 104 | + run: make login |
| 105 | + - name: Init |
| 106 | + if: steps.check_changes.outputs.skip != 'true' |
| 107 | + run: make bootstrap-complete |
| 108 | + - name: setup CF tests |
| 109 | + if: steps.check_changes.outputs.skip != 'true' |
| 110 | + uses: ./.github/actions/setup-cf-tests |
| 111 | + with: |
| 112 | + test-repo: cf-smoke-tests |
| 113 | + test-branch: main |
| 114 | + config-template: ./.github/smoke-config.tpl |
| 115 | + config-output: ./.github/smoke-config.json |
| 116 | + - name: run smoke test |
| 117 | + if: steps.check_changes.outputs.skip != 'true' |
| 118 | + env: |
| 119 | + CONFIG: "${{ github.workspace }}/.github/smoke-config.json" |
| 120 | + GINKGO_NO_COLOR: "true" |
| 121 | + run: | |
| 122 | + ./cf-smoke-tests/bin/test --no-color --github-output --timeout=30m --procs=4 --json-report report.json |
| 123 | + - name: debug events |
| 124 | + if: failure() |
| 125 | + run: kubectl get events -A --sort-by='.lastTimestamp' |
| 126 | + - name: debug cilium |
| 127 | + if: failure() && inputs.container-runtime == 'podman' |
| 128 | + run: | |
| 129 | + echo "===== CILIUM PODS =====" |
| 130 | + kubectl get pod -n kube-system -l k8s-app=cilium -o wide |
| 131 | + echo "===== CILIUM AGENT LOGS (all pods) =====" |
| 132 | + for pod in $(kubectl get pod -n kube-system -l k8s-app=cilium -o jsonpath='{.items[*].metadata.name}'); do |
| 133 | + echo "--- $pod ---" |
| 134 | + kubectl logs -n kube-system "$pod" --all-containers=true --previous 2>/dev/null || kubectl logs -n kube-system "$pod" --all-containers=true 2>/dev/null || true |
| 135 | + done |
| 136 | + echo "===== CILIUM OPERATOR LOGS =====" |
| 137 | + kubectl logs -n kube-system -l name=cilium-operator --all-containers=true 2>/dev/null || true |
| 138 | + echo "===== CILIUM STATUS =====" |
| 139 | + kubectl exec -n kube-system $(kubectl get pod -n kube-system -l k8s-app=cilium -o jsonpath='{.items[0].metadata.name}' 2>/dev/null) -- cilium status 2>/dev/null || true |
| 140 | + - name: debug pods |
| 141 | + if: failure() |
| 142 | + run: | |
| 143 | + echo "===== CLOUD_CONTROLLER =====" |
| 144 | + kubectl get pod -n cf-system -l app.kubernetes.io/name=cloud-controller -o wide |
| 145 | + kubectl get pod -n cf-system -l app.kubernetes.io/name=cloud-controller -o jsonpath='{.status.containerStatuses[*].state}' | jq |
| 146 | + kubectl logs -n cf-system -l app.kubernetes.io/name=cloud-controller --all-containers=true |
| 147 | + echo "===== CC_WORKER =====" |
| 148 | + kubectl get pod -n cf-system -l app.kubernetes.io/name=cc-worker -o wide |
| 149 | + kubectl logs -n cf-system -l app.kubernetes.io/name=cc-worker |
| 150 | + echo "===== CC_UPLOADER =====" |
| 151 | + kubectl get pod -n cf-system -l app=cc-uploader -o wide |
| 152 | + kubectl logs -n cf-system -l app=cc-uploader |
| 153 | + echo "===== CC_DEPLOYMENT_UPDATER =====" |
| 154 | + kubectl get pod -n cf-system -l app.kubernetes.io/name=cc-deployment-updater -o wide |
| 155 | + kubectl logs -n cf-system -l app.kubernetes.io/name=cc-deployment-updater |
| 156 | + echo "===== CC_WORKER_CLOCK =====" |
| 157 | + kubectl get pod -n cf-system -l app.kubernetes.io/name=cc-worker-clock -o wide |
| 158 | + kubectl logs -n cf-system -l app.kubernetes.io/name=cc-worker-clock |
| 159 | + - name: debug pods (Podman extras) |
| 160 | + if: failure() && inputs.container-runtime == 'podman' |
| 161 | + run: | |
| 162 | + echo "===== CF_TCP_ROUTER =====" |
| 163 | + kubectl get pod -n cf-system -l app=cf-tcp-router -o wide |
| 164 | + kubectl get pod -n cf-system -l app=cf-tcp-router -o jsonpath='{.items[*].status.containerStatuses[*].state}' | jq 2>/dev/null || true |
| 165 | + kubectl logs -n cf-system -l app=cf-tcp-router --all-containers=true 2>/dev/null || true |
| 166 | + echo "===== ROUTING_API =====" |
| 167 | + kubectl get pod -n cf-system -l app=routing-api -o wide |
| 168 | + kubectl logs -n cf-system -l app=routing-api --all-containers=true 2>/dev/null || true |
| 169 | + - uses: actions/upload-artifact@v7 |
| 170 | + if: always() |
| 171 | + with: |
| 172 | + name: ${{ inputs.artifact-name }} |
| 173 | + path: ./cf-smoke-tests/report.json |
0 commit comments