Skip to content

Commit ca42a50

Browse files
authored
Merge pull request #5 from LearnWithHomer/DEV-596-corrected
Dev 596 corrected
2 parents 5db4c15 + 2cd4f58 commit ca42a50

File tree

3 files changed

+67
-147
lines changed

3 files changed

+67
-147
lines changed

Jenkinsfile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env groovy
2+
import groovy.time.*
3+
4+
def ecr_repo_east = '597764168253.dkr.ecr.us-east-1.amazonaws.com'
5+
def ecr_repo_south = '597764168253.dkr.ecr.ap-south-1.amazonaws.com'
6+
def ecr_repo_southeast = '597764168253.dkr.ecr.ap-southeast-2.amazonaws.com'
7+
def aws_region = 'us-east-1'
8+
def app = '' /* the docker app build gets stored here */
9+
def homer_image_name = "${ecr_repo_east}/homer-squidex"
10+
def upstream_image_name = "squidex/squidex"
11+
def upstream_image_tag = "4.5.1"
12+
def full_image_name = null
13+
def cluster = null
14+
def namespace = null
15+
16+
pipeline {
17+
agent any
18+
options {
19+
disableConcurrentBuilds()
20+
}
21+
parameters {
22+
string(name: 'tag', description: 'The tag to deploy', defaultValue: 'latest')
23+
choice(name: 'cluster', choices: ['staging', 'production'], description: 'The Kubernetes Cluster to deploy to')
24+
choice(name: 'namespace', choices: ['content-dev', 'content-v1', 'content-v2'], description: 'The environment to deploy squidex to')
25+
}
26+
stages {
27+
stage('Checkout') {
28+
steps {
29+
script {
30+
git branch:'5.6_homer', credentialsId: 'jenkins-aws-user', url: 'https://github.com/LearnWithHomer/squidex'
31+
if (params.namespace == "content-v1"){
32+
full_image_name = "${upstream_image_name}:${upstream_image_tag}"
33+
}
34+
full_image_name = "${homer_image_name}:${tag}"
35+
cluster = params.cluster
36+
namespace = params.namespace
37+
}
38+
}
39+
}
40+
41+
stage('Update Kubernetes Deployment yaml'){
42+
steps {
43+
script {
44+
deploymentName = homerKubernetes.getDeploymentName()
45+
replicas = homerKubernetes.getReplicaCount(cluster, namespace, deploymentName)
46+
homerKubernetes.updateDeploymentYaml(app, 'k8s/deployment.yaml')
47+
homerKubernetes.updateReplicaCount(replicas)
48+
}
49+
}
50+
}
51+
52+
53+
stage('Deploy'){
54+
when {
55+
expression {deploy}
56+
}
57+
steps {
58+
script {
59+
homerKubernetes.deploy(namespace, cluster)
60+
homerKubernetes.deploy(namespace, cluster, 'k8s/service.yaml') //Create the service for the size
61+
}
62+
}
63+
}
64+
}
65+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: squidex
55
spec:
6-
replicas: 1
6+
replicas: $REPLICA_COUNT
77
revisionHistoryLimit: 2
88
selector:
99
matchLabels:
@@ -20,7 +20,7 @@ spec:
2020
spec:
2121
containers:
2222
- name: squidex
23-
image: squidex/squidex:4.5.1
23+
image: $DOCKER_IMAGE
2424
imagePullPolicy: Always
2525
resources:
2626
requests:

k8s/staging/v2/deployment.yaml

Lines changed: 0 additions & 145 deletions
This file was deleted.

0 commit comments

Comments
 (0)