Skip to content

Commit 1022126

Browse files
WIP - e2e
1 parent cecae82 commit 1022126

38 files changed

+3764
-0
lines changed

.github/actions/kind/action.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: "Set up KinD"
2+
description: "Step to start and configure KinD cluster"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: Init directories
8+
shell: bash
9+
run: |
10+
TEMP_DIR="$(pwd)/tmp"
11+
mkdir -p "${TEMP_DIR}"
12+
echo "TEMP_DIR=${TEMP_DIR}" >> $GITHUB_ENV
13+
14+
mkdir -p "$(pwd)/bin"
15+
echo "$(pwd)/bin" >> $GITHUB_PATH
16+
17+
- name: Container image registry
18+
shell: bash
19+
run: |
20+
podman run -d -p 5000:5000 --name registry registry:2.8.1
21+
22+
export REGISTRY_ADDRESS=$(hostname -i):5000
23+
echo "REGISTRY_ADDRESS=${REGISTRY_ADDRESS}" >> $GITHUB_ENV
24+
echo "Container image registry started at ${REGISTRY_ADDRESS}"
25+
26+
KIND_CONFIG_FILE=${{ env.TEMP_DIR }}/kind.yaml
27+
echo "KIND_CONFIG_FILE=${KIND_CONFIG_FILE}" >> $GITHUB_ENV
28+
envsubst < .github/resources-kind/kind.yaml > ${KIND_CONFIG_FILE}
29+
30+
sudo --preserve-env=REGISTRY_ADDRESS sh -c 'cat > /etc/containers/registries.conf.d/local.conf <<EOF
31+
[[registry]]
32+
prefix = "$REGISTRY_ADDRESS"
33+
insecure = true
34+
location = "$REGISTRY_ADDRESS"
35+
EOF'
36+
37+
- name: Setup KinD cluster
38+
uses: helm/[email protected]
39+
with:
40+
cluster_name: cluster
41+
version: v0.17.0
42+
config: ${{ env.KIND_CONFIG_FILE }}
43+
44+
- name: Print cluster info
45+
shell: bash
46+
run: |
47+
echo "KinD cluster:"
48+
kubectl cluster-info
49+
kubectl describe nodes
50+
51+
- name: Install Ingress controller
52+
shell: bash
53+
run: |
54+
VERSION=controller-v1.6.4
55+
echo "Deploying Ingress controller into KinD cluster"
56+
curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/"${VERSION}"/deploy/static/provider/kind/deploy.yaml | sed "s/--publish-status-address=localhost/--report-node-internal-ip-address\\n - --status-update-interval=10/g" | kubectl apply -f -
57+
kubectl annotate ingressclass nginx "ingressclass.kubernetes.io/is-default-class=true"
58+
kubectl -n ingress-nginx wait --timeout=300s --for=condition=Available deployments --all

.github/workflows/e2e_tests.yaml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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: Set Go
58+
uses: actions/setup-go@v3
59+
with:
60+
go-version: v1.19
61+
62+
- name: Set up gotestfmt
63+
uses: gotesttools/gotestfmt-action@v2
64+
with:
65+
token: ${{ secrets.GITHUB_TOKEN }}
66+
67+
- name: Setup and start KinD cluster
68+
uses: ./.github/actions/kind
69+
70+
- name: Deploy CodeFlare stack
71+
id: deploy
72+
run: |
73+
echo Deploying CodeFlare operator
74+
IMG="${REGISTRY_ADDRESS}"/codeflare-operator
75+
make image-push -e IMG="${IMG}"
76+
make deploy -e IMG="${IMG}"
77+
kubectl wait --timeout=120s --for=condition=Available=true deployment -n openshift-operators codeflare-operator-manager
78+
79+
echo Setting up CodeFlare stack
80+
make setup-e2e
81+
82+
- name: Run e2e tests
83+
run: |
84+
export CODEFLARE_TEST_TIMEOUT_SHORT=1m
85+
export CODEFLARE_TEST_TIMEOUT_MEDIUM=5m
86+
export CODEFLARE_TEST_TIMEOUT_LONG=10m
87+
88+
export CODEFLARE_TEST_OUTPUT_DIR=${{ env.TEMP_DIR }}
89+
echo "CODEFLARE_TEST_OUTPUT_DIR=${CODEFLARE_TEST_OUTPUT_DIR}" >> $GITHUB_ENV
90+
91+
set -euo pipefail
92+
go test -timeout 30m -v ./tests/e2e -json 2>&1 | tee ${CODEFLARE_TEST_OUTPUT_DIR}/gotest.log | gotestfmt
93+
94+
- name: Print CodeFlare operator logs
95+
if: always() && steps.deploy.outcome == 'success'
96+
run: |
97+
echo "Printing CodeFlare operator logs"
98+
kubectl logs -n openshift-operators --tail -1 -l app.kubernetes.io/name=codeflare-operator | tee ${CODEFLARE_TEST_OUTPUT_DIR}/codeflare-operator.log
99+
100+
- name: Print MCAD controller logs
101+
if: always() && steps.deploy.outcome == 'success'
102+
run: |
103+
echo "Printing MCAD controller logs"
104+
kubectl logs -n codeflare-system --tail -1 -l component=multi-cluster-application-dispatcher | tee ${CODEFLARE_TEST_OUTPUT_DIR}/mcad.log
105+
106+
- name: Print KubeRay operator logs
107+
if: always() && steps.deploy.outcome == 'success'
108+
run: |
109+
echo "Printing KubeRay operator logs"
110+
kubectl logs -n ray-system --tail -1 -l app.kubernetes.io/name=kuberay | tee ${CODEFLARE_TEST_OUTPUT_DIR}/kuberay.log
111+
112+
- name: Upload logs
113+
uses: actions/upload-artifact@v3
114+
if: always() && steps.deploy.outcome == 'success'
115+
with:
116+
name: logs
117+
retention-days: 10
118+
path: |
119+
${{ env.CODEFLARE_TEST_OUTPUT_DIR }}/**/*.log

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Build the manager binary
2+
FROM registry.access.redhat.com/ubi8/go-toolset:1.19.10-10 as builder
3+
4+
WORKDIR /workspace
5+
# Copy the Go Modules manifests
6+
COPY go.mod go.mod
7+
COPY go.sum go.sum
8+
RUN go mod download
9+
10+
# Copy the go source
11+
COPY main.go main.go
12+
COPY api/ api/
13+
COPY controllers/ controllers/
14+
15+
# Build
16+
USER root
17+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go
18+
19+
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.7
20+
WORKDIR /
21+
COPY --from=builder /workspace/manager .
22+
COPY config/internal config/internal
23+
24+
USER 65532:65532
25+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)