Skip to content

Commit 36a6481

Browse files
adds github workflow
1 parent bc19051 commit 36a6481

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

.github/workflows/on_push.yml

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ name: CI Pipeline for Kruize UI
22

33
on:
44
push:
5-
branches: [mvp_demo]
5+
branches: [mvp_demo, main]
66
pull_request:
7-
branches: [mvp_demo]
7+
branches: [mvp_demo, main]
88

99
jobs:
1010
deploy_kruize:
1111
runs-on: ubuntu-20.04
12+
outputs:
13+
minikube_ip: ${{ steps.get_minikube.outputs.minikube_ip }}
14+
kruize_port: ${{ steps.get_kruize.outputs.kruize_port }}
1215
steps:
1316
- name: Checkout kruize/autotune repository
14-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1518
with:
1619
repository: kruize/autotune
1720
ref: mvp_demo
@@ -56,58 +59,53 @@ jobs:
5659
cp ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml.old
5760
sed -e "s/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g" ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml.old > ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml
5861
cat ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml
59-
cd tests
60-
./test_autotune.sh -c minikube -i quay.io/kruize/autotune_operator:0.1 --testsuite=local_monitoring_tests --testcase=test_e2e --resultsdir=${GITHUB_WORKSPACE}
62+
./deploy.sh -c minikube -m crc -i quay.io/kruize/autotune_operator:0.1
6163
62-
- name: Capture ffdc logs
63-
if: always()
64+
- name: Get Minikube IP
65+
id: get_minikube
6466
run: |
65-
echo "Capturing ffdc logs"
66-
cd autotune
67-
./scripts/ffdc.sh -m crc -d ${GITHUB_WORKSPACE}/kruize_test_results
67+
minikube_ip=$(minikube ip)
68+
echo "Minikube IP: $minikube_ip"
69+
echo "Minikube IP=$minikube_ip" >> $GITHUB_OUTPUT
70+
shell: bash
71+
env:
72+
MINIKUBE_HOME: /home/runner/work/_temp
73+
ROOT_DIR: /home/runner/work/kruize-ui/kruize-ui/autotune
6874

69-
- name: Archive results
70-
if: always()
75+
- name: Get Kruize Port
76+
id: get_kruize
7177
run: |
72-
cd ${GITHUB_WORKSPACE}
73-
tar cvf crc_results.tar kruize_test_results
74-
75-
- name: Upload results
76-
if: always()
77-
uses: actions/upload-artifact@v3
78-
with:
79-
name: crc-results
80-
path: ./crc_results.tar
81-
retention-days: 2
78+
kruize_port=$(kubectl -n monitoring get svc kruize --no-headers -o=custom-columns=PORT:.spec.ports[*].nodePort 2>/dev/null)
79+
echo "PORT : $kruize_port"
80+
echo "kruize_port=$kruize_port" >> $GITHUB_OUTPUT
81+
shell: bash
82+
env:
83+
MINIKUBE_HOME: /home/runner/work/_temp
84+
ROOT_DIR: /home/runner/work/kruize-ui/kruize-ui/autotune
8285

8386
build_ui:
8487
needs: deploy_kruize
8588
runs-on: ubuntu-latest
89+
env:
90+
minikube_ip: ${{ needs.deploy_kruize.outputs.minikube_ip }}
91+
kruize_port: ${{ needs.deploy_kruize.outputs.kruize_port }}
8692
steps:
8793
- name: Checkout Code
8894
uses: actions/checkout@v4
8995

9096
- name: Set up Node.js
91-
uses: actions/setup-node@v3
97+
uses: actions/setup-node@v4
9298
with:
9399
node-version: '18'
94100
cache: 'npm'
95101

96102
- name: Install Dependencies
97103
run: npm config set legacy-peer-deps true && npm install
98104

99-
# Step 5: Get Minikube IP
100-
- name: Get Minikube IP
101-
run: |
102-
export CLUSTER_IP=$(minikube ip)
103-
echo "CLUSTER_IP=$CLUSTER_IP" >> $GITHUB_ENV
104-
shell: bash
105-
106-
# Step 6: Get Kruize Port
107-
- name: Get Kruize Port
105+
- name: Export and Print Environment Variables
108106
run: |
109-
export KRUIZE_PORT=$(kubectl -n monitoring get svc kruize --no-headers -o=custom-columns=PORT:.spec.ports[*].nodePort 2>/dev/null)
110-
echo "KRUIZE_PORT=$KRUIZE_PORT" >> $GITHUB_ENV
107+
echo "Minikube IP: $minikube_ip"
108+
echo "Kruize Port: $kruize_port"
111109
shell: bash
112110

113111
- name: Build UI
@@ -121,7 +119,7 @@ jobs:
121119
uses: actions/checkout@v4
122120

123121
- name: Set up Node.js
124-
uses: actions/setup-node@v3
122+
uses: actions/setup-node@v4
125123
with:
126124
node-version: '18'
127125
cache: 'npm'

0 commit comments

Comments
 (0)