-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔖 ci(main) Add Secrets Pipleines CI-CD ADO
- Loading branch information
Oscar Andres Macias Narvaez
committed
Sep 1, 2023
1 parent
c0942e3
commit f91838e
Showing
10 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"githubPullRequests.ignoredPullRequestBranches": [ | ||
"main" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# version [1.0.0] | ||
|
||
## 20230901 | ||
|
||
- Include: Settings for mitigate hardcode. | ||
![Cifrate_SOPS_YAML][def] | ||
![Variables_Group][def2] | ||
![Variables][def3] | ||
![Artifacts][def4] | ||
|
||
[def]: ./src/img/image-1.png | ||
[def2]: ./src/img/image.png | ||
[def3]: ./src/img/variable.png | ||
[def4]: ./src/img/Artifacts.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Azure: Cifrado de secretos con SOPS (Pipeline) | ||
|
||
## Descripcion | ||
|
||
- Un saludo, espero se encuentre bien | ||
- A continuación detallaremos, desde Infraestructura - CyberSecurity, la guía del paso a paso para: | ||
- Que cualquier colaborador de Desrarrollo de Producto en la compañia, pueda Cifrar Secretos de repositorios o estructuras de archivos en repos desde una llave. | ||
|
||
## Requerimientos | ||
|
||
- Tener acceso, como lectura y escritura en cambios hacia el repositorio. | ||
|
||
## Guía | ||
|
||
- Crear una rama feature/test desde Main. | ||
|
||
## Etapas | ||
|
||
### Construcción | ||
|
||
#### appsettings.json | ||
|
||
- Abrir el archivo AppSettings.json. | ||
|
||
~~~ JSON | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "", | ||
"Microsoft.AspNetCore": "" | ||
} | ||
}, | ||
"Cache": [ | ||
{ | ||
"Name": "", | ||
"Hours": "", | ||
"Minutes": "", | ||
"seconds": "" | ||
} | ||
], | ||
} | ||
~~~ | ||
|
||
- Editar con el schema del archivo con claves y valores a cifrar. | ||
- Commitear los cambios. | ||
- Correr el pipeline "ci.yml", correspondiente al repositorio. | ||
|
||
### Publicaciones | ||
|
||
- Descargar el artefacto. | ||
|
||
### Pruebas | ||
|
||
- validar el resultado. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"Logging": { | ||
"LogLevel": { | ||
"Default": "Information", | ||
"Microsoft.AspNetCore": "Information" | ||
} | ||
}, | ||
"Cache": [ | ||
{ | ||
"Name": "", | ||
"Hours": "", | ||
"Minutes": "", | ||
"seconds": "" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
name: "$(BuildDefinitionName)_$(Build.SourceBranchName)_$(Major).$(Minor).$(Patch)" | ||
|
||
variables: | ||
- name: Major | ||
value: 1 | ||
- name: Minor | ||
value: 0 | ||
- name: Patch | ||
value: $[counter(format('{0}.{1}', variables['Major'], variables['Minor']), 0)] | ||
|
||
resources: | ||
repositories: | ||
- repository: $ORGANIZATION-infra | ||
type: git | ||
name: "$PROJECT/$ORGANIZATION-infra" | ||
|
||
trigger: | ||
tags: | ||
include: | ||
- '*' | ||
branches: | ||
include: | ||
- main | ||
paths: | ||
include: | ||
- src | ||
exclude: | ||
- docs | ||
- pipelines | ||
|
||
pool: "Agent Pool $ORGANIZATION" | ||
|
||
stages: | ||
- stage: "Build" | ||
jobs: | ||
- deployment: build | ||
continueOnError: false | ||
environment: "dev" | ||
variables: | ||
- group: dev-key-vault-credential | ||
- group: sops-key-vault | ||
|
||
strategy: | ||
runOnce: | ||
deploy: | ||
steps: | ||
- checkout: self | ||
|
||
- script: | | ||
eval $(SOPS_PAT) | ||
displayName: 'Download sops.yaml' | ||
- template: "templates/installSOPS.yml@$ORGANIZATION-infra" | ||
|
||
- template: "templates/encryptSOPS.yml@$ORGANIZATION-infra" | ||
parameters: | ||
FileToEncryptWithPath: "$(System.DefaultWorkingDirectory)/appsettings.json" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.