Add request redirect and mirror filters functionality #193
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: start and run agent cucumber integration tests | |
on: | |
workflow_dispatch: | |
pull_request_target: | |
types: [labeled] | |
concurrency: | |
group: agent-integration-test-${{ github.event.number || github.run_id }} | |
cancel-in-progress: true | |
env: | |
GH_TOKEN: ${{ secrets.APK_BOT_TOKEN }} | |
jobs: | |
runs_agent_cucumber_integration_tests_on_pull_request: | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Create AKS Cluster and set context | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: 2.44.1 | |
inlineScript: | | |
az aks create --resource-group "${{ secrets.AZURE_RESOURCE_GROUP }}" --name "agent-integ-${{ secrets.AKS_CLUSTER_NAME }}-${{ github.event.number || github.run_id }}" --enable-cluster-autoscaler --min-count 1 --max-count 3 --location "southeastasia" --node-vm-size Standard_DS4_v2 --generate-ssh-keys | |
- uses: azure/aks-set-context@v3 | |
with: | |
resource-group: '${{ secrets.AZURE_RESOURCE_GROUP }}' | |
cluster-name: 'agent-integ-${{ secrets.AKS_CLUSTER_NAME }}-${{ github.event.number || github.run_id }}' | |
- name: Create Namespace apk | |
shell: sh | |
run: | | |
kubectl create namespace apk | |
kubectl get ns | |
- name: Checkout apk-repo. | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: "0" | |
path: apk-repo | |
token: ${{ secrets.APK_BOT_TOKEN }} | |
- name: Set release username and email | |
shell: sh | |
run: | | |
git config --global user.name ${{ secrets.APK_BOT_USER }} | |
git config --global user.email ${{ secrets.APK_BOT_EMAIL }} | |
- name: checkout pull request and merge. | |
shell: sh | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
run: | | |
cd apk-repo | |
gh pr checkout ${{ github.event.number }} -b pr-${{ github.event.number }} | |
git checkout pr-${{ github.event.number }} | |
git merge origin/main | |
- name: Helm release deploy APIM CP | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
shell: sh | |
run: | | |
helm repo add wso2apim https://github.com/wso2/helm-apim/releases/download/cp-4.3.0 | |
helm repo update | |
helm install apim wso2apim/wso2am-cp --version 4.3.0 -f https://raw.githubusercontent.com/wso2/apk/main/helm-charts/samples/apim/cp/values.yaml -n apk --debug --wait --timeout 5m0s | |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.10.0/deploy/static/provider/cloud/deploy.yaml | |
kubectl get pods -n apk | |
kubectl get svc -n apk | |
kubectl get ing -n apk | |
- name: Helm release deploy APK DP | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
shell: sh | |
run: | | |
cd apk-repo/helm-charts | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo add jetstack https://charts.jetstack.io | |
helm dependency build | |
helm install apk -n apk . --debug --wait --timeout 15m0s \ | |
--set wso2.apk.cp.enabledSubscription=true \ | |
--set wso2.apk.cp.host="apim-apk-agent-service.apk.svc.cluster.local" \ | |
--set wso2.apk.cp.skipSSLVerification=true \ | |
--set wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.JWKSClient.skipSSLVerification=false \ | |
--set wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.JWKSClient.hostnameVerifier="AllowAll" | |
kubectl get pods -n apk | |
kubectl get svc -n apk | |
- name: Helm release deploy APIM APK Agent | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
shell: sh | |
run: | | |
cd apk-repo/test/apim-apk-agent-test/agent-helm-chart | |
helm dependency build | |
helm install apim-apk-agent -n apk . --debug --wait --timeout 2m0s \ | |
--set controlPlane.serviceURL=https://apim-wso2am-cp-1-service.apk.svc.cluster.local:9443/ \ | |
--set controlPlane.eventListeningEndpoints="amqp:https://admin:[email protected]:5672?retries='10'&connectdelay='30'" \ | |
--set dataPlane.k8ResourceEndpoint=https://apk-wso2-apk-config-ds-service.apk.svc.cluster.local:9443/api/configurator/apis/generate-k8s-resources | |
kubectl get pods -n apk | |
kubectl get svc -n apk | |
- name: Run test cases(CP to DP Flow) | |
shell: sh | |
run: | | |
cd apk-repo/test/cucumber-tests | |
sh ./scripts/agent-setup-hosts.sh | |
./gradlew runCpToDpTests | |
- name: Helm release undeploy | |
if: always() | |
shell: sh | |
run: | | |
cd apk-repo/helm-charts | |
kubectl describe pods -n apk | |
kubectl get pods -n apk | |
kubectl get svc -n apk | |
kubectl get apis -n apk | |
kubectl get applications -n apk | |
kubectl get subscriptions -n apk | |
kubectl get tokenissuers -n apk | |
kubectl get httproutes -n apk | |
kubectl get ing -n apk | |
kubectl get pods -l app.kubernetes.io/name=apim-apk-agent | awk '{print $1}' | xargs -I{} kubectl logs {} -n apk | |
helm uninstall apk -n apk | |
helm uninstall apim -n apk | |
helm uninstall apim-apk-agent -n apk | |
kubectl delete namespace apk | |
- name: Publish Test Report(CP to DP Flow) | |
if: always() | |
uses: malinthaprasan/action-surefire-report@v1 | |
with: | |
report_paths: 'apk-repo/test/cucumber-tests/build/test-output/junitreports/*.xml' | |
fail_on_test_failures: true | |
- name: Create Namespace apk | |
shell: sh | |
run: | | |
kubectl create namespace apk | |
kubectl get ns | |
- name: Checkout apk-repo. | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: "0" | |
path: apk-repo | |
token: ${{ secrets.APK_BOT_TOKEN }} | |
- name: Set release username and email | |
shell: sh | |
run: | | |
git config --global user.name ${{ secrets.APK_BOT_USER }} | |
git config --global user.email ${{ secrets.APK_BOT_EMAIL }} | |
- name: checkout pull request and merge. | |
shell: sh | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
run: | | |
cd apk-repo | |
gh pr checkout ${{ github.event.number }} -b pr-${{ github.event.number }} | |
git checkout pr-${{ github.event.number }} | |
git merge origin/main | |
- name: Helm release deploy APIM CP | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
shell: sh | |
run: | | |
helm repo add wso2apim https://github.com/wso2/helm-apim/releases/download/cp-4.3.0 | |
helm repo update | |
helm install apim wso2apim/wso2am-cp --version 4.3.0 -f https://raw.githubusercontent.com/wso2/apk/main/helm-charts/samples/apim/cp/apk-cp/values.yaml -n apk --debug --wait --timeout 5m0s | |
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.10.0/deploy/static/provider/cloud/deploy.yaml | |
kubectl get pods -n apk | |
kubectl get svc -n apk | |
kubectl get ing -n apk | |
- name: Helm release deploy APK DP(DP to CP Flow) | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
shell: sh | |
run: | | |
cd apk-repo/helm-charts | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo add jetstack https://charts.jetstack.io | |
helm dependency build | |
helm install apk -n apk . \ | |
--set wso2.apk.cp.enabledSubscription=true \ | |
--set wso2.apk.cp.enableApiPropagation=true \ | |
--set wso2.apk.cp.host="apim-apk-agent-service.apk.svc.cluster.local" \ | |
--set wso2.apk.cp.skipSSLVerification=true \ | |
--set wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.mandateSubscriptionValidation=true \ | |
--set wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.mandateInternalKeyValidation=true \ | |
--set wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.JWKSClient.skipSSLVerification=false \ | |
--set wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.JWKSClient.hostnameVerifier="AllowAll" | |
kubectl get pods -n apk | |
kubectl get svc -n apk | |
- name: Helm release deploy APIM APK Agent(DP to CP Flow) | |
if: github.event_name == 'pull_request_target' && contains(github.event.label.name, 'trigger-action') | |
shell: sh | |
run: | | |
cd apk-repo/test/apim-apk-agent-test/agent-helm-chart | |
helm dependency build | |
helm install apim-apk-agent -n apk . --debug --wait --timeout 2m0s \ | |
--set controlPlane.serviceURL=https://apim-wso2am-cp-1-service.apk.svc.cluster.local:9443/ \ | |
--set controlPlane.eventListeningEndpoints="amqp:https://admin:[email protected]:5672?retries='10'&connectdelay='30'" \ | |
--set dataPlane.k8ResourceEndpoint=https://apk-wso2-apk-config-ds-service.apk.svc.cluster.local:9443/api/configurator/apis/generate-k8s-resources | |
--set agent.mode=DPtoCP | |
kubectl get pods -n apk | |
kubectl get svc -n apk | |
- name: Run test cases(DP to CP Flow) | |
shell: sh | |
run: | | |
cd apk-repo/test/cucumber-tests | |
sh ./scripts/agent-setup-hosts.sh | |
./gradlew runDpToCpTests | |
- name: Helm release undeploy | |
if: always() | |
shell: sh | |
run: | | |
cd apk-repo/helm-charts | |
kubectl describe pods -n apk | |
kubectl get pods -n apk | |
kubectl get svc -n apk | |
kubectl get apis -n apk | |
kubectl get applications -n apk | |
kubectl get subscriptions -n apk | |
kubectl get tokenissuers -n apk | |
kubectl get httproutes -n apk | |
kubectl get ing -n apk | |
kubectl get pods -l app.kubernetes.io/name=apim-apk-agent | awk '{print $1}' | xargs -I{} kubectl logs {} -n apk | |
helm uninstall apk -n apk | |
helm uninstall apim -n apk | |
helm uninstall apim-apk-agent -n apk | |
- name: Delete AKS cluster | |
if: always() | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: 2.44.1 | |
inlineScript: | | |
az aks delete --resource-group ${{ secrets.AZURE_RESOURCE_GROUP }} --name agent-integ-${{ secrets.AKS_CLUSTER_NAME }}-${{ github.event.number || github.run_id }} --yes | |
- name: Logout from azure | |
if: always() | |
uses: azure/CLI@v1 | |
with: | |
azcliversion: 2.44.1 | |
inlineScript: | | |
az logout | |
- name: Publish Test Report(DP to CP Flow) | |
if: always() | |
uses: malinthaprasan/action-surefire-report@v1 | |
with: | |
report_paths: 'apk-repo/test/cucumber-tests/build/test-output/junitreports/*.xml' | |
fail_on_test_failures: true |