Skip to content

Commit

Permalink
Merge branch 'main' into subscription-deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
ruokun-niu authored Jan 15, 2025
2 parents a58d425 + f7e5390 commit b1f20db
Show file tree
Hide file tree
Showing 98 changed files with 16,777 additions and 8,423 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/vsce.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2024 The Drasi 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: Download and Publish Visual Studio Code Extension

on:
workflow_dispatch:
inputs:
version:
description: 'Version of the extension'
required: true


jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install VSCE
run: npm install @vscode/vsce --save-dev
- name: Download VSIX from GitHub Release
run: |
curl -L -o drasi.vsix https://github.com/drasi-project/drasi-platform/releases/download/${{ github.event.inputs.version }}/drasi-${{ github.event.inputs.version }}.vsix
- name: Publish
run: |
npx vsce publish -p ${{ secrets.VSCE_TOKEN }} --packagePath drasi.vsix
7 changes: 6 additions & 1 deletion cli/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ Usage examples:
output := output.NewTaskOutput()
defer output.Close()

if err := installer.Install(local, registry, version, output, namespace); err != nil {
daprRegistry, err := cmd.Flags().GetString("dapr-registry")
if err != nil {
return err
}
if err := installer.Install(local, registry, version, output, namespace, daprRegistry); err != nil {
return err
}

Expand All @@ -106,5 +110,6 @@ Usage examples:
initCommand.Flags().StringP("namespace", "n", "drasi-system", "Kubernetes namespace to install Drasi into.")
initCommand.Flags().String("dapr-runtime-version", "1.10.0", "Dapr runtime version to install.")
initCommand.Flags().String("dapr-sidecar-version", "1.9.0", "Dapr sidecar (daprd) version to install.")
initCommand.Flags().String("dapr-registry", "docker.io/daprio", "Container registry to pull Dapr images from.")
return initCommand
}
9 changes: 6 additions & 3 deletions cli/service/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,14 @@ func MakeInstaller(namespace string) (*Installer, error) {
return &result, nil
}

