generated from Templates/html-nginx-deployment
Bootstrapped from template.
Some checks failed
Home Cluster Builds/wedding-page/pipeline/head There was a failure building this commit
Some checks failed
Home Cluster Builds/wedding-page/pipeline/head There was a failure building this commit
This commit is contained in:
68
cicd/Jenkinsfile
vendored
Normal file
68
cicd/Jenkinsfile
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
#!groovy
|
||||
|
||||
pipeline {
|
||||
agent {
|
||||
kubernetes {
|
||||
defaultContainer 'jnlp'
|
||||
yaml """
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: wedding-fe-env.BRANCH_NAME-build
|
||||
spec:
|
||||
serviceAccountName: jenkins-admin
|
||||
containers:
|
||||
- name: kaniko
|
||||
image: gcr.io/kaniko-project/executor:debug
|
||||
command: ["tail"]
|
||||
args: ["-f", "/dev/null"]
|
||||
volumeMounts:
|
||||
- name: kaniko-secret
|
||||
mountPath: /kaniko/.docker
|
||||
- name: deploy
|
||||
image: 192.168.195.195:30000/nginx:latest
|
||||
command: ["tail"]
|
||||
args: ["-f", "/dev/null"]
|
||||
restartPolicy: Never
|
||||
volumes:
|
||||
- name: kaniko-secret
|
||||
secret:
|
||||
secretName: dockercred
|
||||
items:
|
||||
- key: .dockerconfigjson
|
||||
path: config.json
|
||||
"""
|
||||
}
|
||||
}
|
||||
stages {
|
||||
stage('Build') {
|
||||
steps {
|
||||
sh 'echo "No build steps configured."'
|
||||
}
|
||||
}
|
||||
stage('Test') {
|
||||
steps {
|
||||
sh 'echo "No test steps configured."'
|
||||
}
|
||||
}
|
||||
stage('Docker Build and Push') {
|
||||
steps {
|
||||
container("kaniko") {
|
||||
sh '''
|
||||
/kaniko/executor --dockerfile `pwd`/cicd/env.BRANCH_NAME/Dockerfile --context `pwd` --destination 192.168.195.195:30000/wedding-fe:env.BRANCH_NAME
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Kubernetes Deploy') {
|
||||
steps {
|
||||
container("deploy") {
|
||||
sh 'curl -LO "https://storage.googleapis.com/kubernetes-release/release/v1.24.3/bin/linux/arm64/kubectl"'
|
||||
sh 'chmod u+x ./kubectl'
|
||||
sh 'sed -ie "s/{{replaceMe}}/`date +%s`/g" `pwd`/cicd/env.BRANCH_NAME/deployment.yaml'
|
||||
sh './kubectl replace -f `pwd`/cicd/`env.BRANCH_NAME`/deployment.yaml'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
cicd/main/Dockerfile
Normal file
3
cicd/main/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM 192.168.195.195:30001/nginx:latest
|
||||
|
||||
COPY html /usr/share/nginx/html
|
||||
51
cicd/main/deployment.yaml
Normal file
51
cicd/main/deployment.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: wedding-fe-main-svc
|
||||
namespace: apps
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: wedding-fe-main
|
||||
ports:
|
||||
- name: http
|
||||
nodePort: 31011
|
||||
port: 80
|
||||
targetPort: 80
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: wedding-fe-main
|
||||
namespace: apps
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 1
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: wedding-fe-main
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: wedding-fe-main
|
||||
delpoymentDate: "{{replaceMe}}"
|
||||
spec:
|
||||
containers:
|
||||
- name: wedding-fe-main
|
||||
image: 192.168.195.195:30000/wedding-fe:main
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
successThreshold: 1
|
||||
3
cicd/prod/Dockerfile
Normal file
3
cicd/prod/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM 192.168.195.195:30001/nginx:latest
|
||||
|
||||
COPY html /usr/share/nginx/html
|
||||
51
cicd/prod/deployment.yaml
Normal file
51
cicd/prod/deployment.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: wedding-fe-prod-svc
|
||||
namespace: apps
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: wedding-fe-prod
|
||||
ports:
|
||||
- name: http
|
||||
nodePort: 31010
|
||||
port: 80
|
||||
targetPort: 80
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: wedding-fe-prod
|
||||
namespace: apps
|
||||
spec:
|
||||
replicas: 2
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 1
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: wedding-fe-prod
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: wedding-fe-prod
|
||||
delpoymentDate: "{{replaceMe}}"
|
||||
spec:
|
||||
containers:
|
||||
- name: wedding-fe-prod
|
||||
image: 192.168.195.195:30000/wedding-fe:prod
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
successThreshold: 1
|
||||
3
cicd/stage/Dockerfile
Normal file
3
cicd/stage/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM 192.168.195.195:30001/nginx:latest
|
||||
|
||||
COPY html /usr/share/nginx/html
|
||||
51
cicd/stage/deployment.yaml
Normal file
51
cicd/stage/deployment.yaml
Normal file
@@ -0,0 +1,51 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: wedding-fe-stage-svc
|
||||
namespace: apps
|
||||
spec:
|
||||
type: NodePort
|
||||
selector:
|
||||
app: wedding-fe-stage
|
||||
ports:
|
||||
- name: http
|
||||
nodePort: 31012
|
||||
port: 80
|
||||
targetPort: 80
|
||||
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: wedding-fe-stage
|
||||
namespace: apps
|
||||
spec:
|
||||
replicas: 1
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 1
|
||||
maxUnavailable: 1
|
||||
type: RollingUpdate
|
||||
selector:
|
||||
matchLabels:
|
||||
app: wedding-fe-stage
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: wedding-fe-stage
|
||||
delpoymentDate: "{{replaceMe}}"
|
||||
spec:
|
||||
containers:
|
||||
- name: wedding-fe-stage
|
||||
image: 192.168.195.195:30000/wedding-fe:stage
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
successThreshold: 1
|
||||
Reference in New Issue
Block a user