Skip to content

Commit

Permalink
Merge pull request konveyor#2 from mansam/targets
Browse files Browse the repository at this point in the history
Seed Targets independently from RuleSets
  • Loading branch information
mansam authored Jul 31, 2023
2 parents e90aa66 + cb6deec commit 953199a
Show file tree
Hide file tree
Showing 29 changed files with 144 additions and 120 deletions.
23 changes: 20 additions & 3 deletions cmd/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ func main() {
rulesetUUIDs := make(map[string]string)

// apply missing UUIDs
for i := range seeds {
seed := &seeds[i]
for idx := range seeds {
seed := &seeds[idx]
switch strings.ToLower(seed.Kind) {
case pkg.KindJobFunction:
for i := range seed.Items {
Expand All @@ -48,7 +48,8 @@ func main() {
}
}
case pkg.KindTagCategory:
for _, item := range seed.Items {
for i := range seed.Items {
item := &seed.Items[i]
tc := pkg.TagCategory{}
err = item.Decode(&tc)
if err != nil {
Expand Down Expand Up @@ -92,6 +93,22 @@ func main() {
panic(err)
}
}
case pkg.KindTarget:
for i := range seed.Items {
item := &seed.Items[i]
t := pkg.Target{}
err = item.Decode(&t)
if err != nil {
panic(err)
}
if t.UUID == "" {
t.UUID = uuid.NewString()
}
err = item.Encode(t)
if err != nil {
panic(err)
}
}
default:
}
seedsByFile[seed.Filename()] = append(seedsByFile[seed.Filename()], seed)
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module github.com/konveyor/tackle2-seed
go 1.19

require (
github.com/google/uuid v1.3.0 // indirect
github.com/jortel/go-utils v0.1.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
github.com/google/uuid v1.3.0
github.com/jortel/go-utils v0.1.1
gopkg.in/yaml.v3 v3.0.1
)

require github.com/kr/text v0.2.0 // indirect
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jortel/go-utils v0.1.1 h1:zkAAA+i5Z+151zUG7lkjILGxSo3pQ4bkLTRcPTCy3hs=
github.com/jortel/go-utils v0.1.1/go.mod h1:sl6vav63ODI0sUfSz8e0pImNmCVFnVsuOFhZmwe9GDk=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
5 changes: 0 additions & 5 deletions pkg/ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ func (r *RuleSet) Yaml() string {
return path.Join(r.SeedDir, r.Directory, RuleSetYaml)
}

// Image returns the path to the image.svg file.
func (r *RuleSet) Image() string {
return path.Join(r.SeedDir, r.Directory, RuleSetImage)
}

// Load populates the seed representation with values
// from the analyzer ruleset yaml.
func (r *RuleSet) Load() (err error) {
Expand Down
5 changes: 5 additions & 0 deletions pkg/seed.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const (
KindJobFunction = "jobfunction"
KindRuleSet = "ruleset"
KindTagCategory = "tagcategory"
KindTarget = "target"
)

// Seed document structure.
Expand Down Expand Up @@ -60,6 +61,10 @@ func (r *Seed) DecodeItems() (decoded []interface{}, err error) {
return
}
decoded = append(decoded, item)
case KindTarget:
item := Target{SeedDir: r.Dir()}
err = encoded.Decode(&item)
decoded = append(decoded, item)
case KindRuleSet:
item := RuleSet{SeedDir: r.Dir()}
err = encoded.Decode(&item)
Expand Down
22 changes: 22 additions & 0 deletions pkg/target.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package pkg

import "path"

type Target struct {
UUID string `yaml:",omitempty"`
Name string `yaml:",omitempty"`
Description string `yaml:",omitempty"`
ImagePath string `yaml:",omitempty"`
Choice bool `yaml:",omitempty"`
Labels []TargetLabel `yaml:",omitempty"`
SeedDir string `yaml:",omitempty"`
}

func (r *Target) Image() string {
return path.Join(r.SeedDir, r.ImagePath)
}

type TargetLabel struct {
Name string `yaml:",omitempty" json:"name"`
Label string `yaml:",omitempty" json:"label"`
}
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion resources/rulesets.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kind: RuleSet
version: 7
version: 8
items:
- uuid: 10667615-e067-45b4-a925-563a79ea0949
name: ".discovery"
Expand Down
12 changes: 0 additions & 12 deletions resources/rulesets/eap7/image.svg

This file was deleted.

12 changes: 0 additions & 12 deletions resources/rulesets/eap8/image.svg

This file was deleted.

12 changes: 0 additions & 12 deletions resources/rulesets/eapxp/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/filemappings/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/fuse-service-works/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/fuse/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/hibernate/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/jakarta-ee9/image.svg

This file was deleted.

6 changes: 0 additions & 6 deletions resources/rulesets/openjdk7/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/openliberty/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/openshift/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/quarkus/image.svg

This file was deleted.

7 changes: 0 additions & 7 deletions resources/rulesets/rhr/image.svg

This file was deleted.

3 changes: 0 additions & 3 deletions resources/rulesets/technology-usage/image.svg

This file was deleted.

82 changes: 82 additions & 0 deletions resources/targets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
kind: Target
version: 8
items:
- uuid: 72e4ac0a-619a-4c6e-acdc-b2ae6540ca56
name: Application server migration to
description: Upgrade to the latest Release of JBoss EAP or migrate your applications to JBoss EAP from other Enterprise Application Server (e.g. Oracle WebLogic Server).
imagepath: images/eap.svg
choice: true
labels:
- name: JBoss EAP 7
label: konveyor.io/target=eap7
- name: JBoss EAP 8
label: konveyor.io/target=eap8
- uuid: 9a14647c-0cdf-45e7-8399-84167500385a
name: Containerization
description: A comprehensive set of cloud and container readiness rules to assess applications for suitability for deployment on Kubernetes.
imagepath: images/cloud.svg
labels:
- name: Containerization
label: konveyor.io/target=cloud-readiness
- uuid: c038c915-a52c-4b45-a29d-d4494622ff72
name: Quarkus
description: Rules to support the migration of Spring Boot applications to Quarkus.
imagepath: images/migration.svg
labels:
- name: Quarkus
label: konveyor.io/target=quarkus
- uuid: 4f366cc9-a528-44f4-b0d0-5aa4a318c0d0
name: OpenJDK
description: Rules to support upgrading the version of OpenJDK. Migrate to OpenJDK 11 or OpenJDK 17.
imagepath: images/mug.svg
choice: true
labels:
- name: OpenJDK 11
label: konveyor.io/target=openjdk11
- name: OpenJDK 17
label: konveyor.io/target=openjdk17
- uuid: d0d79c05-b6ef-43ad-929a-7ddaecbb83df
name: Linux
description: Ensure there are no Microsoft Windows paths hard coded into your applications.
imagepath: images/server.svg
labels:
- name: Linux
label: konveyor.io/target=linux
- uuid: 865c6794-70e5-4133-8a20-6b6b0013ab2d
name: Jakarta EE 9
description: A collection of rules to support migrating applications from Java EE 8 to Jakarta EE 9. The rules cover project dependencies, package renaming, updated XML Schema namespaces, the renaming of application configuration properties, and bootstrapping files.
imagepath: images/migration.svg
labels:
- name: Jakarta
label: konveyor.io/target=jakarta-ee
- uuid: 7c1d9643-aef4-4c18-92a1-567c434707cc
name: Spring Boot on Red Hat Runtimes
description: A set of rules for assessing the compatibility of applications against the versions of Spring Boot libraries supported by Red Hat Runtimes.
imagepath: images/migration.svg
labels:
- name: Spring Boot
label: konveyor.io/target=rhr
- uuid: 21941d31-3e8a-46cc-9d3e-b678d4cdeff7
name: Open Liberty
description: A comprehensive set of rules for migrating traditional WebSphere applications to Open Liberty.
imagepath: images/migration.svg
labels:
- name: Open Liberty
label: konveyor.io/target=openliberty
- uuid: 809b0710-8bb2-4345-94c0-f8bb274ffc72
name: Camel
description: A comprehensive set of rules for migration from Apache Camel 2 to Apache Camel 3.
imagepath: images/multiply.svg
labels:
- name: Camel
label: konveyor.io/target=camel
- uuid: e66a777a-ad09-4db8-b7e9-7217a03b4b92
name: Azure
description: Upgrade your Java application so it can be deployed on Azure App Service.
imagepath: images/virt.svg
choice: true
labels:
- name: Azure App Service
label: konveyor.io/target=azure-appservice
- name: Azure Kubernetes Service
label: konveyor.io/target=azure-aks

0 comments on commit 953199a

Please sign in to comment.