Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: konveyor/move2kube
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: bd679bff50908be425da6ff82f664a2385d74fda
Choose a base ref
..
head repository: konveyor/move2kube
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3c96f4ffca6a81b656c1aea8fe3aa8f8cbd2d514
Choose a head ref
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -55,9 +55,14 @@ endif
VERSION ?= latest

VERSION_METADATA = unreleased
ifneq ($(GIT_TAG),)
VERSION_METADATA =
ifneq ($(filter v%[0-9].%[0-9].%[0-9],$(GIT_TAG)),)
VERSION_METADATA = stable
else ifneq ($(filter v%[0-9].%[0-9].%[0-9]-%,$(GIT_TAG)),)
VERSION_METADATA = prerelease
else ifneq ($(filter v%[0-9].%[0-9].%[0-9]-released,$(GIT_TAG)),)
VERSION_METADATA = released
endif

LDFLAGS += -X github.com/konveyor/${BINNAME}/types/info.buildmetadata=${VERSION_METADATA}

LDFLAGS += -X github.com/konveyor/${BINNAME}/types/info.gitCommit=${GIT_COMMIT}
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -117,6 +117,23 @@ To browse code [![Open in VSCode](https://badgen.net/badge/icon/Visual%20Studio
* OpenShift Templates
* Docker compose

## Some Useful Configuration
You can set an alias for move2kube to make it more convenient to use. The following command allows you to refer to move2kube as m2k for the current terminal session:

```
alias m2k="move2kube"
```
### To configure it globally:
To keep aliases between sessions, you can save them in your user’s shell configuration profile file

#### Bash (.bashrc or .bash_profile)
```
echo 'alias m2k="move2kube"' >> ~/.bashrc
source ~/.bashrc
```

## Discussion

* For any questions reach out to us on any of the communication channels given on our website https://move2kube.konveyor.io/
151 changes: 80 additions & 71 deletions assets/built-in/qa/qamappings.yaml
Original file line number Diff line number Diff line change
@@ -1,71 +1,80 @@
categories:
- name: imageregistry
# or use the flags --enable imageregistry/--disable imageregistry
enabled: true
questions:
- move2kube.target.imageregistry.url
- move2kube.target.imageregistry.namespace
- move2kube.target.imageregistry.*.logintype
- move2kube.target.imageregistry.*.password
- name: sshkeys
enabled: true
questions:
- move2kube.repo.keys.*.key
- move2kube.repo.keys.pub.domain.*.pubkey
- move2kube.repo.keys.pub.load
- move2kube.repo.keys.load
- move2kube.repo.keys.paths
- move2kube.repo.keys.priv.*.password
- name: storage
enabled: true
questions:
- move2kube.storage.type.*.options
- name: sourceanalyzer
enabled: true
questions:
- move2kube.services.*.enable
- move2kube.services.*.statefulset
- move2kube.services.*.containerizationoption
- move2kube.services.*.childProjects.*.publishprofile
- move2kube.services.*.apacheconfig
- move2kube.services.*.pythonmainfile
- move2kube.services.*.pythonstartingfile
- move2kube.services.*.dockerfileType
- move2kube.services.*.childModules.*.enable
- move2kube.services.*.childProjects.*.enable
- move2kube.services.*.childModules.*.springBootProfiles
- move2kube.services.*.mavenProfiles
- name: cluster
enabled: true
questions:
- move2kube.target.*.clustertype
- move2kube.minreplicas
- name: network
enabled: true
questions:
- move2kube.services.*.*.servicetype
- move2kube.services.*.*.urlpath
- move2kube.services.*.ports
- move2kube.target.*.ingress.ingressclassname
- move2kube.target.*.ingress.host
- move2kube.target.*.ingress.tls
- name: git
enabled: true
questions:
- move2kube.vcs.git.name
- move2kube.vcs.git.username
- move2kube.vcs.git.email
- move2kube.vcs.git.pass
- name: cicd
enabled: true
questions:
- move2kube.target.cicd.tekton.gitreposshsecret
- move2kube.target.cicd.tekton.gitrepobasicauthsecret
- move2kube.target.cicd.tekton.registrypushsecret
- move2kube.transformers.kubernetes.argocd.namespace
- name: transformers
enabled: true
questions:
- move2kube.transformerselector
- move2kube.spawncontainers
- move2kube.transformers.types
apiVersion: move2kube.konveyor.io/v1alpha1
kind: QAMappings
metadata:
name: DefaultQA-Mappings
spec:
categories:
- name: imageregistry
# or use the flags --enable imageregistry/--disable imageregistry
enabled: true
questions:
- move2kube.target.imageregistry.url
- move2kube.target.imageregistry.namespace
- move2kube.target.imageregistry.*.logintype
- move2kube.target.imageregistry.*.password
- name: sshkeys
enabled: true
questions:
- move2kube.repo.keys.*.key
- move2kube.repo.keys.pub.domain.*.pubkey
- move2kube.repo.keys.pub.load
- move2kube.repo.keys.load
- move2kube.repo.keys.paths
- move2kube.repo.keys.priv.*.password
- name: storage
enabled: true
questions:
- move2kube.storage.type.*.options
- name: sourceanalyzer
enabled: true
questions:
- move2kube.services.*.enable
- move2kube.services.*.statefulset
- move2kube.services.*.containerizationoption
- move2kube.services.*.childProjects.*.publishprofile
- move2kube.services.*.apacheconfig
- move2kube.services.*.pythonmainfile
- move2kube.services.*.pythonstartingfile
- move2kube.services.*.dockerfileType
- move2kube.services.*.childModules.*.enable
- move2kube.services.*.childProjects.*.enable
- move2kube.services.*.childModules.*.springBootProfiles
- move2kube.services.*.mavenProfiles
- name: cluster
enabled: true
questions:
- move2kube.target.*.clustertype
- move2kube.minreplicas
- name: network
enabled: true
questions:
- move2kube.services.*.*.servicetype
- move2kube.services.*.*.urlpath
- move2kube.target.*.ingress.ingressclassname
- move2kube.target.*.ingress.host
- move2kube.target.*.ingress.tls
- name: ports
enabled: true
questions:
- move2kube.services.*.ports
- move2kube.services.*.port
- name: git
enabled: true
questions:
- move2kube.vcs.git.name
- move2kube.vcs.git.username
- move2kube.vcs.git.email
- move2kube.vcs.git.pass
- name: cicd
enabled: true
questions:
- move2kube.target.cicd.tekton.gitreposshsecret
- move2kube.target.cicd.tekton.gitrepobasicauthsecret
- move2kube.target.cicd.tekton.registrypushsecret
- move2kube.transformers.kubernetes.argocd.namespace
- name: transformers
enabled: true
questions:
- move2kube.transformerselector
- move2kube.spawncontainers
- move2kube.transformers.types
4 changes: 4 additions & 0 deletions cmd/flags.go
Original file line number Diff line number Diff line change
@@ -77,4 +77,8 @@ type qaflags struct {
preSets []string
// persistPasswords sets whether to persist the password or not
persistPasswords bool
// qaEnabledCategories contains list of categories to be enabled
qaEnabledCategories []string
// qaDisabledCategories contains list of categories to be disabled
qaDisabledCategories []string
}
57 changes: 11 additions & 46 deletions cmd/transform.go
Original file line number Diff line number Diff line change
@@ -23,17 +23,14 @@ import (
"path/filepath"
"runtime/pprof"

"github.com/konveyor/move2kube/assets"
"github.com/konveyor/move2kube/common"
"github.com/konveyor/move2kube/common/download"
"github.com/konveyor/move2kube/common/vcs"
"github.com/konveyor/move2kube/lib"
"github.com/konveyor/move2kube/types/plan"
"github.com/konveyor/move2kube/types/qaengine"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"gopkg.in/yaml.v3"
)

type transformFlags struct {
@@ -59,10 +56,8 @@ type transformFlags struct {
// maxIterations is the maximum number of iterations to allow before aborting with an error
maxIterations int
// CustomizationsPaths contains the path to the customizations directory
customizationsPath string
transformerSelector string
qaEnabledCategories []string
qaDisabledCategories []string
customizationsPath string
transformerSelector string
}

func transformHandler(cmd *cobra.Command, flags transformFlags) {
@@ -133,46 +128,9 @@ func transformHandler(cmd *cobra.Command, flags transformFlags) {
}
}

// qa-disable and qa=enable are mutually exclusive
if len(flags.qaEnabledCategories) > 0 && len(flags.qaDisabledCategories) > 0 {
logrus.Fatalf("--qa-enable and --qa-disable cannot be used together.\n")
}

// Read the QA categories from the QA mapping file
var qaMapping qaengine.QAMapping
qaMappingFilepath := filepath.Join("built-in/qa", "qamappings.yaml")
file, err := assets.AssetsDir.ReadFile(qaMappingFilepath)
if err != nil {
logrus.Fatalf("failed to read qa-mapping file at %s. Error: %q\n", qaMappingFilepath, err)
}

if err := yaml.Unmarshal(file, &qaMapping); err != nil {
logrus.Fatalf("failed to decode qa-mapping file. Error: %q\n", err)
}

for _, mapping := range qaMapping.Categories {
common.QACategoryMap[mapping.Name] = mapping.Questions
}
common.QACategoryMap["default"] = []string{}
common.QACategoryMap["external"] = []string{}

// Global settings
common.IgnoreEnvironment = flags.ignoreEnv
common.DisableLocalExecution = flags.disableLocalExecution
// if --qa-enable is passed, all categories are disabled by default. Otherwise, only categories passed to --qa-disable
// are disabled
if len(flags.qaEnabledCategories) > 0 {
for k := range common.QACategoryMap {
if !common.IsStringPresent(flags.qaEnabledCategories, k) {
common.DisabledCategories = append(common.DisabledCategories, k)
}
}
} else {
for _, cat := range flags.qaDisabledCategories {
common.DisabledCategories = append(common.DisabledCategories, cat)
}
}

// Parameter cleaning and curate plan
transformationPlan := plan.Plan{}
preExistingPlan := false
@@ -182,7 +140,7 @@ func transformHandler(cmd *cobra.Command, flags transformFlags) {
_, err = os.Stat(flags.planfile)
}
if err != nil {
logrus.Debugf("No plan file found.")
logrus.Infof("No plan file found.")
if cmd.Flags().Changed(planFlag) {
logrus.Fatalf("Error while accessing plan file at path %s Error: %q", flags.planfile, err)
}
@@ -201,6 +159,11 @@ func transformHandler(cmd *cobra.Command, flags transformFlags) {
logrus.Fatalf("Failed to create the output directory at path %s Error: %q", flags.outpath, err)
}
}
if flags.customizationsPath != "" {
if err := lib.CheckAndCopyCustomizations(flags.customizationsPath); err != nil {
logrus.Fatalf("Failed to check and copy the customizations. Error: %q", err)
}
}
startQA(flags.qaflags)
logrus.Debugf("Creating a new plan.")
transformationPlan, err = lib.CreatePlan(ctx, flags.srcpath, flags.outpath, flags.customizationsPath, flags.transformerSelector, flags.name)
@@ -240,7 +203,9 @@ func transformHandler(cmd *cobra.Command, flags transformFlags) {
if transformationPlan.Spec.SourceDir != "" {
checkSourcePath(transformationPlan.Spec.SourceDir)
}
lib.CheckAndCopyCustomizations(transformationPlan.Spec.CustomizationsDir)
if err := lib.CheckAndCopyCustomizations(transformationPlan.Spec.CustomizationsDir); err != nil {
logrus.Fatalf("Failed to check and copy the customizations. Error: %q", err)
}
if !isRemoteOutPath {
flags.outpath = filepath.Join(flags.outpath, transformationPlan.Name)
checkOutputPath(flags.outpath, flags.overwrite)
Loading