Skip to content

Commit

Permalink
docs: add blog post for multi-stage delivery (#3352)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Bacher <[email protected]>
Signed-off-by: Meg McRoberts <[email protected]>
Co-authored-by: Meg McRoberts <[email protected]>
  • Loading branch information
bacherfl and StackScribe authored Apr 2, 2024
1 parent d0cb713 commit 15ccf05
Show file tree
Hide file tree
Showing 15 changed files with 575 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ appcreationrequest
APPNAME
appv
appversion
applicationdeployment
aquasecurity
architecting
ARCHS
Expand Down Expand Up @@ -205,6 +206,7 @@ ghtoken
ginkgotypes
giscus
Gitlab
gitops
gke
glasskube
gms
Expand Down Expand Up @@ -387,6 +389,7 @@ linenums
linkedin
linkedtrace
livenessprobe
loadtests
LOCALBIN
logf
logr
Expand Down
409 changes: 409 additions & 0 deletions docs/blog/posts/multi-stage-delivery-using-gitops.md

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions docs/blog/posts/multi-stage-delivery-using-gitops/argo-apps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: simple-go-app-context
namespace: argocd
spec:
project: default
source:
repoURL: 'https://github.com/bacherfl/keptn-analysis-demo'
path: simple-app/chart-dev
targetRevision: HEAD
helm:
parameters:
- name: "commitID"
value: "$ARGOCD_APP_REVISION"
destination:
server: 'https://kubernetes.default.svc'
namespace: simple-go
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
---
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: simple-go-app-context-prod
namespace: argocd
spec:
project: default
source:
repoURL: 'https://github.com/bacherfl/keptn-analysis-demo'
path: simple-app/chart-prod
targetRevision: HEAD
helm:
parameters:
- name: "commitID"
value: "$ARGOCD_APP_REVISION"
destination:
server: 'https://kubernetes.default.svc'
namespace: simple-go
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions docs/blog/posts/multi-stage-delivery-using-gitops/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: simple-go-service
namespace: simple-go
spec:
selector:
matchLabels:
app: simple-go-service
template:
metadata:
labels:
app: simple-go-service
app.kubernetes.io/name: simple-go-service
app.kubernetes.io/part-of: simple-go
app.kubernetes.io/version: {{.Values.serviceVersion}}
keptn.sh/post-deployment-tasks: wait-for-monitoring
spec:
containers:
- image: bacherfl/simple-go-service:{{.Values.serviceVersion}}
imagePullPolicy: Always
name: simple-go-service
ports:
- containerPort: 9000
name: http
protocol: TCP
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnAppContext
metadata:
name: simple-go-prod
namespace: simple-go-prod
spec:

preDeploymentTasks:
- wait-for-prometheus
postDeploymentTasks:
- post-deployment-loadtests
- post-deployment-loadtests-backend
spanLinks:
- {{.Values.traceParent}}
metadata:
commitID: {{.Values.commitID}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: lifecycle.keptn.sh/v1beta1
kind: KeptnAppContext
metadata:
name: simple-go
namespace: simple-go
spec:
preDeploymentTasks:
- wait-for-prometheus
postDeploymentTasks:
- post-deployment-loadtests
- post-deployment-loadtests-backend
postDeploymentEvaluations:
- response-time
promotionTasks:
- promote
metadata:
commitID: {{.Values.commitID}}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions docs/blog/posts/multi-stage-delivery-using-gitops/promote.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: promote

on:
workflow_dispatch:
inputs:
traceParent:
description: 'OTEL parent trace'
required: false
type: string

permissions:
contents: write
pull-requests: write

jobs:
promote:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
# configure git client
git config --global user.email "<email address>"
git config --global user.name "<name>"
# create a new branch
git switch -c production/${{ github.sha }}
# promote the change
cp dev/values.yaml production/values.yaml
echo "traceParent: $TRACE_PARENT" >> production/values.yaml
# push the change to the new branch
git add production/values.yaml
git commit -m "Promote dev to production"
git push -u origin production/${{ github.sha }}
env:
TRACE_PARENT: ${{ inputs.traceParent }}
- run: |
gh pr create \
-B main \
-H production/${{ github.sha }} \
--title "Promote dev to production" \
--body "Automatically created by GHA"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
serviceVersion: v1
backendServiceVersion: v1
targetResponseTime: "0.50"
commitID: ""
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
serviceVersion: v1
backendServiceVersion: v1
targetResponseRate: "0.50"
commitID: ""
traceParent: ""
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 15ccf05

Please sign in to comment.