Skip to content

Commit

Permalink
Merge pull request #675 from ystia/bugfix/GH-674_remove_forcePurge_ta…
Browse files Browse the repository at this point in the history
…sks_autogen

Remove force purge tasks autogeneration
  • Loading branch information
loicalbertin committed Aug 24, 2020
2 parents 77cfc4d + 9a1bd88 commit ab05423
Show file tree
Hide file tree
Showing 28 changed files with 270 additions and 531 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

### BUG FIXES

* Yorc generates forcePurge tasks on list deployments API endpoint ([GH-674](https://github.com/ystia/yorc/issues/674))
* Yorc is getting slow when there is a lot of tasks ([GH-671](https://github.com/ystia/yorc/issues/671))
* Yorc does not build on Go1.15 ([GH-665](https://github.com/ystia/yorc/issues/665))
* Concurrency issue in workflows execution may lead to a task never reaching a terminal status ([GH-659](https://github.com/ystia/yorc/issues/659))
Expand Down
24 changes: 19 additions & 5 deletions deployments/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ import (
"strings"
"time"

"github.com/ystia/yorc/v4/storage"
"github.com/ystia/yorc/v4/storage/types"

"github.com/ystia/yorc/v4/helper/collections"

"github.com/hashicorp/consul/api"
"github.com/pkg/errors"

"github.com/ystia/yorc/v4/events"
"github.com/ystia/yorc/v4/helper/collections"
"github.com/ystia/yorc/v4/helper/consulutil"
"github.com/ystia/yorc/v4/log"
"github.com/ystia/yorc/v4/storage"
"github.com/ystia/yorc/v4/storage/types"
)

const purgedDeploymentsLock = consulutil.PurgedDeploymentKVPrefix + ".lock"
Expand Down Expand Up @@ -292,3 +290,19 @@ func GetDeploymentTaskList(ctx context.Context, deploymentID string) ([]string,
}
return keys, err
}

// GetDeploymentsIDs returns the list of deployments IDs
func GetDeploymentsIDs(ctx context.Context) ([]string, error) {

depPaths, err := consulutil.GetKeys(consulutil.DeploymentKVPrefix)
if err != nil {
return nil, errors.Wrap(err, consulutil.ConsulGenericErrMsg)
}

deps := make([]string, 0)
for _, depPath := range depPaths {
deploymentID := path.Base(depPath)
deps = append(deps, deploymentID)
}
return deps, nil
}
35 changes: 19 additions & 16 deletions deployments/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,26 @@ import (
"strconv"
)

//go:generate go-enum --noprefix -f=structs.go
//go:generate go-enum --noprefix --nocamel -f=structs.go

// DeploymentStatus x ENUM(
// INITIAL,
// DEPLOYMENT_IN_PROGRESS,
// DEPLOYED,
// UNDEPLOYMENT_IN_PROGRESS,
// PURGE_IN_PROGRESS,
// UNDEPLOYED,
// DEPLOYMENT_FAILED,
// UNDEPLOYMENT_FAILED,
// SCALING_IN_PROGRESS,
// UPDATE_IN_PROGRESS,
// UPDATED,
// UPDATE_FAILURE,
// PURGED
// )
// DeploymentStatus is an enumerated type for deployments statuses
/*
ENUM(
INITIAL
DEPLOYMENT_IN_PROGRESS
DEPLOYED
UNDEPLOYMENT_IN_PROGRESS
PURGE_IN_PROGRESS
UNDEPLOYED
DEPLOYMENT_FAILED
UNDEPLOYMENT_FAILED
SCALING_IN_PROGRESS
UPDATE_IN_PROGRESS
UPDATED
UPDATE_FAILURE
PURGED
)
*/
type DeploymentStatus int

// A TOSCAValue is the result of a resolved property or attribute
Expand Down
9 changes: 5 additions & 4 deletions deployments/structs_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 11 additions & 8 deletions events/log_entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/ystia/yorc/v4/storage"
"github.com/ystia/yorc/v4/storage/types"
"path"
"time"

"github.com/ystia/yorc/v4/helper/consulutil"
"github.com/ystia/yorc/v4/log"
"github.com/ystia/yorc/v4/storage"
"github.com/ystia/yorc/v4/storage/types"
)

// LogEntry is the log entry representation
Expand Down Expand Up @@ -105,12 +105,15 @@ func (ft FieldType) String() string {
// We approximate all data except the content value to be equal to 1Kb
const contentMaxAllowedValueSize int = 511 * 1000

// LogLevel x ENUM(
// INFO,
// DEBUG,
// WARN,
// ERROR
// )
// LogLevel is an enumerated type for log levels
/*
ENUM(
INFO
DEBUG
WARN
ERROR
)
*/
type LogLevel int

// SimpleLogEntry allows to return a LogEntry instance with log level and deploymentID
Expand Down
9 changes: 5 additions & 4 deletions events/log_entries_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 13 additions & 10 deletions events/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ import (

//go:generate go-enum -f=structs.go --lower

// StatusChangeType x ENUM(
// Instance,
// Deployment,
// CustomCommand,
// Scaling,
// Workflow,
// WorkflowStep
// AlienTask,
// AttributeValue
// )
// StatusChangeType is an enumerated type for statuses changes
/*
ENUM(
Instance
Deployment
CustomCommand
Scaling
Workflow
WorkflowStep
AlienTask
AttributeValue
)
*/
type StatusChangeType int

// Info allows to provide custom/specific additional information for event
Expand Down
9 changes: 5 additions & 4 deletions events/structs_enum.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 2 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,21 @@ module github.com/ystia/yorc/v4

require (
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
github.com/Bowery/prompt v0.0.0-20190419144237-972d0ceb96f5 // indirect
github.com/Masterminds/goutils v1.1.0 // indirect
github.com/Masterminds/semver v1.4.2 // indirect
github.com/Masterminds/sprig v2.20.0+incompatible // indirect
github.com/Microsoft/go-winio v0.4.14 // indirect
github.com/Netflix/go-expect v0.0.0-20190729225929-0e00d9168667
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/PuerkitoBio/goquery v1.5.1 // indirect
github.com/SAP/go-hdb v0.14.1 // indirect
github.com/SermoDigital/jose v0.9.1 // indirect
github.com/Sirupsen/logrus v0.1.0 // indirect
github.com/abice/go-enum v0.1.4
github.com/abice/go-enum v0.2.3
github.com/alecthomas/participle v0.3.0
github.com/alien4cloud/alien4cloud-go-client/v2 v2.2.0-M5 // indirect
github.com/armon/go-metrics v0.3.0
github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 // indirect
github.com/blang/semver v3.5.1+incompatible
github.com/bradleyjkemp/cupaloy v2.3.0+incompatible // indirect
github.com/cenkalti/backoff v2.2.1+incompatible // indirect
github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 // indirect
github.com/cheggaaa/pb/v3 v3.0.3
github.com/chromedp/cdproto v0.0.0-20200209033844-7e00b02ea7d2 // indirect
github.com/chromedp/chromedp v0.5.3 // indirect
github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c // indirect
github.com/denisenkom/go-mssqldb v0.0.0-20200206145737-bbfc9a55622e // indirect
github.com/dgraph-io/ristretto v0.0.1
Expand Down Expand Up @@ -62,27 +54,20 @@ require (
github.com/hashicorp/serf v0.8.3 // indirect
github.com/hashicorp/vault v0.9.0
github.com/hinshun/vt10x v0.0.0-20180809195222-d55458df857c
github.com/huandu/xstrings v1.2.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/jefferai/jsonx v1.0.1 // indirect
github.com/julienschmidt/httprouter v1.2.0
github.com/justinas/alice v0.0.0-20160512134231-052b8b6c18ed
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/labstack/gommon v0.2.9 // indirect
github.com/lib/pq v1.3.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/matryer/resync v0.0.0-20161211202428-d39c09a11215
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/mgutz/logxi v0.0.0-20161027140823-aebf8a7d67ab // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0
github.com/mitchellh/mapstructure v1.1.2
github.com/mitchellh/reflectwalk v1.0.1 // indirect
github.com/mkideal/cli v0.0.3 // indirect
github.com/mkideal/pkg v0.0.0-20170503154153-3e188c9e7ecc // indirect
github.com/moby/moby v0.0.0-20170504205632-89658bed64c2
github.com/opencontainers/image-spec v1.0.1 // indirect
github.com/opencontainers/runc v0.1.1 // indirect
Expand Down Expand Up @@ -114,7 +99,7 @@ require (
gopkg.in/cookieo9/resources-go.v2 v2.0.0-20150225115733-d27c04069d0d
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
gopkg.in/ory-am/dockertest.v3 v3.3.5 // indirect
gopkg.in/yaml.v2 v2.2.4
gopkg.in/yaml.v2 v2.2.7
gotest.tools v2.2.0+incompatible // indirect
gotest.tools/v3 v3.0.0
k8s.io/api v0.0.0-20180628040859-072894a440bd
Expand Down

0 comments on commit ab05423

Please sign in to comment.