From b58ce06777545adb9e377ec022c37d7da5176e15 Mon Sep 17 00:00:00 2001 From: Aryan Date: Tue, 5 Jul 2022 13:04:08 +0530 Subject: [PATCH] Completed YAML parsing for task description section --- .../task-description.component.html | 44 +----- .../task-description.component.ts | 30 +++- src/assets/YAML/generated/sample.yaml | 134 ++++++++++++++---- 3 files changed, 141 insertions(+), 67 deletions(-) diff --git a/src/app/component/task-description/task-description.component.html b/src/app/component/task-description/task-description.component.html index 1525d0aec..42c00f2ed 100644 --- a/src/app/component/task-description/task-description.component.html +++ b/src/app/component/task-description/task-description.component.html @@ -57,45 +57,10 @@

{{currentTask.dimension}} -> {{currentTask.subDimension}}: Building and test

- - - - CI/CD tools - - -

- - - - - Tags - - -

ci-cd

- - - - - URL - - -

https://martinfowler.com/articles/continuousIntegration.html

-
- - - - Description - - -

CI/CD tools such as jenkins, gitlab-ci or github-actions

-
- -

- - + - Container technologies and orchestration like Docker, Kubernetes +

@@ -106,6 +71,9 @@

{{currentTask.dimension}} -> {{currentTask.subDimension}}: Building and test Tags +
    +
  • +
@@ -113,6 +81,7 @@

{{currentTask.dimension}} -> {{currentTask.subDimension}}: Building and test URL +

@@ -120,6 +89,7 @@

{{currentTask.dimension}} -> {{currentTask.subDimension}}: Building and test Description +

