Skip to content

Commit 08bcb67

Browse files
author
Alexander Rogalskiy
committed
Updates on files
Added changeset on workflow
1 parent d9fef01 commit 08bcb67

32 files changed

+552
-970
lines changed

.github/workflows/helm.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
7+
jobs:
8+
build-push:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Prepare
13+
id: prep
14+
run: |
15+
VERSION=$(grep 'version' package.json | awk '{ print $4 }' | tr -d '"')
16+
CHANGELOG="https://github.com/AlexRogalskiy/java-patterns/blob/main/CHANGELOG.md#$(echo $VERSION | tr -d '.')"
17+
echo ::set-output name=BUILD_DATE::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
18+
echo ::set-output name=VERSION::${VERSION}
19+
echo ::set-output name=CHANGELOG::${CHANGELOG}
20+
- name: Setup QEMU
21+
uses: docker/setup-qemu-action@v1
22+
with:
23+
platforms: all
24+
- name: Setup Docker Buildx
25+
id: buildx
26+
uses: docker/setup-buildx-action@v1
27+
with:
28+
buildkitd-flags: "--debug"
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v1
31+
with:
32+
registry: ghcr.io
33+
username: AlexRogalskiy
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
- name: Publish image
36+
uses: docker/build-push-action@v2
37+
with:
38+
push: true
39+
builder: ${{ steps.buildx.outputs.name }}
40+
context: .
41+
file: ./Dockerfile
42+
platforms: linux/amd64,linux/arm64,linux/arm/v7
43+
build-args: |
44+
REVISON=${{ github.sha }}
45+
tags: |
46+
ghcr.io/AlexRogalskiy/java-patterns:${{ steps.prep.outputs.VERSION }}
47+
labels: |
48+
org.opencontainers.image.title=${{ github.event.repository.name }}
49+
org.opencontainers.image.description=${{ github.event.repository.description }}
50+
org.opencontainers.image.url=${{ github.event.repository.html_url }}
51+
org.opencontainers.image.source=${{ github.event.repository.html_url }}
52+
org.opencontainers.image.revision=${{ github.sha }}
53+
org.opencontainers.image.version=${{ steps.prep.outputs.VERSION }}
54+
org.opencontainers.image.created=${{ steps.prep.outputs.BUILD_DATE }}
55+
- name: Check images
56+
run: |
57+
docker buildx imagetools inspect ghcr.io/AlexRogalskiy/java-patterns:${{ steps.prep.outputs.VERSION }}
58+
- name: Publish Helm charts
59+
uses: stefanprodan/helm-gh-pages@v1.3.0
60+
with:
61+
token: ${{ secrets.GITHUB_TOKEN }}
62+
charts_url: ./charts
63+
linting: off
64+
- name: Create release
65+
uses: actions/create-release@latest
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
tag_name: ${{ github.ref }}
70+
release_name: ${{ github.ref }}
71+
draft: false
72+
prerelease: false
73+
body: |
74+
[CHANGELOG](${{ steps.prep.outputs.CHANGELOG }})

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ tilt-stop:
102102
# Run helm lint command.
103103
.PHONY: helm-lint
104104
helm-lint:
105-
helm lint charts
105+
helm lint charts --values charts/values.yaml
106106

107107
# Run helm start command.
108108
.PHONY: helm-start

charts/Chart.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
apiVersion: v2
22
version: 1.0.0
3-
appVersion: 1.0.1
3+
appVersion: "1.0.1"
44
created: "2021-09-01T06:23:41.21262323Z"
55
name: backend-java-patterns
6-
description: Java Design Patterns documentation
6+
description: |
7+
Java Design Patterns documentation
78
home: https://alexander-rogalsky.gitbook.io/java-patterns
89
icon: https://d1j8pt39hxlh3d.cloudfront.net/emoji/emojione/5.0/png/unicode/32/1f4d2.png
910
type: application

charts/templates/NOTES.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
Thank you for installing Java Patterns Docs!
3+
4+
- The application has been deployed, but it could take a few minutes to be ready.
5+
You can check the rollout using:
6+
7+
kubectl rollout status deployment {{ include "backend-java-patterns.fullname" . }}
8+
9+
- The Java Patterns Docs webapp are accessible through the landing page:
10+
{{ if .Values.ingress.enabled }}
11+
{{- range $host := .Values.ingress.hosts }}
12+
{{- range .paths }}
13+
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}/java-patterns/
14+
{{- end }}
15+
{{- end }}
16+
17+
{{- else if contains "NodePort" .Values.service.type }}
18+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "backend-java-patterns.fullname" . }})
19+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
20+
echo "http://$NODE_IP:$NODE_PORT/java-patterns/"
21+
22+
{{- else if contains "LoadBalancer" .Values.service.type }}
23+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
24+
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "backend-java-patterns.fullname" . }}'
25+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "backend-java-patterns.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
26+
echo "http://$SERVICE_IP:{{ .Values.service.port }}/java-patterns/"
27+
28+
{{- else if contains "ClusterIP" .Values.service.type }}
29+
kubectl --namespace {{ .Release.Namespace }} port-forward svc/{{ include "backend-java-patterns.fullname" . }} {{ .Values.service.port }}
30+
http://localhost:8000/java-patterns/
31+
{{- end }}
32+
33+
Enjoy automation!

