diff --git a/.cloudbees/workflows/my-workflow.yaml b/.cloudbees/workflows/my-workflow.yaml
new file mode 100644
index 0000000..be21f8b
--- /dev/null
+++ b/.cloudbees/workflows/my-workflow.yaml
@@ -0,0 +1,30 @@
+apiVersion: automation.cloudbees.io/v1alpha1
+kind: workflow
+name: My workflow
+on:
+ push:
+ branches:
+ - "**"
+jobs:
+ build:
+ steps:
+ - uses: cloudbees-io/checkout@v1
+ name: Checkout
+ kind: build
+ - uses: cloudbees-io/configure-oci-credentials@v1
+ name: Configure container registry credentials
+ kind: build
+ id: dockerconfig
+ with:
+ registry: ${{ vars.DOCKER_REGISTRY }}
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+ - uses: cloudbees-io/kaniko@v1
+ name: Build a container image with Kaniko
+ kind: build
+ with:
+ dockerfile: Dockerfile
+ context: .
+ destination: rbroker/hello-py:20240123
+ build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1,BUILDKIT_INLINE_CACHE=1"
+#
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..d3091d4
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,22 @@
+name: Demo-Hello-Python
+on:
+ push:
+ branches:
+ - master
+jobs:
+ demo-hello-python-version:
+ runs-on: ubuntu-latest
+ steps:
+ - run: echo "Hello Python is at version ${{ steps.tagkit.outputs.tag }}"
+ - uses: actions/checkout@v2
+ - name: build
+ env:
+ DOCKER_USER: ${{ secrets.DOCKER_USER }}
+ DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
+ REPO: rbroker/hello-py
+ XLD_USER: ${{ secrets.XLD_USER }}
+ XLD_PASSWD: ${{ secrets.XLD_PASSWD }}
+ XLD_URL: "http://xld.rbroker.linkpc.net"
+ XLR_URL: "http://xlr.rbroker.linkpc.net"
+ GET_LOCAL: "N"
+ run: ./build.sh
diff --git a/Makefile b/Makefile
index b0c8b3f..621ecc7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-REPO ?= danberg/hello-py
+REPO ?= rbroker/hello-py
TAG ?= $(shell git rev-parse --short HEAD)
IMAGE := $(REPO):$(TAG)
LATEST_IMAGE := $(REPO):latest
diff --git a/app/main.py b/app/main.py
index b64a8c1..161bf6b 100644
--- a/app/main.py
+++ b/app/main.py
@@ -3,7 +3,7 @@
@app.route("/")
def hello():
- return "Hello from Python - Dan!"
+ return "Hello Digital.ai!
#GoTeam!
"
if __name__ == "__main__":
app.run(host='0.0.0.0')
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..464920b
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env bash
+
+export CLI_VERSION="10.0.0"
+export REPO="rbroker/hello-py"
+TAG="$(git rev-parse --short HEAD)"
+#export VERSION="3.1.1"
+if [ -z "${TAG}" ]
+then
+ echo "VERSION not set"
+ exit -1
+fi
+echo "Version = ${TAG}"
+IMAGE="${REPO}:${TAG}"
+
+echo "docker build -t ${IMAGE} -f Dockerfile ."
+docker build -t ${IMAGE} -f Dockerfile .
+docker login --username $DOCKER_USER --password $DOCKER_PASSWORD docker.io
+echo "docker push ${IMAGE}"
+docker push ${IMAGE}
+sed "s/{{image_tag}}/${TAG}/g" kubernetes/deployment.yaml > kubernetes/hello-python.yaml
+
+if [ -z "${GET_LOCAL}" ]
+then
+ xl apply --file dai-deploy/hello-python-deploy.yaml --values version=$TAG
+else
+ curl -LO https://dist.xebialabs.com/public/xl-cli/$CLI_VERSION/linux-amd64/xl
+ chmod +x xl
+ ./xl apply --xl-deploy-url=$XLD_URL --xl-deploy-username=$XLD_USER --xl-deploy-password=$XLD_PASSWD --file dai-deploy/hello-python-deploy.yaml --values version=$TAG
+ ./xl apply --xl-release-url=$XLR_URL --xl-release-username=$XLD_USER --xl-release-password=$XLD_PASSWD -d --file dai-deploy/start-release.yaml
+ rm xl
+fi
+#rm x.yaml
+rm kubernetes/hello-python.yaml
diff --git a/dai-deploy/hello-python-deploy.yaml b/dai-deploy/hello-python-deploy.yaml
index 3365daa..bbb0377 100644
--- a/dai-deploy/hello-python-deploy.yaml
+++ b/dai-deploy/hello-python-deploy.yaml
@@ -2,16 +2,16 @@
apiVersion: xl-deploy/v1
kind: Applications
spec:
-- name: Applications/HelloPy
+- name: Applications/Paycom/HelloPy
type: udm.Application
children:
- - name: d120bb2
+ - name: !format Applications/Paycom/HelloPy/%version%
type: udm.DeploymentPackage
deployables:
- name: hello-py-deploy.yaml
type: k8s.ResourcesFile
placeholders:
- - image_tag
+ - image_tag
- ingress_host
fileEncodings:
".+\\.properties": ISO-8859-1
@@ -24,4 +24,4 @@ spec:
displayResourceOnLogs: "false"
showContainerLogs: "false"
bytesToReadFromContainerLogs: "4000"
- file: !file "../kubernetes/deployment.yaml"
\ No newline at end of file
+ file: !file "../kubernetes/hello-python.yaml"
diff --git a/dai-deploy/start-release.yaml b/dai-deploy/start-release.yaml
new file mode 100644
index 0000000..9856fdb
--- /dev/null
+++ b/dai-deploy/start-release.yaml
@@ -0,0 +1,5 @@
+apiVersion: xl-release/v1
+kind: Release
+spec:
+ name: Start Hello Pytho Release
+ template: Paycom/hello-python
diff --git a/kubernetes/deployment.yaml b/kubernetes/deployment.yaml
index 34a9cec..a261309 100644
--- a/kubernetes/deployment.yaml
+++ b/kubernetes/deployment.yaml
@@ -10,6 +10,7 @@ spec:
port: 6000
targetPort: 5000
type: ClusterIP
+
---
apiVersion: apps/v1
kind: Deployment
@@ -18,7 +19,7 @@ metadata:
app: hello-py
name: hello-py
spec:
- replicas: 3
+ replicas: 5
strategy:
type: RollingUpdate
rollingUpdate:
@@ -33,26 +34,27 @@ spec:
app: hello-py
spec:
containers:
- - image: "{{image_name}}:{{image_tag}}"
+ - image: "rbroker/hello-py:{{image_tag}}"
name: hello-py
ports:
- containerPort: 5000
+
---
-apiVersion: networking.k8s.io/v1
+apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: hello-py-ingress
+ labels:
+ app: hello-py
annotations:
- nginx.ingress.kubernetes.io/rewrite-target: /$2
+ nginx.ingress.kubernetes.io/ssl-redirect: "false"
+
spec:
rules:
- - host: "{{ingress_host}}"
+ - host: {{ingress_host}}
http:
paths:
- - path: /hellopy(/|$)(.*)
- pathType: Prefix
+ - path: /
backend:
- service:
- name: hello-py-svc
- port:
- number: 6000
+ serviceName: hello-py-svc
+ servicePort: 6000