Skip to content

Update changes for demo setup #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: canary
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node {
def project = 'chris_ricci'
def project = 'snsumner75'
def appName = 'python_api'
def feSvcName = "${appName}"
def namespace = 'production'
Expand All @@ -8,10 +8,10 @@ node {

stage 'Printenv'
sh("printenv")

stage 'Login to Quay.io'
sh("docker login -u=\"${env.quay_username}\" -p=\"${env.quay_password}\" quay.io")

stage 'Build image'
sh("docker build -t ${imageTag} .")

Expand All @@ -23,7 +23,7 @@ node {

stage "Deploy Application"
switch (env.BRANCH_NAME) {
case "canary":
case "canary":
// Roll out to canary environment
// Change deployed image in canary to the one we just built
sh("sed -i.bak 's#quay.io/${project}/${appName}:.*\$#${imageTag}#' ./k8s/canary/*.yaml")
Expand All @@ -40,6 +40,6 @@ node {
break

default:
break
break
}
}
2 changes: 1 addition & 1 deletion app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
@app.route('/index')
def index():
timestamp = str(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
return timestamp + " Hello, World!\n"
return timestamp + " Hello, World! - Version 1.0\n"
6 changes: 3 additions & 3 deletions k8s/canary/python-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: python-api
app: python-api
env: canary
name: python-api-canary
spec:
Expand All @@ -14,11 +14,11 @@ spec:
env: canary
spec:
containers:
- image: quay.io/chris_ricci/python_api:v1
- image: quay.io/snsumner75/python_api:v1
imagePullPolicy: IfNotPresent
name: python-api
ports:
- containerPort: 5000
- containerPort: 5000
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
Expand Down
6 changes: 3 additions & 3 deletions k8s/production/python-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: python-api
app: python-api
env: production
name: python-api-production
spec:
Expand All @@ -14,11 +14,11 @@ spec:
env: production
spec:
containers:
- image: quay.io/chris_ricci/python_api:v1
- image: quay.io/snsumner75/python_api:v1
imagePullPolicy: IfNotPresent
name: python-api
ports:
- containerPort: 5000
- containerPort: 5000
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
Expand Down