Skip to content

Commit fe1fca3

Browse files
committed
Draft create
1 parent da7e511 commit fe1fca3

File tree

20 files changed

+427
-0
lines changed

20 files changed

+427
-0
lines changed

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
draft.toml
2+
charts/
3+
NOTICE
4+
LICENSE
5+
README.md

.helmignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj
22+
*.png
23+
24+
# known compile time folders
25+
target/
26+
node_modules/
27+
vendor/

Jenkinsfile

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
pipeline {
2+
agent {
3+
label "jenkins-python"
4+
}
5+
environment {
6+
ORG = 'angrish007'
7+
APP_NAME = 'python-flask-docker-master'
8+
CHARTMUSEUM_CREDS = credentials('jenkins-x-chartmuseum')
9+
}
10+
stages {
11+
stage('CI Build and push snapshot') {
12+
when {
13+
branch 'PR-*'
14+
}
15+
environment {
16+
PREVIEW_VERSION = "0.0.0-SNAPSHOT-$BRANCH_NAME-$BUILD_NUMBER"
17+
PREVIEW_NAMESPACE = "$APP_NAME-$BRANCH_NAME".toLowerCase()
18+
HELM_RELEASE = "$PREVIEW_NAMESPACE".toLowerCase()
19+
}
20+
steps {
21+
container('python') {
22+
sh "python -m unittest"
23+
24+
sh 'export VERSION=$PREVIEW_VERSION && skaffold build -f skaffold.yaml'
25+
26+
27+
sh "jx step post build --image $DOCKER_REGISTRY/$ORG/$APP_NAME:$PREVIEW_VERSION"
28+
}
29+
30+
dir ('./charts/preview') {
31+
container('python') {
32+
sh "make preview"
33+
sh "jx preview --app $APP_NAME --dir ../.."
34+
}
35+
}
36+
}
37+
}
38+
stage('Build Release') {
39+
when {
40+
branch 'master'
41+
}
42+
steps {
43+
container('python') {
44+
// ensure we're not on a detached head
45+
sh "git checkout master"
46+
sh "git config --global credential.helper store"
47+
48+
sh "jx step git credentials"
49+
// so we can retrieve the version in later steps
50+
sh "echo \$(jx-release-version) > VERSION"
51+
}
52+
dir ('./charts/python-flask-docker-master') {
53+
container('python') {
54+
sh "make tag"
55+
}
56+
}
57+
container('python') {
58+
sh "python -m unittest"
59+
60+
sh 'export VERSION=`cat VERSION` && skaffold build -f skaffold.yaml'
61+
62+
sh "jx step post build --image $DOCKER_REGISTRY/$ORG/$APP_NAME:\$(cat VERSION)"
63+
}
64+
}
65+
}
66+
stage('Promote to Environments') {
67+
when {
68+
branch 'master'
69+
}
70+
steps {
71+
dir ('./charts/python-flask-docker-master') {
72+
container('python') {
73+
sh 'jx step changelog --version v\$(cat ../../VERSION)'
74+
75+
// release the helm chart
76+
sh 'jx step helm release'
77+
78+
// promote through all 'Auto' promotion Environments
79+
sh 'jx promote -b --all-auto --timeout 1h --version \$(cat ../../VERSION)'
80+
}
81+
}
82+
}
83+
}
84+
}
85+
post {
86+
always {
87+
cleanWs()
88+
}
89+
}
90+
}

OWNERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
approvers:
2+
- angrish007
3+
reviewers:
4+
- angrish007

OWNERS_ALIASES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
aliases:
2+
- angrish007
3+
best-approvers:
4+
- angrish007
5+
best-reviewers:
6+
- angrish007

charts/preview/Chart.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
description: A Helm chart for Kubernetes
3+
icon: https://raw.githubusercontent.com/jenkins-x/jenkins-x-platform/master/images/python.png
4+
name: preview
5+
version: 0.1.0-SNAPSHOT

charts/preview/Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
OS := $(shell uname)
2+
3+
preview:
4+
ifeq ($(OS),Darwin)
5+
sed -i "" -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml
6+
sed -i "" -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml
7+
sed -i "" -e "s/tag: .*/tag: $(PREVIEW_VERSION)/" values.yaml
8+
else ifeq ($(OS),Linux)
9+
sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" Chart.yaml
10+
sed -i -e "s/version:.*/version: $(PREVIEW_VERSION)/" ../*/Chart.yaml
11+
sed -i -e "s|repository: .*|repository: $(DOCKER_REGISTRY)\/angrish007\/python-flask-docker-master|" values.yaml
12+
sed -i -e "s/tag: .*/tag: $(PREVIEW_VERSION)/" values.yaml
13+
else
14+
echo "platfrom $(OS) not supported to release from"
15+
exit -1
16+
endif
17+
echo " version: $(PREVIEW_VERSION)" >> requirements.yaml
18+
jx step helm build

charts/preview/requirements.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
dependencies:
3+
- alias: expose
4+
name: exposecontroller
5+
repository: https://chartmuseum.build.cd.jenkins-x.io
6+
version: 2.3.56
7+
- alias: cleanup
8+
name: exposecontroller
9+
repository: https://chartmuseum.build.cd.jenkins-x.io
10+
version: 2.3.56
11+
- alias: preview
12+
name: python-flask-docker-master
13+
repository: file://../python-flask-docker-master

charts/preview/values.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
expose:
3+
Annotations:
4+
helm.sh/hook: post-install,post-upgrade
5+
helm.sh/hook-delete-policy: hook-succeeded
6+
config:
7+
exposer: Ingress
8+
http: true
9+
tlsacme: false
10+
11+
cleanup:
12+
Args:
13+
- --cleanup
14+
Annotations:
15+
helm.sh/hook: pre-delete
16+
helm.sh/hook-delete-policy: hook-succeeded
17+
18+
preview:
19+
image:
20+
repository:
21+
tag:
22+
pullPolicy: IfNotPresent
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

0 commit comments

Comments
 (0)