mirror of https://github.com/dapr/quickstarts.git
Added validations for service invocation (#607)
* Added validations for service invocation Signed-off-by: Amulya Varote <amulyavarote@Amulyas-MacBook-Pro.local> * Fixed java readme file Signed-off-by: Amulya Varote <amulyavarote@Amulyas-MacBook-Pro.local> * Removing csharp validation Signed-off-by: Amulya Varote <amulyavarote@Amulyas-MacBook-Pro.local> Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> * Added license to yaml files Signed-off-by: Amulya Varote <amulyavarote@Amulyas-MacBook-Pro.local> Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> * Changes based on the previous PR merge Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> * test fix Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> * Changed validation Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> * tests fix trial Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> * test fixes for python Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> * Added seperate workflows to quickstarts Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> * Removed failed docker link Signed-off-by: Amulya Varote <amulyavarote@QTM-SWATHIKIL-1.redmond.corp.microsoft.com> Co-authored-by: Amulya Varote <amulyavarote@Amulyas-MacBook-Pro.local> Signed-off-by: Amulya Varote <amulyavarote@Amulyas-MacBook-Pro.local>
This commit is contained in:
parent
1fdb20ca26
commit
a84baa428e
|
@ -11,7 +11,7 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
name: Auto Validate New Quickstarts
|
||||
name: Auto Validate New Quickstarts - PubSub
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
|
@ -0,0 +1,156 @@
|
|||
#
|
||||
# Copyright 2021 The Dapr Authors
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
name: Auto Validate New Quickstarts - Service Invocation
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- feature/new_quickstarts
|
||||
- release-*
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- feature/new_quickstarts
|
||||
- release-*
|
||||
jobs:
|
||||
deploy:
|
||||
name: Validate quickstarts on ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install
|
||||
GOVER: 1.17
|
||||
KUBERNETES_VERSION: v1.21.1
|
||||
KIND_VERSION: v0.11.0
|
||||
KIND_IMAGE_SHA: sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-10.15]
|
||||
steps:
|
||||
- name: Install docker - MacOS
|
||||
if: matrix.os == 'macos-10.15'
|
||||
uses: docker-practice/actions-setup-docker@v1
|
||||
with:
|
||||
docker_buildx: false
|
||||
docker_version: 20.10
|
||||
- name: Configure KinD
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
# Generate a KinD configuration file that uses:
|
||||
# A couple of worker nodes: this is needed to run both
|
||||
# ZooKeeper + Kakfa
|
||||
working-directory: ./
|
||||
run: |
|
||||
cat > kind.yaml <<EOF
|
||||
apiVersion: kind.x-k8s.io/v1alpha4
|
||||
kind: Cluster
|
||||
nodes:
|
||||
- role: control-plane
|
||||
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
|
||||
- role: worker
|
||||
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
|
||||
- role: worker
|
||||
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
|
||||
- role: worker
|
||||
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
|
||||
- role: worker
|
||||
image: kindest/node:${{ env.KUBERNETES_VERSION }}@${{ env.KIND_IMAGE_SHA }}
|
||||
EOF
|
||||
|
||||
# Log the generated kind.yaml for easy reference.
|
||||
cat kind.yaml
|
||||
|
||||
- name: Create KinD Cluster - Linux
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
uses: helm/kind-action@v1.0.0
|
||||
with:
|
||||
config: kind.yaml
|
||||
cluster_name: kind
|
||||
version: ${{ env.KIND_VERSION }}
|
||||
- name: Install minikube - MacOS
|
||||
if: matrix.os == 'macos-10.15'
|
||||
run: |
|
||||
brew install kubernetes-cli || brew link --overwrite kubernetes-cli
|
||||
brew install minikube
|
||||
minikube start --driver=virtualbox --memory 4096 --host-only-cidr "192.168.59.1/24"
|
||||
- name: Get KinD info
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
kubectl cluster-info --context kind-kind
|
||||
NODE_IP=$(kubectl get nodes \
|
||||
-lkubernetes.io/hostname!=kind-control-plane \
|
||||
-ojsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}')
|
||||
echo "SERVICE_IP=$NODE_IP" >> $GITHUB_ENV
|
||||
- name: Set up Go ${{ env.GOVER }}
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: ${{ env.GOVER }}
|
||||
- name: Determine latest Dapr Runtime version including Pre-releases
|
||||
run: |
|
||||
helm repo add dapr https://dapr.github.io/helm-charts/ && helm repo update && export RUNTIME_VERSION=$(helm search repo dapr/dapr --devel --versions | awk '/dapr\/dapr/ {print $3; exit}' )
|
||||
echo "DAPR_RUNTIME_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
|
||||
echo "Found $RUNTIME_VERSION"
|
||||
shell: bash
|
||||
- name: Determine latest Dapr Cli version including Pre-releases
|
||||
run: |
|
||||
export CLI_VERSION=$(curl "https://api.github.com/repos/dapr/cli/releases?per_page=1&page=1" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq '.[0].tag_name'| tr -d '",v')
|
||||
echo "DAPR_CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
|
||||
echo "Found $CLI_VERSION"
|
||||
shell: bash
|
||||
- name: Set up Dapr CLI - Mac/Linux
|
||||
if: matrix.os != 'windows-latest'
|
||||
run: wget -q ${{ env.DAPR_INSTALL_URL }}/install.sh -O - | /bin/bash -s ${{ env.DAPR_CLI_VERSION }}
|
||||
- name: Set up Dapr CLI - Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
run: powershell -Command "\$$script=iwr -useb ${{ env.DAPR_INSTALL_URL }}/install.ps1; \$$block=[ScriptBlock]::Create(\$$script); invoke-command -ScriptBlock \$$block -ArgumentList ${{ env.DAPR_CLI_VERSION }}"
|
||||
- name: Install Dapr
|
||||
run: |
|
||||
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
||||
dapr init --runtime-version=${{ env.DAPR_RUNTIME_VERSION }}
|
||||
dapr --version
|
||||
- name: Install Dapr - Kubernetes
|
||||
run: |
|
||||
helm repo add bitnami https://charts.bitnami.com/bitnami
|
||||
helm repo update
|
||||
helm install redis bitnami/redis
|
||||
dapr init -k --runtime-version=${{ env.DAPR_RUNTIME_VERSION }} --wait || kubectl get pods --all-namespaces
|
||||
kubectl get nodes -o wide
|
||||
for pod in `dapr status -k | awk '/dapr/ {print $1}'`; do kubectl describe pod -l app=$pod -n dapr-system ; kubectl logs -l app=$pod -n dapr-system; done
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
- name: Install utilities dependencies
|
||||
run: |
|
||||
echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
|
||||
pip3 install setuptools wheel
|
||||
pip3 install mechanical-markdown
|
||||
- name: Validate Go http service invocation
|
||||
run: |
|
||||
pushd service_invocation/go/http
|
||||
make validate
|
||||
popd
|
||||
- name: Validate JS http service invocation
|
||||
run: |
|
||||
pushd service_invocation/javascript/http
|
||||
make validate
|
||||
popd
|
||||
- name: Validate Python http service invocation
|
||||
run: |
|
||||
pushd service_invocation/python/http
|
||||
make validate
|
||||
popd
|
||||
- name: Linkcheck README.md
|
||||
run: |
|
||||
make validate
|
|
@ -33,9 +33,7 @@ dotnet build
|
|||
<!-- STEP
|
||||
name: Run order-processor service
|
||||
expected_stdout_lines:
|
||||
- "You're up and running! Both Dapr and your app logs will appear here."
|
||||
- '== APP == Order received : Order { orderId = 10 }'
|
||||
- "Exited Dapr successfully"
|
||||
- "Exited App successfully"
|
||||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
|
@ -71,11 +69,9 @@ dotnet build
|
|||
<!-- STEP
|
||||
name: Run checkout service
|
||||
expected_stdout_lines:
|
||||
- "You're up and running! Both Dapr and your app logs will appear here."
|
||||
- '== APP == Order passed: Order { OrderId = 1 }'
|
||||
- '== APP == Order passed: Order { OrderId = 2 }'
|
||||
- "Exited App successfully"
|
||||
- "Exited Dapr successfully"
|
||||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
background: true
|
||||
|
|
|
@ -32,14 +32,12 @@ go build app.go
|
|||
<!-- STEP
|
||||
name: Run order-processor service
|
||||
expected_stdout_lines:
|
||||
- "You're up and running! Both Dapr and your app logs will appear here."
|
||||
- '== APP == Order received : {"orderId":10}'
|
||||
- "Exited Dapr successfully"
|
||||
- "Exited App successfully"
|
||||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
background: true
|
||||
sleep: 10
|
||||
sleep: 15
|
||||
-->
|
||||
|
||||
```bash
|
||||
|
@ -68,15 +66,13 @@ go build app.go
|
|||
<!-- STEP
|
||||
name: Run checkout service
|
||||
expected_stdout_lines:
|
||||
- "You're up and running! Both Dapr and your app logs will appear here."
|
||||
- '== APP == Order passed: "{\"orderId\":1}"'
|
||||
- '== APP == Order passed: "{\"orderId\":2}"'
|
||||
- "Exited App successfully"
|
||||
- "Exited Dapr successfully"
|
||||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
background: true
|
||||
sleep: 10
|
||||
sleep: 15
|
||||
-->
|
||||
|
||||
```bash
|
||||
|
@ -84,4 +80,9 @@ cd ./checkout
|
|||
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- go run app.go
|
||||
```
|
||||
|
||||
<!-- END_STEP -->
|
||||
<!-- END_STEP -->
|
||||
|
||||
```bash
|
||||
dapr stop --app-id checkout
|
||||
dapr stop --app-id order-processor
|
||||
```
|
|
@ -0,0 +1,5 @@
|
|||
DOCKER_IMAGE_PREFIX ?=go-http-
|
||||
APPS ?=checkout order-processor
|
||||
|
||||
include ../../../docker.mk
|
||||
include ../../../validate.mk
|
|
@ -50,7 +50,7 @@ expected_stdout_lines:
|
|||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
background: true
|
||||
sleep: 10
|
||||
sleep: 15
|
||||
-->
|
||||
|
||||
```bash
|
||||
|
@ -77,7 +77,7 @@ working_dir: ./order-processor
|
|||
```bash
|
||||
mvn clean install
|
||||
```
|
||||
|
||||
<!-- END_STEP -->
|
||||
3. Run the Java order-processor app with Dapr:
|
||||
|
||||
<!-- STEP
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
DOCKER_IMAGE_PREFIX ?=java-http-
|
||||
APPS ?=checkout order-processor
|
||||
|
||||
include ../../../docker.mk
|
||||
include ../../../validate.mk
|
|
@ -32,14 +32,12 @@ npm install
|
|||
<!-- STEP
|
||||
name: Run order-processor service
|
||||
expected_stdout_lines:
|
||||
- "You're up and running! Both Dapr and your app logs will appear here."
|
||||
- '== APP == Order received: { orderId: 10 }'
|
||||
- "Exited Dapr successfully"
|
||||
- "Exited App successfully"
|
||||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
background: true
|
||||
sleep: 10
|
||||
sleep: 15
|
||||
-->
|
||||
|
||||
```bash
|
||||
|
@ -69,15 +67,13 @@ npm install
|
|||
<!-- STEP
|
||||
name: Run checkout service
|
||||
expected_stdout_lines:
|
||||
- "You're up and running! Both Dapr and your app logs will appear here."
|
||||
- '== APP == Order passed: {"orderId":1}'
|
||||
- '== APP == Order passed: {"orderId":2}'
|
||||
- "Exited App successfully"
|
||||
- "Exited Dapr successfully"
|
||||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
background: true
|
||||
sleep: 10
|
||||
sleep: 15
|
||||
-->
|
||||
|
||||
```bash
|
||||
|
@ -85,4 +81,9 @@ cd ./checkout
|
|||
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- npm start
|
||||
```
|
||||
|
||||
<!-- END_STEP -->
|
||||
<!-- END_STEP -->
|
||||
|
||||
```bash
|
||||
dapr stop --app-id checkout
|
||||
dapr stop --app-id order-processor
|
||||
```
|
|
@ -0,0 +1,5 @@
|
|||
DOCKER_IMAGE_PREFIX ?=javascript-http-
|
||||
APPS ?=checkout order-processor
|
||||
|
||||
include ../../../docker.mk
|
||||
include ../../../validate.mk
|
|
@ -32,19 +32,17 @@ pip3 install -r requirements.txt
|
|||
<!-- STEP
|
||||
name: Run order-processor service
|
||||
expected_stdout_lines:
|
||||
- "You're up and running! Both Dapr and your app logs will appear here."
|
||||
- '== APP == Order received : {"orderId": 10}'
|
||||
- "Exited Dapr successfully"
|
||||
- "Exited App successfully"
|
||||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
background: true
|
||||
sleep: 10
|
||||
sleep: 15
|
||||
-->
|
||||
|
||||
```bash
|
||||
cd ./order-processor
|
||||
dapr run --app-port 5001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 app.py
|
||||
dapr run --app-port 7001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 app.py
|
||||
```
|
||||
|
||||
<!-- END_STEP -->
|
||||
|
@ -69,15 +67,13 @@ pip3 install -r requirements.txt
|
|||
<!-- STEP
|
||||
name: Run checkout service
|
||||
expected_stdout_lines:
|
||||
- "You're up and running! Both Dapr and your app logs will appear here."
|
||||
- '== APP == Order passed: {"orderId": 1}'
|
||||
- '== APP == Order passed: {"orderId": 2}'
|
||||
- "Exited App successfully"
|
||||
- "Exited Dapr successfully"
|
||||
expected_stderr_lines:
|
||||
output_match_mode: substring
|
||||
background: true
|
||||
sleep: 10
|
||||
sleep: 15
|
||||
-->
|
||||
|
||||
```bash
|
||||
|
@ -85,4 +81,9 @@ cd ./checkout
|
|||
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- python3 app.py
|
||||
```
|
||||
|
||||
<!-- END_STEP -->
|
||||
<!-- END_STEP -->
|
||||
|
||||
```bash
|
||||
dapr stop --app-id checkout
|
||||
dapr stop --app-id order-processor
|
||||
```
|
|
@ -0,0 +1,5 @@
|
|||
DOCKER_IMAGE_PREFIX ?=python-http-
|
||||
APPS ?=checkout order-processor
|
||||
|
||||
include ../../../docker.mk
|
||||
include ../../../validate.mk
|
|
@ -12,4 +12,4 @@ def getOrder():
|
|||
'ContentType': 'application/json'}
|
||||
|
||||
|
||||
app.run(port=5001)
|
||||
app.run(port=7001)
|
||||
|
|
|
@ -22,13 +22,12 @@ Clone the quickstarts repository
|
|||
> **Note**: See https://github.com/dapr/quickstarts#supported-dapr-runtime-version for supported tags. Use `git clone https://github.com/dapr/quickstarts.git` when using the edge version of dapr runtime.
|
||||
|
||||
### - Run locally
|
||||
1. Install [Docker](https://www.docker.com/products/docker-desktop)
|
||||
2. Install [.Net Core SDK 3.1](https://dotnet.microsoft.com/download)
|
||||
3. Install [Dapr CLI](https://github.com/dapr/cli)
|
||||
4. Install [Go](https://golang.org/doc/install)
|
||||
5. Install [Python3](https://www.python.org/downloads/)
|
||||
6. Install [Npm](https://www.npmjs.com/get-npm)
|
||||
7. Install [Node](https://nodejs.org/en/download/)
|
||||
1. Install [.Net Core SDK 3.1](https://dotnet.microsoft.com/download)
|
||||
2. Install [Dapr CLI](https://github.com/dapr/cli)
|
||||
3. Install [Go](https://golang.org/doc/install)
|
||||
4. Install [Python3](https://www.python.org/downloads/)
|
||||
5. Install [Npm](https://www.npmjs.com/get-npm)
|
||||
6. Install [Node](https://nodejs.org/en/download/)
|
||||
|
||||
### - Run in Kubernetes environment
|
||||
1. Dapr-enabled Kubernetes cluster. Follow [these instructions](https://docs.dapr.io/operations/hosting/kubernetes/kubernetes-deploy/) to set this up.
|
||||
|
|
Loading…
Reference in New Issue