func (t *Installer) Install(localMode bool, acr string, version string, output output.TaskOutput, namespace string) error {
func (t *Installer) Install(localMode bool, acr string, version string, output output.TaskOutput, namespace string, daprRegistry string) error {
daprInstalled, err := t.checkDaprInstallation(output)
if err != nil {
return err
}

if !daprInstalled {
if err = t.installDapr(output); err != nil {
if err = t.installDapr(output, daprRegistry); err != nil {
return err
}
}
Expand Down Expand Up @@ -541,7 +542,7 @@ func (t *Installer) waitForDeployment(selector string, output output.TaskOutput)
return nil
}

func (t *Installer) installDapr(output output.TaskOutput) error {
func (t *Installer) installDapr(output output.TaskOutput, daprRegistry string) error {
output.AddTask("Dapr-Install", "Installing Dapr...")

ns := "dapr-system"
Expand Down Expand Up @@ -602,6 +603,8 @@ func (t *Installer) installDapr(output output.TaskOutput) error {
installClient.CreateNamespace = true
installClient.Timeout = time.Duration(120) * time.Second

helmChart.Values["global"].(map[string]interface{})["registry"] = daprRegistry

helmChart.Values["dapr_operator"] = make(map[string]interface{})
if daprOperator, ok := helmChart.Values["dapr_operator"].(map[string]interface{}); ok {
daprOperator["watchInterval"] = "10s"
Expand Down
55 changes: 28 additions & 27 deletions cli/service/resources/default-reaction-providers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ spec:
config_schema:
type: object
properties:
Brokers:
brokers:
type: array
topic:
type: string
Topic:
saslUsername:
type: string
saslPassword:
type: string
IncludeKey:
type: boolean
default: true
IncludeSchemas:
type: boolean
default: true
required:
- Brokers
- Topic
- brokers
- topic
---
apiVersion: v1
kind: ReactionProvider
Expand All @@ -64,13 +62,12 @@ spec:
config_schema:
type: object
properties:
EventGridUri:
eventGridUri:
type: string
EventGridKey:
eventGridKey:
type: string
required:
- EventGridUri
- EventGridKey
- eventGridUri
---
apiVersion: v1
kind: ReactionProvider
Expand All @@ -79,26 +76,23 @@ spec:
config_schema:
type: object
properties:
AddedResultCommand:
type: string
UpdatedResultCommand:
addedResultCommand:
type: string
DatabaseHost:
updatedResultCommand:
type: string
DatabasePrimaryKey:
deletedResultCommand:
type: string
DatabaseName:
gremlinHost:
type: string
DatabaseContainerName:
gremlinPort:
type: number
gremlinPassword:
type: string
DatabasePort:
gremlinUsername:
type: string
required:
- DatabaseHost
- DatabasePrimaryKey
- DatabaseName
- DatabaseContainerName
- DatabasePort
- gremlinHost
- gremlinPort
services:
reaction:
image: reaction-gremlin
Expand All @@ -110,6 +104,8 @@ spec:
services:
reaction:
image: reaction-result
dapr:
app-port: "8080"
endpoints:
gateway:
setting: internal
Expand All @@ -120,6 +116,11 @@ spec:
result-portConfigKey:
type: number
default: 8080
config_schema:
type: object
properties:
QueryContainerId:
type: string
---
apiVersion: v1
kind: ReactionProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ drasi apply -f https://raw.githubusercontent.com/drasi-project/drasi-platform/ma
drasi wait reaction quick-result-reaction -t 120

# Run the kubectl command and capture the output
$initial_output = & kubectl run curl-pod --image=curlimages/curl -n $namespace --restart=Never --rm --attach -q -- sh -c 'curl -s http://quick-result-reaction-gateway:8080/quick-query/all' 2>$null
$initial_output = & kubectl run curl-pod --image=curlimages/curl -n $namespace --restart=Never --rm --attach -q -- sh -c 'curl -X GET -s http://quick-result-reaction-gateway:8080/quick-query/data' 2>$null

# Extract the portion of the output that matches the pattern [.*]
if ($initial_output -match '\[.*\]') {
Expand Down Expand Up @@ -72,7 +72,7 @@ Write-Host "Retrieving the current result from the debug reaction"

Start-Sleep -Seconds 20

$final_output = & kubectl run curl-pod --image=curlimages/curl -n $namespace --restart=Never --rm --attach -q -- sh -c 'curl -s http://quick-result-reaction-gateway:8080/quick-query/all' 2>$null
$final_output = & kubectl run curl-pod --image=curlimages/curl -n $namespace --restart=Never --rm --attach -q -- sh -c 'curl -X GET -s http://quick-result-reaction-gateway:8080/quick-query/data' 2>$null

# Extract the portion of the output that matches the pattern [.*]
if ($final_output -match '\[.*\]') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ drasi apply -f https://raw.githubusercontent.com/drasi-project/drasi-platform/ma
drasi wait reaction quick-result-reaction -t 120

# Initial result
initial_output=$(kubectl run curl-pod --image=curlimages/curl -n $namespace --restart=Never --rm --attach -q -- sh -c 'curl -s http://quick-result-reaction-gateway:8080/quick-query/all' 2>/dev/null)
initial_output=$(kubectl run curl-pod --image=curlimages/curl -n $namespace --restart=Never --rm --attach -q -- sh -c 'curl -X GET -s http://quick-result-reaction-gateway:8080/quick-query/data' 2>/dev/null)
initial_parsed_output=$(echo $initial_output | grep -o '\[.*\]')
echo "Initial output:$initial_parsed_output"

Expand All @@ -56,7 +56,7 @@ kubectl exec $postgres_pod -n default -- psql -U postgres -d smokedb -c "INSERT
echo "Retrieving the current result from the debug reaction"
sleep 20

final_output=$(kubectl run curl-pod --image=curlimages/curl -n $namespace --restart=Never --rm --attach -q -- sh -c 'curl -s http://quick-result-reaction-gateway:8080/quick-query/all' 2>/dev/null)
final_output=$(kubectl run curl-pod --image=curlimages/curl -n $namespace --restart=Never --rm --attach -q -- sh -c 'curl -X GET -s http://quick-result-reaction-gateway:8080/quick-query/data' 2>/dev/null)
final_parsed_output=$(echo $final_output | grep -o '\[.*\]')
echo "Final output:$final_parsed_output"

Expand Down
Loading

0 comments on commit b1f20db

Please sign in to comment.