|
@@ -65,44 +65,44 @@ En el directorio raíz del proyecto tiene que haber un fichero llamado ```Jenkin
|
|
|
|
|
|
|
|
En el proyecto de prueba, el fichero es este
|
|
En el proyecto de prueba, el fichero es este
|
|
|
|
|
|
|
|
- pipeline {
|
|
|
|
|
- options {
|
|
|
|
|
- ansiColor('xterm')
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ pipeline {
|
|
|
|
|
+ options {
|
|
|
|
|
+ ansiColor('xterm')
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- agent {
|
|
|
|
|
- kubernetes {
|
|
|
|
|
- yamlFile 'builder.yaml'
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ agent {
|
|
|
|
|
+ kubernetes {
|
|
|
|
|
+ yamlFile 'builder.yaml'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- stages {
|
|
|
|
|
- stage('Kaniko Build & Push Image') {
|
|
|
|
|
- steps {
|
|
|
|
|
- container('kaniko') {
|
|
|
|
|
- script {
|
|
|
|
|
- sh '''
|
|
|
|
|
- /kaniko/executor --dockerfile `pwd`/Dockerfile \
|
|
|
|
|
- --context `pwd` \
|
|
|
|
|
- --destination=registry.reymota.es/myweb:${BUILD_NUMBER}
|
|
|
|
|
|
|
+ stages {
|
|
|
|
|
+ stage('Kaniko Build & Push Image') {
|
|
|
|
|
+ steps {
|
|
|
|
|
+ container('kaniko') {
|
|
|
|
|
+ script {
|
|
|
|
|
+ sh '''
|
|
|
|
|
+ /kaniko/executor --dockerfile `pwd`/Dockerfile \
|
|
|
|
|
+ --context `pwd` \
|
|
|
|
|
+ --destination=registry.reymota.es/myweb:${BUILD_NUMBER}
|
|
|
'''
|
|
'''
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- stage('Deploy App to Kubernetes') {
|
|
|
|
|
- steps {
|
|
|
|
|
- container('kubectl') {
|
|
|
|
|
- withCredentials([file(credentialsId: 'kubeconfig-imac', variable: 'KUBECONFIG')]) {
|
|
|
|
|
- sh 'sed -i "s/<TAG>/${BUILD_NUMBER}/" myweb.yaml'
|
|
|
|
|
- sh 'kubectl apply -f myweb.yaml'
|
|
|
|
|
|
|
+ stage('Deploy App to Kubernetes') {
|
|
|
|
|
+ steps {
|
|
|
|
|
+ container('kubectl') {
|
|
|
|
|
+ withCredentials([file(credentialsId: 'kubeconfig-imac', variable: 'KUBECONFIG')]) {
|
|
|
|
|
+ sh 'sed -i "s/<TAG>/${BUILD_NUMBER}/" myweb.yaml'
|
|
|
|
|
+ sh 'kubectl apply -f myweb.yaml'
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
### Creando secreto para el registry
|
|
### Creando secreto para el registry
|
|
|
|
|
|