Skip to content

Commit

Permalink
Add CI for all workflow charts
Browse files Browse the repository at this point in the history
Signed-off-by: gabriel-farache <[email protected]>
  • Loading branch information
gabriel-farache committed Nov 5, 2024
1 parent a5b4c8d commit be7a3d6
Show file tree
Hide file tree
Showing 13 changed files with 1,053 additions and 14 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/create-ocp-project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Create OCP project CI

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'charts/create-ocp-project/**'
- .github/workflows/create-ocp-project.yaml

jobs:
run-e2e:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: kind

- name: Install Operators Support
run: |
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/crds.yaml
# give the apiserver time
sleep 5s
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/olm.yaml
- name: Deploy sonataflow-operator
run: |
helm repo add orchestrator https://parodos-dev.github.io/orchestrator-helm-chart
helm install orchestrator orchestrator/orchestrator-k8s
kubectl get sfp -A
kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=backstage" --timeout=10m
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=180s
- name: Deploy MTA serverless workflow and its components
run: |
TARGET_NS=sonataflow-infra
ls -al
cd charts
helm install create-ocp-project create-ocp-project -n "${TARGET_NS}"
WORKFLOW_NAME=create-ocp-project
kubectl -n sonataflow-infra patch secret "${WORKFLOW_NAME}-creds" --type merge -p '{
"data":{
"NOTIFICATIONS_BEARER_TOKEN":"'$(kubectl get secrets -n rhdh-operator backstage-backend-auth-secret -o go-template='{{ .data.BACKEND_SECRET }}')'"
},
"stringData":{
"JIRA_API_TOKEN":"DUMB_TOKEN",
"OCP_API_SERVER_TOKEN":"DUMB_TOKEN"
}
}'
kubectl -n sonataflow-infra patch sonataflow create-ocp-project --type merge -p '{
"spec": {
"podTemplate": {
"container": {
"env": [
{
"name": "BACKSTAGE_NOTIFICATIONS_URL",
"value": "http://backstage-backstage.rhdh-operator"
},
{
"name": "JIRA_URL",
"value": "DUMB_VALUE"
},
{
"name": "JIRA_USERNAME",
"value": "DUMB_VALUE"
},
{
"name": "OCP_API_SERVER_URL",
"value": "DUMB_VALUE"
},
{
"name": "OCP_CONSOLE_URL",
"value": "DUMB_VALUE"
}
]
}
}
}
}
'
kubectl -n ${TARGET_NS} wait --for=condition=Ready=true pods -l app="${WORKFLOW_NAME}" --timeout=1m
- uses: actions/checkout@v4
- name: Test workflow is responsive
run: |
kubectl expose "$(kubectl get pod -o name | grep create-ocp-project-analysis)" --type="NodePort" --port=8080 --name=create-ocp-project-svc
kubectl port-forward svc/create-ocp-project-svc 8080:8080 &
status_code=$(curl s -o /dev/null -w '%{http_code}' -XGET --location 'http://localhost:8080/create-ocp-project' --header 'Accept: application/json, text/plain, */*' --header 'Content-Type: application/json')
if [ "$status_code" -ne 200 ]; then;
echo "$status_code"
exit 1
fi
- name: Export kind Logs
if: always()
run: kind export logs ./kind_logs

- name: Upload Kind Logs
uses: actions/upload-artifact@v4
# Always run this, even if one of the previous steps failed.
if: always()
with:
name: kind-logs
path: ./kind_logs/

70 changes: 70 additions & 0 deletions .github/workflows/extendable-workflow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Extendable Workflow CI

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'charts/extendable-workflow/**'
- .github/workflows/extendable-workflow.yaml

jobs:
run-e2e:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: kind

- name: Install Operators Support
run: |
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/crds.yaml
# give the apiserver time
sleep 5s
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/olm.yaml
- name: Deploy sonataflow-operator
run: |
helm repo add orchestrator https://parodos-dev.github.io/orchestrator-helm-chart
helm install orchestrator orchestrator/orchestrator-k8s
kubectl get sfp -A
kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=backstage" --timeout=10m
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=180s
- name: Deploy MTA serverless workflow and its components
run: |
TARGET_NS=sonataflow-infra
cd charts
helm install extendable-workflow extendable-workflow -n "${TARGET_NS}"
WORKFLOW_NAME=extendable-workflow
kubectl -n ${TARGET_NS} wait --for=condition=Ready=true pods -l app="${WORKFLOW_NAME}" --timeout=1m
- uses: actions/checkout@v4
- name: Test workflow is responsive
run: |
kubectl expose "$(kubectl get pod -o name | grep extendable-workflow-analysis)" --type="NodePort" --port=8080 --name=extendable-workflow-svc
kubectl port-forward svc/extendable-workflow-svc 8080:8080 &
status_code=$(curl s -o /dev/null -w '%{http_code}' -XGET --location 'http://localhost:8080/extendable-workflow' --header 'Accept: application/json, text/plain, */*' --header 'Content-Type: application/json')
if [ "$status_code" -ne 200 ]; then;
echo "$status_code"
exit 1
fi
- name: Export kind Logs
if: always()
run: kind export logs ./kind_logs

- name: Upload Kind Logs
uses: actions/upload-artifact@v4
# Always run this, even if one of the previous steps failed.
if: always()
with:
name: kind-logs
path: ./kind_logs/