diff --git a/src/app/component/task-description/task-description.component.ts b/src/app/component/task-description/task-description.component.ts index b982fdd85..4d687222c 100644 --- a/src/app/component/task-description/task-description.component.ts +++ b/src/app/component/task-description/task-description.component.ts @@ -4,6 +4,13 @@ import { ActivatedRoute } from '@angular/router'; import { ymlService } from '../../service/yaml-parser/yaml-parser.service'; import * as md from 'markdown-it'; + +export interface implementation{ + name:string + tags:string[] + url:string + description:string +} export interface taskDescription { dimension:string subDimension:string @@ -19,6 +26,7 @@ export interface taskDescription { resources:number time:number dependsOn:string[] + implementation:implementation[] } @Component({ @@ -30,7 +38,7 @@ export class TaskDescriptionComponent implements OnInit { currentTask: taskDescription={dimension:'',subDimension:'',level:'',taskIndex:-1,description:'',risk:[], measure:'',implementatonGuide:'',samm:[''],iso:[''],knowledge:-1,resources:-1, - time:-1,dependsOn:[]} + time:-1,dependsOn:[], implementation:[]} YamlObject:any; @@ -98,8 +106,9 @@ export class TaskDescriptionComponent implements OnInit { } this.currentTask.dependsOn=this.defineStringArrayValues(data['dependsOn'],[]) - - //console.log(this.measure) + + this.currentTask.implementation=this.defineImplementationObject(data['implementation']) + }) } @@ -130,7 +139,20 @@ export class TaskDescriptionComponent implements OnInit { return valueOfDataIfUndefined } } - + defineImplementationObject(dataToCheck:implementation[]):implementation[]{ + var dataToReturn:implementation[]=[] + for (var data in dataToCheck){ + var temp:implementation={name:'',url:'',tags:[],description:''} + temp["name"]=this.defineStringValues(dataToCheck[data]["name"],'') + temp["url"]=this.defineStringValues(dataToCheck[data]["url"],'') + temp["description"]=this.defineStringValues(dataToCheck[data]["description"],'') + temp["tags"]=this.defineStringArrayValues(dataToCheck[data]["tags"],[]) + //console.log(temp) + dataToReturn.push(temp) + } + //console.log(dataToReturn) + return dataToReturn + } // Expand all function openall(): void{ diff --git a/src/assets/YAML/generated/sample.yaml b/src/assets/YAML/generated/sample.yaml index 682253f21..2c7b3a821 100644 --- a/src/assets/YAML/generated/sample.yaml +++ b/src/assets/YAML/generated/sample.yaml @@ -18,7 +18,12 @@ dimension: resources: 2 time: 2 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/ci-cd-tools + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 1 description: '## Benefits: @@ -56,8 +61,12 @@ dimension: resources: 2 time: 3 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/ci-cd-tools - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/container-technologi + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 1 measure: A well defined build process lowers the possibility of errors during the build process. @@ -84,8 +93,12 @@ dimension: resources: 2 time: 2 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/ci-cd-tools - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/container-technologi + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 2 measure: Each step during within the build and testing phase is performed in a separate virtual environments, which is destroyed afterward. @@ -113,10 +126,12 @@ dimension: resources: 2 time: 2 implementation: - - Container technology automatically creates a hash for images, which can be - used. - - Immutable images are an other way, e.g. by using a registry, which doesn't - allow overriding of images. + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 2 measure: Pinning of artifacts ensure that changes are performed only when intended. name: Pinning of artifacts @@ -136,7 +151,13 @@ dimension: knowledge: 2 resources: 3 time: 2 - implementation: [] + implementation: + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string iso27001-2017: - '8.1' - '8.2' @@ -154,7 +175,14 @@ dimension: knowledge: 2 resources: 2 time: 2 - implementation: [] + implementation: + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: # markdown + CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 3 measure: Digitally signing commits helps to prevent unauthorized manipulation of source code. @@ -175,8 +203,12 @@ dimension: resources: 2 time: 2 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker-content-trust - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/in-toto + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 3 measure: Digitally signing artifacts for all steps during the build and especially docker images, helps to ensure their integrity. @@ -202,8 +234,12 @@ dimension: resources: 1 time: 2 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/ci-cd-tools - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 1 measure: A defined deployment process significantly lowers the likelihood of errors during the deployment phase. @@ -223,7 +259,13 @@ dimension: knowledge: 2 resources: 1 time: 2 - implementation: [] + implementation: + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 2 measure: 'Configuration parameters are set for each environment not in the source code. @@ -252,7 +294,12 @@ dimension: resources: 1 time: 1 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/kubernetes-admission + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string iso27001-2017: - 15.1.1 - 15.1.2 @@ -294,9 +341,12 @@ dimension: resources: 2 time: 2 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/webserver - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/rolling-update + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string iso27001-2017: - 12.5.1 - 14.2.2 @@ -316,7 +366,12 @@ dimension: resources: 1 time: 2 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string iso27001-2017: - 14.3.1 - 14.2.8 @@ -337,7 +392,13 @@ dimension: knowledge: 2 resources: 1 time: 2 - implementation: '' + implementation: + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 3 measure: By using encryption, it is harder to read credentials , e.g. from the file system. Also, the usage of a credential management system can help protect @@ -366,7 +427,12 @@ dimension: resources: 1 time: 1 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/docker + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string iso27001-2017: - 14.3.1 - 14.2.8 @@ -387,7 +453,13 @@ dimension: knowledge: 2 resources: 3 time: 2 - implementation: [] + implementation: + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string iso27001-2017: - '8.1' - '8.2' @@ -410,7 +482,12 @@ dimension: resources: 3 time: 2 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/dependencyTrack + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string iso27001-2017: - '8.1' - '8.2' @@ -433,7 +510,12 @@ dimension: resources: 1 time: 2 implementation: - - $ref: data/dimensions-subdimensions-activities/implementations.yaml#/implementations/blue-green-deploymen + - name: CI/CD tools # string + tags: + - ci-cd # string + url: https://martinfowler.com/articles/continuousIntegration.html # url + description: CI/CD tools such as jenkins, gitlab-ci or github-actions + - name: Container technologies and orchestration like Docker, Kubernetes # string level: 4 measure: By having multiple production environments, a deployment can be performant on the first environment to spot possible defects before it is deployment