Skip to content

Commit f91838e

Browse files
author
Oscar Andres Macias Narvaez​
committed
🔖 ci(main) Add Secrets Pipleines CI-CD ADO
1 parent c0942e3 commit f91838e

File tree

10 files changed

+150
-0
lines changed

10 files changed

+150
-0
lines changed

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"githubPullRequests.ignoredPullRequestBranches": [
3+
"main"
4+
]
5+
}

Azure DevOps/Secrets/.sops.yaml.enc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Salted__@T�NAV�5��'���[ w�(�f}YbL�~S �Φ�V���)4~@�[ ˕������^��芴m�i�����h�J�\wV
2+
����]�� �X ���\]׆ŵ�౹�.��X�im�STa��J�%�Q�*�M��$
3+
ɀ�Yȇp��

Azure DevOps/Secrets/CHANGELOG.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# version [1.0.0]
2+
3+
## 20230901
4+
5+
- Include: Settings for mitigate hardcode.
6+
![Cifrate_SOPS_YAML][def]
7+
![Variables_Group][def2]
8+
![Variables][def3]
9+
![Artifacts][def4]
10+
11+
[def]: ./src/img/image-1.png
12+
[def2]: ./src/img/image.png
13+
[def3]: ./src/img/variable.png
14+
[def4]: ./src/img/Artifacts.png

Azure DevOps/Secrets/README.md

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Azure: Cifrado de secretos con SOPS (Pipeline)
2+
3+
## Descripcion
4+
5+
- Un saludo, espero se encuentre bien
6+
- A continuación detallaremos, desde Infraestructura - CyberSecurity, la guía del paso a paso para:
7+
- 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.
8+
9+
## Requerimientos
10+
11+
- Tener acceso, como lectura y escritura en cambios hacia el repositorio.
12+
13+
## Guía
14+
15+
- Crear una rama feature/test desde Main.
16+
17+
## Etapas
18+
19+
### Construcción
20+
21+
#### appsettings.json
22+
23+
- Abrir el archivo AppSettings.json.
24+
25+
~~~ JSON
26+
{
27+
"Logging": {
28+
"LogLevel": {
29+
"Default": "",
30+
"Microsoft.AspNetCore": ""
31+
}
32+
},
33+
"Cache": [
34+
{
35+
"Name": "",
36+
"Hours": "",
37+
"Minutes": "",
38+
"seconds": ""
39+
}
40+
],
41+
}
42+
~~~
43+
44+
- Editar con el schema del archivo con claves y valores a cifrar.
45+
- Commitear los cambios.
46+
- Correr el pipeline "ci.yml", correspondiente al repositorio.
47+
48+
### Publicaciones
49+
50+
- Descargar el artefacto.
51+
52+
### Pruebas
53+
54+
- validar el resultado.

Azure DevOps/Secrets/appsettings.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"Logging": {
3+
"LogLevel": {
4+
"Default": "Information",
5+
"Microsoft.AspNetCore": "Information"
6+
}
7+
},
8+
"Cache": [
9+
{
10+
"Name": "",
11+
"Hours": "",
12+
"Minutes": "",
13+
"seconds": ""
14+
}
15+
]
16+
}

Azure DevOps/Secrets/pipeline/ci.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: "$(BuildDefinitionName)_$(Build.SourceBranchName)_$(Major).$(Minor).$(Patch)"
3+
4+
variables:
5+
- name: Major
6+
value: 1
7+
- name: Minor
8+
value: 0
9+
- name: Patch
10+
value: $[counter(format('{0}.{1}', variables['Major'], variables['Minor']), 0)]
11+
12+
resources:
13+
repositories:
14+
- repository: $ORGANIZATION-infra
15+
type: git
16+
name: "$PROJECT/$ORGANIZATION-infra"
17+
18+
trigger:
19+
tags:
20+
include:
21+
- '*'
22+
branches:
23+
include:
24+
- main
25+
paths:
26+
include:
27+
- src
28+
exclude:
29+
- docs
30+
- pipelines
31+
32+
pool: "Agent Pool $ORGANIZATION"
33+
34+
stages:
35+
- stage: "Build"
36+
jobs:
37+
- deployment: build
38+
continueOnError: false
39+
environment: "dev"
40+
variables:
41+
- group: dev-key-vault-credential
42+
- group: sops-key-vault
43+
44+
strategy:
45+
runOnce:
46+
deploy:
47+
steps:
48+
- checkout: self
49+
50+
- script: |
51+
eval $(SOPS_PAT)
52+
displayName: 'Download sops.yaml'
53+
54+
- template: "templates/installSOPS.yml@$ORGANIZATION-infra"
55+
56+
- template: "templates/encryptSOPS.yml@$ORGANIZATION-infra"
57+
parameters:
58+
FileToEncryptWithPath: "$(System.DefaultWorkingDirectory)/appsettings.json"
31.7 KB
Loading
13.2 KB
Loading
42 KB
Loading
165 KB
Loading

0 commit comments

Comments
 (0)