Skip to content

Commit

Permalink
added default pipline variable, refactored example workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
adranwit committed Mar 27, 2018
1 parent b65379e commit 130ae91
Show file tree
Hide file tree
Showing 85 changed files with 635 additions and 844 deletions.
2 changes: 1 addition & 1 deletion cli/helper.go
Expand Up @@ -12,7 +12,7 @@ func GetPath(candidates *model.Activities, runner *Runner, fullPath bool) (strin

var activities = make([]*model.Activity, 0)
for i := 0; i < candidates.Len(); i++ {
if i > 0 && candidates.Get(i).Service == candidates.Get(i - 1).Service {
if i > 0 && candidates.Get(i).Service == candidates.Get(i-1).Service {
continue
}
activities = append(activities, candidates.Get(i))
Expand Down
6 changes: 3 additions & 3 deletions cli/runner.go
Expand Up @@ -20,7 +20,7 @@ var OnError = func(code int) {
}

const (
messageTypeAction = iota + 10
messageTypeAction = iota + 10
messageTypeTagDescription
)

Expand Down Expand Up @@ -534,7 +534,7 @@ func (r *Runner) reportTagSummary() {
for _, tag := range r.tags {
if (tag.FailedCount) > 0 {
var eventTag = tag.TagID
r.printMessage(r.ColorText(eventTag, "red"), len(eventTag), messageTypeTagDescription, tag.Description, msg.MessageStyleError, fmt.Sprintf("failed %v/%v", tag.FailedCount, (tag.FailedCount + tag.PassedCount)))
r.printMessage(r.ColorText(eventTag, "red"), len(eventTag), messageTypeTagDescription, tag.Description, msg.MessageStyleError, fmt.Sprintf("failed %v/%v", tag.FailedCount, (tag.FailedCount+tag.PassedCount)))
var minRange = 0
for i, event := range tag.Events {
validation := r.getValidation(event)
Expand All @@ -544,7 +544,7 @@ func (r *Runner) reportTagSummary() {
if validation.HasFailure() {
var beforeValidationEvents = []msg.Event{}
if i-minRange > 0 {
beforeValidationEvents = tag.Events[minRange: i-1]
beforeValidationEvents = tag.Events[minRange : i-1]
}
r.reportFailureWithMatchSource(tag, validation, beforeValidationEvents)
minRange = i + 1
Expand Down
4 changes: 2 additions & 2 deletions context.go
Expand Up @@ -34,8 +34,8 @@ type Context struct {
Source *url.Resource
state data.Map
toolbox.Context
cloned []*Context
closed int32
cloned []*Context
closed int32
}

//Publish publishes event to listeners, it updates current run details like activity workflow name etc ...
Expand Down
4 changes: 0 additions & 4 deletions context_test.go
Expand Up @@ -23,10 +23,6 @@ func TestNewDefaultState(t *testing.T) {

}





func TestContext_Expand_Resource(t *testing.T) {
manager := endly.New()
context := manager.NewContext(toolbox.NewContext())
Expand Down
5 changes: 0 additions & 5 deletions deployment/vc/git.go
Expand Up @@ -87,8 +87,6 @@ func (s *git) checkInfo(context *endly.Context, request *StatusRequest) (*Status
return result, nil
}



runRequest := exec.NewExtractRequest(request.Source, exec.DefaultOptions(),
exec.NewExtractCommand(fmt.Sprintf("git status"), "", nil, nil,
model.NewExtract("branch", "On branch[\\s\\t]+([^\\s]+)", true)),
Expand Down Expand Up @@ -144,7 +142,6 @@ func (s *git) checkout(context *endly.Context, request *CheckoutRequest) (*Info,
return nil, err
}


dest, err := context.ExpandResource(request.Dest)
if err != nil {
return nil, err
Expand All @@ -162,8 +159,6 @@ func (s *git) checkout(context *endly.Context, request *CheckoutRequest) (*Info,
var useParentDirectory = true
var _, originProjectName = path.Split(origin.DirectoryPath())



if originProjectName == projectName {
projectName = "."
if dest.DirectoryPath() != "/" {
Expand Down
3 changes: 0 additions & 3 deletions deployment/vc/service.go
Expand Up @@ -93,8 +93,6 @@ func (s *service) checkout(context *endly.Context, request *CheckoutRequest) (*C
return nil, err
}



var modules = request.Modules
var directory = target.DirectoryPath()
if len(modules) == 0 {
Expand Down Expand Up @@ -145,7 +143,6 @@ func (s *service) checkoutArtifact(context *endly.Context, versionControlType st
return nil, err
}


if exists {
var response *StatusResponse
response, err = s.checkInfo(context, &StatusRequest{Source: dest, Type: versionControlType})
Expand Down
2 changes: 1 addition & 1 deletion example/etl/transformer/README.md
Expand Up @@ -36,7 +36,7 @@ Run the following command:

```text
git clone https://github.com/viant/endly
cd endly/example/ws/reporter/endly/
cd endly/example/etl/transformer/endly/
## run test with [manager](endly/manager.csv) workflow:
Expand Down
4 changes: 2 additions & 2 deletions example/etl/transformer/endly/app.yaml
@@ -1,5 +1,5 @@
tasks: $tasks
params:
defaults:
app: $app
sdk: $sdk
target: $target
Expand Down Expand Up @@ -34,7 +34,7 @@ pipeline:
- echo 'deployed'

stop:
action: process:stop
action: process:stop-all
input: ${app}

start:
Expand Down
12 changes: 6 additions & 6 deletions example/etl/transformer/endly/manager.csv
Expand Up @@ -2,16 +2,16 @@ Workflow,,Name,Description,Tasks,Init,Sleep
,,manager,run system test,%Tasks,@var/init,
[]Tasks,,Name,Description,Actions,,
,,init,Initialise test,%Init,,
[]Init,Service,Action,Description,Request,tasks,
,workflow,run,initialise system services,@system,*,
[]Init,Service,Action,Description,Request,,
,workflow,run,initialise system services,@system,,
,workflow,run,initialise data,@datastore,,
,workflow,run,deploy app,@app,*,
,workflow,run,deploy app,@app,,
[]Tasks,,Name,Description,Actions,,
,,test,Run test,%Test,,
[]Test,Service,Action,Description,Request,run.workflow,run.tasks
,workflow,run,run test plan,@req/run|$run,regresion,*
[]Test,Service,Action,Description,Request,workflow,tasks
,workflow,run,run test plan, @req/run,regresion,*
[]Tasks,,Name,Description,Actions,,
,,destroy,destroy system,%Destroy,,
[]Destroy,Service,Action,Description,Request,tasks,
,workflow,run,stop app,@app,stop,
,workflow,run,stop system services, @system,destory,
,workflow,run,stop system services,@system,destory,
Expand Up @@ -2,7 +2,7 @@
"Datastore": "db3",
"Config": {
"DriverName": "mysql",
"Descriptor": "[username]:[password]@tcp(127.0.0.1:3306)/[dbname]?parseTime=true",
"Descriptor": "[username]:[password]@tcp(${serviceHost}:3306)/[dbname]?parseTime=true",
"Credentials": "$mysqlCredential"
}
}
Expand Up @@ -6,7 +6,7 @@
"Parameters": {
"dbname": "db4",
"namespace": "db4",
"host": "$targetHost",
"host": "$serviceHost",
"port": "3000",
"dateFormat": "yyyy-MM-dd hh:mm:ss",
"keyColumnName": "id"
Expand Down
23 changes: 0 additions & 23 deletions example/etl/transformer/endly/req/run.json

This file was deleted.

7 changes: 7 additions & 0 deletions example/etl/transformer/endly/req/run.yaml
@@ -0,0 +1,7 @@
name: $workflow
tasks: $tasks
params:
app: $app
mysqlCredential: $mysqlCredential
targetHost: $targetHost
serviceHost: $serviceHost
2 changes: 1 addition & 1 deletion example/etl/transformer/endly/run.yaml
@@ -1,5 +1,5 @@
init: "@var/init"
params:
defaults:
app: $app
sdk: $sdk
target: $target
Expand Down
2 changes: 1 addition & 1 deletion example/etl/transformer/endly/system.yaml
@@ -1,5 +1,5 @@
tasks: $tasks
params:
defaults:
target: $serviceTarget
pipeline:
destory:
Expand Down
2 changes: 0 additions & 2 deletions example/etl/transformer/endly/var/init.json
Expand Up @@ -59,12 +59,10 @@
"URL": "$Pwd(./../)"
}
},

{
"Name": "serviceHost",
"Value": "$Hostname($serviceTarget.URL)"
},

{
"Name": "targetHost",
"Value": "$Hostname($target.URL)"
Expand Down
62 changes: 23 additions & 39 deletions example/rt/elogger/README.md
Expand Up @@ -8,59 +8,43 @@ Prerequisites:

Enable ssh logic you your use on your machine (on osx System Preference / Sharing / Remote Login )

Install [docker](https://docs.docker.com/engine/installation/) service
Download [endly](https://github.com/viant/endly/releases/)

[Download endly and secret for your platofrm](https://github.com/viant/endly/releases/)
Provide a username and password to login to your box.
```text
endly -c=localhost
```
```
Verify that secret file were created
```text
cat ~/.secret/localhost.json
```

Or alternatively build binary from scratch following above instruction:

Install [go lang](https://golang.org/doc/install) version 1.8+

after installing go run the following command
#### Run E-logger app workflow

```text
mkdir -p ~/Projects/go
export GOPATH=~/Projects/go
go get -u github.com/viant/endly
go get -u github.com/viant/endly/endly
go get -u github.com/viant/toolbox/secret
Run the following command:

export PATH=$PATH:$GOPATH/bin
```
```text
git clone https://github.com/viant/endly
cd endly/example/rt/elogger/endly/
Generate credentials file used by the workflow.
```text
endly -c=CREDENTIAL_FILENAME
```
Command endly -c generates a file that store blowfish encrypted password in $HOME/.secret/ directory.
## run test with [manager](endly/manager.csv) workflow:
endly -w=manager
Provide a user name and password to login to your box.
```text
mkdir $HOME/.secret
ssh-keygen -b 1024 -t rsa -f id_rsa -P "" -f $HOME/.secret/id_rsa
cat $HOME/.secret/id_rsa.pub > ~/.ssh/authorized_keys
chmod u+w authorized_keys
## run test with inline pipeline tasks [run](endly/run.yaml) request
endly -r=run
endly -c=localhost -k=~/.secret/id_rsa.pub
```
```
Verify that secret file were created
```text
cat ~/.secret/localhost.json
## To check manager workflow tasks list
endly -w=manager -t='?'
```


Check that **'endly'** binary is created in $GOPATH/bin directory as result of
'go get -u github.com/viant/endly/endly'


#### Run elogger workflow

Run the following command:

```text
cd $GOPATH/src/github.com/viant/endly/example/ws/rt/elogger/endly/
endly
```
Binary file removed example/rt/elogger/app/elogger
Binary file not shown.
4 changes: 2 additions & 2 deletions example/rt/elogger/endly/app.yaml
@@ -1,5 +1,5 @@
tasks: $tasks
params:
defaults:
app: $app
sdk: $sdk
target: $target
Expand Down Expand Up @@ -34,7 +34,7 @@ pipeline:
- echo 'deployed'

stop:
action: process:stop
action: process:stop-all
input: ${app}

start:
Expand Down
4 changes: 2 additions & 2 deletions example/rt/elogger/endly/manager.csv
Expand Up @@ -6,8 +6,8 @@ Workflow,,Name,Description,Tasks,Init,
,workflow,run,"Build, deploy app", @app,,
[]Tasks,,Name,Description,Actions,,
,,test,Run test,%Test,,
[]Test,Service,Action,Description,Request,run.workflow,run.tasks
,workflow,run,Run test plan,@req/run|$run,regresion,*
[]Test,Service,Action,Description,Request,workflow,tasks
,workflow,run,Run test plan, @req/run,regresion,*
[]Tasks,,Name,Description,Actions,,
,,destroy,Destroy system,%Destroy,,
[]Destroy,Service,Action,Description,Request,tasks,
Expand Down
19 changes: 0 additions & 19 deletions example/rt/elogger/endly/req/run.json

This file was deleted.

6 changes: 6 additions & 0 deletions example/rt/elogger/endly/req/run.yaml
@@ -0,0 +1,6 @@
name: $workflow
tasks: $tasks
params:
app: $app
targetHost: $targetHost
eLoggerHost: $eLoggerHost
2 changes: 1 addition & 1 deletion example/rt/elogger/endly/run.yaml
@@ -1,5 +1,5 @@
init: "@var/init"
params:
defaults:
app: $app
sdk: $sdk
target: $target
Expand Down

0 comments on commit 130ae91

Please sign in to comment.