diff --git a/hack/README.md b/hack/README.md new file mode 100644 index 0000000000..f4820996fe --- /dev/null +++ b/hack/README.md @@ -0,0 +1,17 @@ +# Scripts and samples of import data + +This folder is a place to keep sample data and scripts to help developers with +creating/importing various pieces of data. + +## Adding a base set of data to an empty instance + +For creating a base set of data in a tackle-hub instance, a good place to start +is [tackle-hub's hack folder](https://github.com/konveyor/tackle2-hub/tree/main/hack). +If you have hub running or port forwarded on port :9002, a basic set of data can be +added to the instance by: + +```sh +> git clone https://github.com/konveyor/tackle2-hub.git +> cd tackle2-hub/hack +> HOST=localhost:9002 ./add/all.sh +``` diff --git a/hack/import-applications/sample-applications.csv b/hack/import-applications/sample-applications.csv new file mode 100644 index 0000000000..80f64fdab1 --- /dev/null +++ b/hack/import-applications/sample-applications.csv @@ -0,0 +1,6 @@ +Record Type 1,Application Name,Description,Comments,Business Service,Dependency,Dependency Direction,Binary Group,Binary Artifact,Binary Version,Binary Packaging,Repository Type,Repository URL,Repository Branch,Repository Path,Tag Category 1,Tag 1,Tag Category 2,Tag 2,Tag Category 3,Tag 3,Tag Category 4,Tag 4,Tag Category 5,Tag 5,Tag Category 6,Tag 6,Tag Category 7,Tag 7,Tag Category 8,Tag 8,Tag Category 9,Tag 9,Tag Category 10,Tag 10,Tag Category 11,Tag 11,Tag Category 12,Tag 12,Tag Category 13,Tag 13,Tag Category 14,Tag 14,Tag Category 15,Tag 15,Tag Category 16,Tag 16,Tag Category 17,Tag 17,Tag Category 18,Tag 18,Tag Category 19,Tag 19,Tag Category 20,Tag 20 +1,Customers,Legacy Customers management service,,Retail,,,corp.acme.demo,customers-tomcat,0.0.1-SNAPSHOT,war,git,https://git-acme.local/customers.git,,,Operating System,RHEL 8,Database,Oracle,Language,Java,Runtime,Tomcat,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +1,Inventory,Inventory service,,Retail,,,corp.acme.demo,inventory,0.1.1-SNAPSHOT,war,git,https://git-acme.local/inventory.git,,,Operating System,RHEL 8,Database,Postgresql,Language,Java,Runtime,Quarkus,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +1,Gateway,API Gateway,,Retail,,,corp.acme.demo,gateway,0.1.1-SNAPSHOT,war,git,https://git-acme.local/gateway.git,,,Operating System,RHEL 8,,,Language,Java,Runtime,Spring Boot,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +2,Gateway,,,,Inventory,southbound +2,Gateway,,,,Customers,southbound diff --git a/client/public/questionnaire-data.yaml b/hack/import-questionnaire/cloud-native.yaml similarity index 73% rename from client/public/questionnaire-data.yaml rename to hack/import-questionnaire/cloud-native.yaml index 6af53ee020..b699d8a916 100644 --- a/client/public/questionnaire-data.yaml +++ b/hack/import-questionnaire/cloud-native.yaml @@ -1,75 +1,77 @@ name: Cloud Native description: | Questionnaire that includes the Twelve Factor Application principles. + sections: - - name: Application technologies 1 + - order: 1 + name: Application technologies 1 questions: - - formulation: What is the main technology in your application? + - text: What is the main technology in your application? explanation: What would you describe as the main framework used to build your application. answers: - - choice: Unknown + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - - choice: Quarkus + - text: Quarkus risk: green - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Quarkus - autotag: + applyTags: - category: Technology tag: Quarkus - - choice: Spring Boot + - text: Spring Boot risk: green - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Spring Boot - autotag: + applyTags: - category: Technology tag: Spring Boot - - choice: Java EE + - text: Java EE rationale: This might not be the most cloud friendly technology. mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE. risk: yellow - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Java EE - autotag: + applyTags: - category: Technology tag: Java EE - - choice: J2EE + - text: J2EE rationale: This is obsolete. mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE. risk: red - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: J2EE - autotag: + applyTags: - category: Technology tag: J2EE - - formulation: "What version of Java EE does the application use?" + - text: "What version of Java EE does the application use?" explanation: "What version of the Java EE specification is your application using?" answers: - - choice: Below 5. + - text: Below 5. rationale: This technology stack is obsolete. mitigation: Consider migrating to at least Java EE 7. risk: red - - choice: 5 or 6 + - text: 5 or 6 rationale: This is a mostly outdated stack. mitigation: Consider migrating to at least Java EE 7. risk: yellow - - choice: "7" + - text: "7" risk: green - include_if_tags_present: + includeFor: - category: Technology tag: Java EE - - formulation: Does your application use any caching mechanism? + - text: Does your application use any caching mechanism? answers: - - choice: Yes + - text: Yes rationale: This could be problematic in containers and Kubernetes. mitigation: Review the clustering mechanism to check compatibility and support for container environments. risk: yellow - autoanswer_if_tags_present: + autoAnswerFor: - category: Caching tag: Infinispan - category: Caching @@ -78,97 +80,99 @@ sections: tag: eXtreme Scale - category: Caching tag: Coherence - - choice: No + - text: No risk: green - - choice: Unknown + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - - formulation: What implementation of JAX-WS does your application use? + - text: What implementation of JAX-WS does your application use? answers: - - choice: Apache Axis + - text: Apache Axis rationale: This version is obsolete mitigation: Consider migrating to Apache CXF risk: red - - choice: Apache CXF + - text: Apache CXF risk: green - - choice: Unknown + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - skip_if_tags_present: + excludeFor: - category: Technology tag: Spring Boot - category: Technology tag: Quarkus - - name: Application technologies + + - order: 2 + name: Application technologies questions: - - formulation: What is the main technology in your application? + - text: What is the main technology in your application? explanation: What would you describe as the main framework used to build your application. answers: - - choice: Unknown + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - - choice: Quarkus + - text: Quarkus risk: green - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Quarkus - autotag: + applyTags: - category: Technology tag: Quarkus - - choice: Spring Boot + - text: Spring Boot risk: green - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Spring Boot - autotag: + applyTags: - category: Technology tag: Spring Boot - - choice: Java EE + - text: Java EE rationale: This might not be the most cloud friendly technology. mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE. risk: yellow - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: Java EE - autotag: + applyTags: - category: Technology tag: Java EE - - choice: J2EE + - text: J2EE rationale: This is obsolete. mitigation: Maybe start thinking about migrating to Quarkus or Jakarta EE. risk: red - autoanswer_if_tags_present: + autoAnswerFor: - category: Technology tag: J2EE - autotag: + applyTags: - category: Technology tag: J2EE - - formulation: "What version of Java EE does the application use?" + - text: "What version of Java EE does the application use?" explanation: "What version of the Java EE specification is your application using?" answers: - - choice: Below 5. + - text: Below 5. rationale: This technology stack is obsolete. mitigation: Consider migrating to at least Java EE 7. risk: red - - choice: 5 or 6 + - text: 5 or 6 rationale: This is a mostly outdated stack. mitigation: Consider migrating to at least Java EE 7. risk: yellow - - choice: "7" + - text: "7" risk: green - include_if_tags_present: + includeFor: - category: Technology tag: Java EE - - formulation: Does your application use any caching mechanism? + - text: Does your application use any caching mechanism? answers: - - choice: Yes + - text: Yes rationale: This could be problematic in containers and Kubernetes. mitigation: Review the clustering mechanism to check compatibility and support for container environments. risk: yellow - autoanswer_if_tags_present: + autoAnswerFor: - category: Caching tag: Infinispan - category: Caching @@ -177,34 +181,36 @@ sections: tag: eXtreme Scale - category: Caching tag: Coherence - - choice: No + - text: No risk: green - - choice: Unknown + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - - formulation: What implementation of JAX-WS does your application use? + - text: What implementation of JAX-WS does your application use? answers: - - choice: Apache Axis + - text: Apache Axis rationale: This version is obsolete mitigation: Consider migrating to Apache CXF risk: red - - choice: Apache CXF + - text: Apache CXF risk: green - - choice: Unknown + - text: Unknown rationale: This is a problem because of the uncertainty. mitigation: Gathering more information about this is required. risk: unknown - skip_if_tags_present: + excludeFor: - category: Technology tag: Spring Boot - category: Technology tag: Quarkus + thresholds: - red: 1% - yellow: 30% - unknown: 15% -risk_messages: + red: 1 + yellow: 30 + unknown: 15 + +riskMessages: red: Application requires deep changes in architecture or lifecycle yellow: Application is Cloud friendly but requires some minor changes green: Application is Cloud Native diff --git a/hack/import-questionnaire/demo-questionnaire-remove-question.yml b/hack/import-questionnaire/demo-questionnaire-remove-question.yml new file mode 100644 index 0000000000..0349544f2b --- /dev/null +++ b/hack/import-questionnaire/demo-questionnaire-remove-question.yml @@ -0,0 +1,103 @@ +name: Test questionnaire 2 +description: This is a sample questionnaire in YAML format +required: true +sections: + - order: 1 + name: Section 1 + questions: + - order: 1 + text: What is your favorite color? + explanation: Please select your favorite color. + includeFor: + - category: Category1 + tag: Tag1 + excludeFor: [] + answers: + - order: 1 + text: Red + risk: red + rationale: Red is a nice color. + mitigation: No mitigation needed. + applyTags: [] + autoAnswerFor: [{ category: Category1, tag: Tag1 }] + selected: false + - order: 2 + text: Blue + risk: green + rationale: Blue is a calming color. + mitigation: No mitigation needed. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 2 + text: What is your favorite sport? + explanation: Please select your favorite sport. + excludeFor: + - category: Category1 + tag: Tag1 + answers: + - order: 1 + text: Soccer + risk: red + rationale: There are other sports? + mitigation: Beware of crunching tackles. High risk of injury. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 2 + text: Cycling + risk: red + rationale: Correct. + mitigation: High risk of decapitation by car. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 3 + text: Climbing + risk: yellow + rationale: Climbing is fun. + mitigation: Slight bit of mitigation needed. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 4 + text: Swimming + risk: yellow + rationale: Swimming is fun, too. + mitigation: Slight bit of mitigation needed. Drowning can be a problem. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 5 + text: Running + risk: red + rationale: Oof. + mitigation: Some mitigation required. High risk of injury. Don't run with scissors (or at all). + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 3 + text: What is your favorite shape? + explanation: Please select your favorite shape. + includeFor: + - category: Category1 + tag: Tag1 + excludeFor: [] + answers: + - order: 1 + text: Circle + risk: red + selected: false + - order: 2 + text: Square + risk: green + selected: false +thresholds: + red: 5 + yellow: 10 + unknown: 15 +riskMessages: + red: High risk + yellow: Medium risk + green: Low risk + unknown: Unknown risk diff --git a/hack/import-questionnaire/demo-questionnaire.yml b/hack/import-questionnaire/demo-questionnaire.yml new file mode 100644 index 0000000000..1a5883942f --- /dev/null +++ b/hack/import-questionnaire/demo-questionnaire.yml @@ -0,0 +1,83 @@ +name: Test questionnaire +description: This is a sample questionnaire in YAML format +required: true +sections: + - order: 1 + name: Section 1 + questions: + - order: 1 + text: What is your favorite color? + explanation: Please select your favorite color. + includeFor: + - category: Category1 + tag: Tag1 + excludeFor: [] + answers: + - order: 1 + text: Red + risk: red + rationale: Red is a nice color. + mitigation: No mitigation needed. + applyTags: [] + selected: false + - order: 2 + text: Blue + risk: green + rationale: Blue is a calming color. + mitigation: No mitigation needed. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 2 + text: What is your favorite sport? + explanation: Please select your favorite sport. + answers: + - order: 1 + text: Soccer + risk: red + rationale: There are other sports? + mitigation: Beware of crunching tackles. High risk of injury. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 2 + text: Cycling + risk: red + rationale: Correct. + mitigation: High risk of decapitation by car. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 3 + text: Climbing + risk: yellow + rationale: Climbing is fun. + mitigation: Slight bit of mitigation needed. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 4 + text: Swimming + risk: yellow + rationale: Swimming is fun, too. + mitigation: Slight bit of mitigation needed. Drowning can be a problem. + applyTags: [] + autoAnswerFor: [] + selected: false + - order: 5 + text: Running + risk: red + rationale: Oof. + mitigation: Some mitigation required. High risk of injury. Don't run with scissors (or at all). + applyTags: [] + autoAnswerFor: [] + selected: false +thresholds: + red: 5 + yellow: 10 + unknown: 15 +riskMessages: + red: High risk + yellow: Medium risk + green: Low risk + unknown: Unknown risk