Add Prometheus support for APK #12
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" --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: | | |
cd apk-repo/test/apim-apk-agent-test/apim-cp-helm-chart | |
helm repo add bitnami https://charts.bitnami.com/bitnami | |
helm repo add jetstack https://charts.jetstack.io | |
helm dependency build | |
helm install apim -n apk . --debug --wait --timeout 5m0s \ | |
--set deployment.image.respository=sampathrajapakse/wso2am \ | |
--set deployment.image.tag=4.3.0 | |
kubectl get pods -n apk | |
kubectl get svc -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 dependency build | |
helm install apk-test-setup -n apk . --debug --wait --timeout 15m0s | |
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:9443/ \ | |
--set controlPlane.eventListeningEndpoints=amqp://admin:admin@apim-wso2am-cp-1-service:5673?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 | |
shell: sh | |
run: | | |
cd apk-repo/test/apim-apk-agent-test/cucumber-tests | |
sh ./scripts/setup-hosts.sh | |
./gradlew runTests | |
- 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 | |
helm uninstall apk-test-setup -n apk | |
cd apk-repo/test/apim-apk-agent-test/apim-cp-helm-chart | |
helm uninstall apim -n apk | |
cd apk-repo/test/apim-apk-agent-test/agent-helm-chart | |
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 go-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 | |
if: always() | |
uses: malinthaprasan/action-surefire-report@v1 | |
with: | |
report_paths: 'apk-agent-repo/test/postman-tests/build/*.xml' | |
fail_on_test_failures: true |