charts/templates/_helpers.tpl

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,57 +3,75 @@
33
Expand the name of the chart.
44
*/}}
55
{{- define "backend-java-patterns.name" -}}
6-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7-
{{- end -}}
6+
{{- default .Chart.Name .Values.general.nameOverride | trunc 63 | trimSuffix "-" }}
7+
{{- end }}
8+
9+
{{/*
10+
Expand the app version of the chart.
11+
*/}}
12+
{{- define "backend-java-patterns.appVersion" -}}
13+
{{- default .Chart.AppVersion | trunc 33 | trimSuffix "-" }}
14+
{{- end }}
815

916
{{/*
1017
Create a default fully qualified app name.
1118
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
1219
*/}}
1320
{{- define "backend-java-patterns.fullname" -}}
14-
{{- if .Values.fullnameOverride -}}
15-
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
16-
{{- else -}}
17-
{{- $name := default .Chart.Name .Values.nameOverride -}}
18-
{{- if contains $name .Release.Name -}}
19-
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
20-
{{- else -}}
21-
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
22-
{{- end -}}
23-
{{- end -}}
24-
{{- end -}}
21+
{{- if .Values.general.fullnameOverride }}
22+
{{- .Values.general.fullnameOverride | trunc 63 | trimSuffix "-" }}
23+
{{- else }}
24+
{{- $name := default .Chart.Name .Values.general.nameOverride }}
25+
{{- if contains $name .Release.Name }}
26+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
27+
{{- else }}
28+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
29+
{{- end }}
30+
{{- end }}
31+
{{- end }}
2532

2633
{{/*
2734
Create chart name and version as used by the chart label.
2835
*/}}
2936
{{- define "backend-java-patterns.chart" -}}
30-
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
31-
{{- end -}}
37+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
38+
{{- end }}
39+
40+
{{/*
41+
Selector labels
42+
*/}}
43+
{{- define "backend-java-patterns.selectorLabels" -}}
44+
app.kubernetes.io/name: {{ include "backend-java-patterns.name" . }}
45+
app.kubernetes.io/instance: {{ .Release.Name | lower | quote }}
46+
{{- end }}
3247

3348
{{/*
3449
Common labels
3550
*/}}
3651
{{- define "backend-java-patterns.labels" -}}
3752
helm.sh/chart: {{ include "backend-java-patterns.chart" . }}
3853
{{ include "backend-java-patterns.selectorLabels" . }}
39-
{{- if .Chart.AppVersion -}}
54+
{{- if .Chart.AppVersion }}
4055
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41-
{{- end -}}
56+
{{- end }}
4257
app.kubernetes.io/managed-by: {{ .Release.Service }}
43-
{{- end -}}
44-
45-
{{/*
46-
Selector labels
47-
*/}}
48-
{{- define "backend-java-patterns.selectorLabels" -}}
49-
app.kubernetes.io/name: {{ .Chart.Name | lower | quote }}
50-
app.kubernetes.io/instance: {{ .Release.Name | lower | quote }}
51-
{{- end -}}
58+
{{- end }}
5259

5360
{{/*
5461
Create the name of the tls secret for secure port
5562
*/}}
5663
{{- define "backend-java-patterns.tlsSecretName" -}}
57-
{{- $fullname := include "java-patterns.name" . -}}
64+
{{- $fullname := include "backend-java-patterns.name" . -}}
5865
{{- default (printf "%s-tls" $fullname) .Values.tls.secretName -}}
59-
{{- end -}}
66+
{{- end }}
67+
68+
{{/*
69+
Create the name of the service account to use
70+
*/}}
71+
{{- define "backend-java-patterns.serviceAccountName" -}}
72+
{{- if .Values.serviceAccount.create }}
73+
{{- default (include "backend-java-patterns.fullname" .) .Values.serviceAccount.name }}
74+
{{- else }}
75+
{{- default "default" .Values.serviceAccount.name }}
76+
{{- end }}
77+
{{- end }}

charts/templates/certificate.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{{- if .Values.certificate.create }}
2+
{{- $fullName := include "backend-java-patterns.fullname" . -}}
3+
apiVersion: cert-manager.io/v1
4+
kind: Certificate
5+
metadata:
6+
name: {{ $fullName }}
7+
labels:
8+
{{- include "backend-java-patterns.labels" . | nindent 4 }}
9+
spec:
10+
dnsNames:
11+
{{- range .Values.certificate.dnsNames }}
12+
- {{ . | quote }}
13+
{{- end }}
14+
secretName: {{ include "backend-java-patterns.tlsSecretName" . }}
15+
issuerRef:
16+
{{- .Values.certificate.issuerRef | toYaml | trimSuffix "\n" | nindent 4 }}
17+
{{- end }}

charts/templates/configmap.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- $fullName := include "backend-java-patterns.fullname" . -}}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ $fullName }}
6+
labels:
7+
{{- include "backend-java-patterns.labels" . | nindent 4 }}
8+
data:
9+
DEBUG: {{ default "" .Values.configMaps.data.debug | quote }}
10+
SERVER_PORT: {{ default "" .Values.configMaps.data.serverPort | quote }}
11+
APP_NAME: {{ default "" .Values.configMaps.data.appName | quote }}

0 commit comments

Comments
 (0)