70 changes: 70 additions & 0 deletions .github/workflows/greeting.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Greeting CI

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'charts/greeting/**'
- .github/workflows/greeting.yaml

jobs:
run-e2e:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: kind

- name: Install Operators Support
run: |
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/crds.yaml
# give the apiserver time
sleep 5s
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/olm.yaml
- name: Deploy sonataflow-operator
run: |
helm repo add orchestrator https://parodos-dev.github.io/orchestrator-helm-chart
helm install orchestrator orchestrator/orchestrator-k8s
kubectl get sfp -A
kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=backstage" --timeout=10m
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=180s
- name: Deploy MTA serverless workflow and its components
run: |
TARGET_NS=sonataflow-infra
cd charts
helm install greeting greeting -n "${TARGET_NS}"
WORKFLOW_NAME=greeting
kubectl -n ${TARGET_NS} wait --for=condition=Ready=true pods -l app="${WORKFLOW_NAME}" --timeout=1m
- uses: actions/checkout@v4
- name: Test workflow is responsive
run: |
kubectl expose "$(kubectl get pod -o name | grep greeting-analysis)" --type="NodePort" --port=8080 --name=greeting-svc
kubectl port-forward svc/greeting-svc 8080:8080 &
status_code=$(curl s -o /dev/null -w '%{http_code}' -XGET --location 'http://localhost:8080/greeting' --header 'Accept: application/json, text/plain, */*' --header 'Content-Type: application/json')
if [ "$status_code" -ne 200 ]; then;
echo "$status_code"
exit 1
fi
- name: Export kind Logs
if: always()
run: kind export logs ./kind_logs

- name: Upload Kind Logs
uses: actions/upload-artifact@v4
# Always run this, even if one of the previous steps failed.
if: always()
with:
name: kind-logs
path: ./kind_logs/

110 changes: 110 additions & 0 deletions .github/workflows/modify-vm-resources.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Modify VM Resources CI

on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- 'charts/modify-vm-resources/**'
- .github/workflows/modify-vm-resources.yaml

jobs:
run-e2e:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4

- name: Create k8s Kind Cluster
uses: helm/[email protected]
with:
cluster_name: kind

- name: Install Operators Support
run: |
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/crds.yaml
# give the apiserver time
sleep 5s
kubectl apply -f https://raw.githubusercontent.com/operator-framework/operator-lifecycle-manager/master/deploy/upstream/quickstart/olm.yaml
- name: Deploy sonataflow-operator
run: |
helm repo add orchestrator https://parodos-dev.github.io/orchestrator-helm-chart
helm install orchestrator orchestrator/orchestrator-k8s
kubectl get sfp -A
kubectl wait --for=condition=Ready=true pods -l "app.kubernetes.io/name=backstage" --timeout=10m
kubectl get pods -o wide
kubectl wait --for=condition=Ready=true pods -l "app=sonataflow-platform" --timeout=180s
- name: Deploy MTA serverless workflow and its components
run: |
TARGET_NS=sonataflow-infra
cd charts
helm install modify-vm-resources modify-vm-resources -n "${TARGET_NS}"
WORKFLOW_NAME=modify-vm-resources
kubectl -n sonataflow-infra patch secret "${WORKFLOW_NAME}-creds" --type merge -p '{
"data":{
"NOTIFICATIONS_BEARER_TOKEN":"'$(kubectl get secrets -n rhdh-operator backstage-backend-auth-secret -o go-template='{{ .data.BACKEND_SECRET }}')'"
},
"stringData":{
"JIRA_API_TOKEN":"DUMB_TOKEN",
"OCP_API_SERVER_TOKEN":"DUMB_TOKEN"
}
}'
kubectl -n sonataflow-infra patch sonataflow modify-vm-resources --type merge -p '{
"spec": {
"podTemplate": {
"container": {
"env": [
{
"name": "BACKSTAGE_NOTIFICATIONS_URL",
"value": "http://backstage-backstage.rhdh-operator"
},
{
"name": "JIRA_URL",
"value": "DUMB_VALUE"
},
{
"name": "JIRA_USERNAME",
"value": "DUMB_VALUE"
},
{
"name": "OCP_API_SERVER_URL",
"value": "DUMB_VALUE"
},
{
"name": "OCP_CONSOLE_URL",
"value": "DUMB_VALUE"
}
]
}
}
}
}
'
kubectl -n ${TARGET_NS} wait --for=condition=Ready=true pods -l app="${WORKFLOW_NAME}" --timeout=1m
- uses: actions/checkout@v4
- name: Test workflow is responsive
run: |
kubectl expose "$(kubectl get pod -o name | grep modify-vm-resources-analysis)" --type="NodePort" --port=8080 --name=modify-vm-resources-svc
kubectl port-forward svc/modify-vm-resources-svc 8080:8080 &
status_code=$(curl s -o /dev/null -w '%{http_code}' -XGET --location 'http://localhost:8080/modify-vm-resources' --header 'Accept: application/json, text/plain, */*' --header 'Content-Type: application/json')
if [ "$status_code" -ne 200 ]; then;
echo "$status_code"
exit 1
fi
- name: Export kind Logs
if: always()
run: kind export logs ./kind_logs

- name: Upload Kind Logs
uses: actions/upload-artifact@v4
# Always run this, even if one of the previous steps failed.
if: always()
with:
name: kind-logs
path: ./kind_logs/

Loading

0 comments on commit be7a3d6

Please sign in to comment.