|
| 1 | +name: e2e |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - 'release-*' |
| 8 | + paths-ignore: |
| 9 | + - 'docs/**' |
| 10 | + - '**.adoc' |
| 11 | + - '**.md' |
| 12 | + - 'LICENSE' |
| 13 | + push: |
| 14 | + branches: |
| 15 | + - main |
| 16 | + - 'release-*' |
| 17 | + paths-ignore: |
| 18 | + - 'docs/**' |
| 19 | + - '**.adoc' |
| 20 | + - '**.md' |
| 21 | + - 'LICENSE' |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.head_ref }}-${{ github.workflow }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + kubernetes: |
| 29 | + |
| 30 | + runs-on: ubuntu-20.04 |
| 31 | + |
| 32 | + steps: |
| 33 | + - name: Cleanup |
| 34 | + run: | |
| 35 | + ls -lart |
| 36 | + echo "Initial status:" |
| 37 | + df -h |
| 38 | +
|
| 39 | + echo "Cleaning up resources:" |
| 40 | + sudo swapoff -a |
| 41 | + sudo rm -f /swapfile |
| 42 | + sudo apt clean |
| 43 | + sudo rm -rf /usr/share/dotnet |
| 44 | + sudo rm -rf /opt/ghc |
| 45 | + sudo rm -rf "/usr/local/share/boost" |
| 46 | + sudo rm -rf "$AGENT_TOOLSDIRECTORY" |
| 47 | + docker rmi $(docker image ls -aq) |
| 48 | +
|
| 49 | + echo "Final status:" |
| 50 | + df -h |
| 51 | +
|
| 52 | + - name: Checkout code |
| 53 | + uses: actions/checkout@v3 |
| 54 | + with: |
| 55 | + submodules: recursive |
| 56 | + |
| 57 | + - name: Init directories |
| 58 | + run: | |
| 59 | + TEMP_DIR="$(pwd)/tmp" |
| 60 | + mkdir -p "${TEMP_DIR}" |
| 61 | + echo "TEMP_DIR=${TEMP_DIR}" >> $GITHUB_ENV |
| 62 | +
|
| 63 | + mkdir -p "$(pwd)/bin" |
| 64 | + echo "$(pwd)/bin" >> $GITHUB_PATH |
| 65 | +
|
| 66 | + - name: Set Go |
| 67 | + uses: actions/setup-go@v3 |
| 68 | + with: |
| 69 | + go-version: v1.18 |
| 70 | + |
| 71 | + - name: Container image registry |
| 72 | + run: | |
| 73 | + podman run -d -p 5000:5000 --name registry registry:2.8.1 |
| 74 | +
|
| 75 | + export REGISTRY_ADDRESS=$(hostname -i):5000 |
| 76 | + echo "REGISTRY_ADDRESS=${REGISTRY_ADDRESS}" >> $GITHUB_ENV |
| 77 | + echo "Container image registry started at ${REGISTRY_ADDRESS}" |
| 78 | +
|
| 79 | + KIND_CONFIG_FILE=${{ env.TEMP_DIR }}/kind.yaml |
| 80 | + echo "KIND_CONFIG_FILE=${KIND_CONFIG_FILE}" >> $GITHUB_ENV |
| 81 | + envsubst < ./test/e2e/kind.yaml > ${KIND_CONFIG_FILE} |
| 82 | +
|
| 83 | + sudo --preserve-env=REGISTRY_ADDRESS sh -c 'cat > /etc/containers/registries.conf.d/local.conf <<EOF |
| 84 | + [[registry]] |
| 85 | + prefix = "$REGISTRY_ADDRESS" |
| 86 | + insecure = true |
| 87 | + location = "$REGISTRY_ADDRESS" |
| 88 | + EOF' |
| 89 | +
|
| 90 | + - name: Setup KinD cluster |
| 91 | + |
| 92 | + with: |
| 93 | + name: cluster |
| 94 | + version: v0.17.0 |
| 95 | + config: ${{ env.KIND_CONFIG_FILE }} |
| 96 | + |
| 97 | + - name: Print cluster info |
| 98 | + run: | |
| 99 | + echo "KinD cluster:" |
| 100 | + kubectl cluster-info |
| 101 | + kubectl describe nodes |
| 102 | +
|
| 103 | + - name: Deploy CodeFlare stack |
| 104 | + id: deploy |
| 105 | + run: | |
| 106 | + KUBERAY_VERSION=$(make get-kuberay-version) |
| 107 | + echo Deploying KubeRay ${KUBERAY_VERSION} |
| 108 | + kubectl create -k "github.com/ray-project/kuberay/ray-operator/config/default?ref=${KUBERAY_VERSION}&timeout=90s" |
| 109 | +
|
| 110 | + echo Deploying CodeFlare operator |
| 111 | + IMG="${REGISTRY_ADDRESS}"/codeflare-operator |
| 112 | + make image-push -e IMG="${IMG}" |
| 113 | + make deploy -e IMG="${IMG}" |
| 114 | + kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager |
| 115 | +
|
| 116 | + echo Deploying MCAD controller |
| 117 | + kubectl create ns codeflare-system |
| 118 | + cat <<EOF | kubectl apply -n codeflare-system -f - |
| 119 | + apiVersion: codeflare.codeflare.dev/v1alpha1 |
| 120 | + kind: MCAD |
| 121 | + metadata: |
| 122 | + name: mcad |
| 123 | + spec: |
| 124 | + controllerResources: {} |
| 125 | + EOF |
| 126 | +
|
| 127 | + cat <<EOF | kubectl apply -n codeflare-system -f - |
| 128 | + apiVersion: rbac.authorization.k8s.io/v1 |
| 129 | + kind: ClusterRole |
| 130 | + metadata: |
| 131 | + name: mcad-controller-rayclusters |
| 132 | + rules: |
| 133 | + - apiGroups: |
| 134 | + - ray.io |
| 135 | + resources: |
| 136 | + - rayclusters |
| 137 | + - rayclusters/finalizers |
| 138 | + - rayclusters/status |
| 139 | + verbs: |
| 140 | + - get |
| 141 | + - list |
| 142 | + - watch |
| 143 | + - create |
| 144 | + - update |
| 145 | + - patch |
| 146 | + - delete |
| 147 | + EOF |
| 148 | +
|
| 149 | + cat <<EOF | kubectl apply -n codeflare-system -f - |
| 150 | + kind: ClusterRoleBinding |
| 151 | + apiVersion: rbac.authorization.k8s.io/v1 |
| 152 | + metadata: |
| 153 | + name: mcad-controller-rayclusters |
| 154 | + subjects: |
| 155 | + - kind: ServiceAccount |
| 156 | + name: mcad-controller-mcad |
| 157 | + namespace: codeflare-system |
| 158 | + roleRef: |
| 159 | + apiGroup: rbac.authorization.k8s.io |
| 160 | + kind: ClusterRole |
| 161 | + name: mcad-controller-rayclusters |
| 162 | + EOF |
| 163 | +
|
| 164 | + kubectl wait --timeout=120s --for=condition=Available=true deployment -n codeflare-system mcad-controller-mcad |
| 165 | +
|
| 166 | + - name: Run e2e tests |
| 167 | + run: | |
| 168 | + make test-e2e |
| 169 | +
|
| 170 | + - name: Print CodeFlare operator logs |
| 171 | + if: always() && steps.deploy.outcome == 'success' |
| 172 | + run: | |
| 173 | + echo "Printing CodeFlare operator logs" |
| 174 | + kubectl logs -n openshift-operators --tail -1 -l app.kubernetes.io/name=codeflare-operator |
| 175 | +
|
| 176 | + - name: Print MCAD controller logs |
| 177 | + if: always() && steps.deploy.outcome == 'success' |
| 178 | + run: | |
| 179 | + echo "Printing MCAD controller logs" |
| 180 | + kubectl logs -n codeflare-system --tail -1 -l component=multi-cluster-application-dispatcher |
0 commit comments