deployFull - silviaalejandra/todo-list-aws GitHub Wiki

Deploy Stage y Producción full CD

La salida de las pruebas se encuentra en el fichero log/fullCDPipelineAuto.log para la ejecucion automatica.

Creacion pipeline

Se mantiene la estrategia de tomar los pipelines del repositorio. Se modificó el pipeline entregado en el repo original para invocar los jobs asociados al pipeline multibranch de la solucion presentada por esta alumna.

stage('Staging'){
            steps{
                echo 'Starting staging job'
                build job: 'pipeline_deploy_parameter/develop', parameters: [
                      string(name:'ENVIRONMENT', value: "staging")]
            }
        }
        stage('Production'){
            steps{
                
                echo 'Starting production job'
                build job: 'pipeline_deploy_parameter/master', parameters: [
                      string(name:'ENVIRONMENT', value: "production")]

A diferencia de los pipelines anteriores, la solución del presente pipeline requiere de una conexion SSH con GitHub. Se crearon los juegos de llaves y se generó la entrada en el baúl de Jenkins para el uso. Claves 01

Ejecución automática

Se creó el job en Jenkins preparado para consultar el repositorio y ejecutar ante cambios. Se utilizó un control sobre el repositorio rama develop debido a que la lógica del pipeline luego mergea los cambios con master. FULLPipe 01

Se aplicó el merge de una versión estable desde la rama feature hacia la rama develop. Esto desencadenó la ejecución del pipeline

Started by an SCM change
Obtained pipelines/PIPELINE-FULL-CD/Jenkinsfile from git [email protected]:silviaalejandra/todo-list-aws.git
[...]
 > git rev-parse origin/develop^{commit} # timeout=10
Checking out Revision 8b174a63e464c2a4edb32840ada8bed6c88d6a40 (origin/develop)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 8b174a63e464c2a4edb32840ada8bed6c88d6a40 # timeout=10
Commit message: "Merge pull request #6 from silviaalejandra/feature"

Al finalizar de forma correcta la invicacion del job de ejecucion en develop (job pipeline_deploy_parameter » develop #9), el pipeline realiza el merge con la rama master

[Pipeline] sh (Merging code to master)
+ set -x
+ git branch -a
* (HEAD detached at 8b174a6)
  remotes/origin/develop
  remotes/origin/feature
  remotes/origin/main
  remotes/origin/master
+ git checkout -b develop origin/develop
Switched to a new branch 'develop'
Branch 'develop' set up to track remote branch 'develop' from 'origin'.
+ git checkout -b master origin/master
Switched to a new branch 'master'
Branch 'master' set up to track remote branch 'master' from 'origin'.
+ git merge develop
Merge made by the 'recursive' strategy.
 CHANGELOG.md                           |   8 +-
 README.md                              |   2 +-
 logs/fullCDPipeline.log                | 109 +++++
 logs/productionPipeline.log            | 509 +++++++++++++++++++
 logs/stagingPipeline.log               | 871 +++++++++++++++++++++++++++++++++
 pipelines/PIPELINE-FULL-CD/Jenkinsfile |   4 +-
 6 files changed, 1499 insertions(+), 4 deletions(-)
 create mode 100644 logs/fullCDPipeline.log
 create mode 100644 logs/productionPipeline.log
 create mode 100644 logs/stagingPipeline.log
[Pipeline] sshagent
[ssh-agent] Using credentials silviaalejandra (github)
[ssh-agent] Looking for ssh-agent implementation...
[ssh-agent]   Exec ssh-agent (binary ssh-agent on a remote machine)
$ ssh-agent
SSH_AUTH_SOCK=/tmp/ssh-rLV8IWpwmMrE/agent.21220
SSH_AGENT_PID=21223
Running ssh-add (command line suppressed)
Identity added: /var/lib/jenkins/workspace/PIPELINE-FULL-CD@tmp/private_key_7642343047000851971.key ([email protected])
[ssh-agent] Started.
[Pipeline] {
[Pipeline] sh
+ git push origin master
To github.com:silviaalejandra/todo-list-aws.git
   8c767a2..0f0a235  master -> master

Luego ejecuta el job de despliegue en Produccion (Job pipeline_deploy_parameter » master #5)

FULLPipe 02 FULLPipe 03 FULLPipe 04 FULLPipe 05