46 Commits

Author SHA1 Message Date
3c141a2d40 chore(release): 0.7.3 [skip ci]
## [0.7.3](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.7.2...v0.7.3) (2023-07-14)

### Bug Fixes

* Missing period in chart template ([0999fdf](0999fdf705))
2023-07-14 08:45:47 +00:00
0999fdf705 fix: Missing period in chart template
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-14 10:43:47 +02:00
6c71c5f364 chore(release): 0.7.2 [skip ci]
## [0.7.2](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.7.1...v0.7.2) (2023-07-14)

### Bug Fixes

* Adhere to naming convention in templates ([c551a24](c551a242c7))
2023-07-14 08:42:11 +00:00
c551a242c7 fix: Adhere to naming convention in templates
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-14 10:40:08 +02:00
ec36309d8d chore(release): 0.7.1 [skip ci]
## [0.7.1](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.7.0...v0.7.1) (2023-07-14)

### Bug Fixes

* Adhere to naming convention in values.yaml ([614fda9](614fda9b7d))
2023-07-14 08:39:28 +00:00
93ff24ac73 Merge branch 'main' of https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer into main
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-14 10:37:21 +02:00
614fda9b7d fix: Adhere to naming convention in values.yaml 2023-07-14 10:37:10 +02:00
78b8d6872a chore(release): 0.7.0 [skip ci]
# [0.7.0](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.6.0...v0.7.0) (2023-07-14)

### Features

* Add sidecar for continuous polling ([806757a](806757a913))
2023-07-14 08:24:10 +00:00
d09d09e526 build: Group shell commands to avoid unintended exit
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-14 10:22:06 +02:00
806757a913 feat: Add sidecar for continuous polling
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-14 10:15:55 +02:00
d40f35a2d6 build: Debug exit behaviour #2
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-13 10:45:25 +02:00
c61bc4fc8d build: Debug exit behaviour
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2023-07-13 10:42:53 +02:00
cbd981cf19 build: Revert using export and refactor to gracefully exit on an empty value
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2023-07-13 10:33:33 +02:00
f4457a1275 build: Add graceful exit if semantic release does not create a new version
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-13 09:17:42 +02:00
377885f802 build: Create and upload changelog file
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-12 12:22:42 +02:00
2538247718 chore(release): 0.6.0 [skip ci]
# [0.6.0](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.5.3...v0.6.0) (2023-07-12)

### Bug Fixes

* Refer to new container tag within chart values ([361a855](361a85592e))
* Replace deprecated parameters ([c681572](c6815721df))

### Features

* Switch to lts-slim tag ([1ab1c10](1ab1c10f37))
2023-07-12 10:12:33 +00:00
361a85592e fix: Refer to new container tag within chart values
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-12 12:10:06 +02:00
e83b98e116 chore: Fix variable reference 2023-07-11 21:19:54 +02:00
a4ced9e4b4 build: Include non-dryrun semantic release step
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 21:17:55 +02:00
cde06aae36 build: Fix manifest path
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 19:47:50 +02:00
f4ee0617cc build: Apply semantic release version to chart
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 19:44:28 +02:00
dce6d7fb1c build: Avoid newline in encoded authentication token
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 19:25:44 +02:00
f09dfc99d2 build: Debug registry authentication config file
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 19:24:30 +02:00
396e2fe9b3 build: Debug registry authentication
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 19:22:19 +02:00
3501cd51f3 build: Remove registry from destination
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 17:40:32 +02:00
78cb46795f build: Fix mixed up destination / credentials
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 17:37:37 +02:00
48e8b21c30 build: Change kaniko auth config to explicit registry v2 api
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 17:35:57 +02:00
b19a3f7391 build: Remove redundant apk repository commands 2023-07-11 17:30:23 +02:00
cde425809f build: Use busybox built-in wget instead of curl
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 17:29:12 +02:00
6170a12b19 build: Download jq binary
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 17:26:40 +02:00
a12ce0a9e9 build: Test build with original kaniko container image
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 17:19:16 +02:00
2c749e2077 build: Fix step name references
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 15:38:16 +02:00
1f2081f05c build: Test explicit binary
Some checks reported errors
continuous-integration/drone/push Build encountered an error
2023-07-11 15:37:29 +02:00
1d791a3820 build: Debug drone plugin behaviour
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 15:30:47 +02:00
7f5242eedc build: Remove erroneous parameter
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 15:19:34 +02:00
ec276c088d build: Include semantic release (WIP)
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 15:15:41 +02:00
1ab1c10f37 feat: Switch to lts-slim tag
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 14:11:58 +02:00
4deac9ab13 build: Revert parameter to secret value
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 10:23:40 +02:00
2f6c7f7f91 build: Align settings between registries
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 10:22:25 +02:00
d24792b8c3 build: Replace registry address with explicit api version
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 10:18:43 +02:00
55afb79de5 build: Specify explicit url for registry
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 10:11:31 +02:00
0fa80669cd build: Explicitly add registry to repo name
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 09:57:20 +02:00
38eb4e9faa build: Switch to kaniko plugin
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 09:51:52 +02:00
c6815721df fix: Replace deprecated parameters
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 09:43:26 +02:00
ff42784426 build: Reverse order of helm cm-push arguments
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-11 09:38:41 +02:00
d6e01f3c23 build: Refactor helm-chart upload
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-11 09:36:55 +02:00
11 changed files with 7160 additions and 62 deletions

View File

@ -1,55 +1,155 @@
kind: pipeline
type: kubernetes
name: Container image
name: Container & Helm chart
trigger:
event:
exclude:
- tag
steps:
- name: Build & publish (Harbor)
depends_on:
- clone
image: plugins/docker
context: .
settings:
repo: bv11-cr01.bessems.eu/library/json-server
registry: bv11-cr01.bessems.eu
tags: latest
mtu: 1450
username:
from_secret: harbor_username
password:
from_secret: harbor_password
- name: Build & publish (Dockerhub)
depends_on:
- clone
image: plugins/docker
context: .
settings:
repo: djpbessems/json-server
tags: latest
mtu: 1450
username:
from_secret: docker_username
password:
from_secret: docker_password
---
kind: pipeline
type: kubernetes
name: Helm chart (Gitea)
steps:
- name: Package & publish
image: bv11-cr01.bessems.eu/proxy/alpine/helm
- name: Semantic Release (Dry-run)
image: bv11-cr01.bessems.eu/proxy/library/node:20-slim
pull: always
commands:
- |
apk add yq
apt-get update
- |
helm package ./charts/json-server
apt-get install -y --no-install-recommends \
git-core \
ca-certificates
- |
CHART_VERSION=$(cat ./charts/json-server/Chart.yaml | yq '.version')
curl \
--header "Authorization: token $GIT_APIKEY" \
--upload-file json-server-$CHART_VERSION.tgz \
https://code.spamasaurus.com/api/packages/$GIT_USERNAME/helm/api/charts
npm install \
semantic-release \
@semantic-release/commit-analyzer \
@semantic-release/exec \
- |
export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY}
- |
npx semantic-release \
--package @semantic-release/exec \
--package semantic-release \
--branches ${DRONE_BRANCH} \
--tag-format "v\$${version}" \
--dry-run \
--plugins @semantic-release/commit-analyzer,@semantic-release/exec \
--analyzeCommits @semantic-release/commit-analyzer \
--verifyRelease @semantic-release/exec \
--verifyReleaseCmd 'echo "$${nextRelease.version}" > .version'
environment:
GIT_APIKEY:
from_secret: git_apikey
GIT_USERNAME: djpbessems
- name: Container image (Harbor)
depends_on:
- Semantic Release (Dry-run)
image: gcr.io/kaniko-project/executor:debug
pull: always
commands:
- |
export VALID_TAG=$(cat .version 2> /dev/null) && [ -n "$VALID_TAG" ] || (echo 'No release tag - exiting'; exit 0)
- |
wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq
chmod +x /bin/jq
- |
/bin/jq '.auths["https://bv11-cr01.bessems.eu/v2/"].auth="'"$(echo -n $HARBOR_USERNAME':'$HARBOR_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json
- |
/kaniko/executor \
--dockerfile=Dockerfile \
--context=dir://. \
--destination=bv11-cr01.bessems.eu/library/json-server:latest \
--destination=bv11-cr01.bessems.eu/library/json-server:$VALID_TAG
environment:
HARBOR_USERNAME:
from_secret: harbor_username
HARBOR_PASSWORD:
from_secret: harbor_password
- name: Container image (docker.io)
depends_on:
- Semantic Release (Dry-run)
image: gcr.io/kaniko-project/executor:debug
pull: always
commands:
- |
export VALID_TAG=$(cat .version 2> /dev/null) && [ -n "$VALID_TAG" ] || (echo 'No release tag - exiting'; exit 0)
- |
wget https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -qO /bin/jq
chmod +x /bin/jq
- |
/bin/jq '.auths["https://index.docker.io/v1/"].auth="'"$(echo -n $DOCKER_USERNAME':'$DOCKER_PASSWORD | base64)"'"' --null-input > /kaniko/.docker/config.json
- |
/kaniko/executor \
--dockerfile=Dockerfile \
--context=dir://. \
--destination=docker.io/djpbessems/json-server:latest \
--destination=docker.io/djpbessems/json-server:$VALID_TAG
environment:
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
- name: Helm chart (Gitea)
depends_on:
- Semantic Release (Dry-run)
image: bv11-cr01.bessems.eu/proxy/alpine/helm
pull: always
commands:
- |
export VALID_TAG=$(cat .version 2> /dev/null) && [ -n "$VALID_TAG" ] || (echo 'No release tag - exiting'; exit 0)
sed -i 's/{{ chart_version }}/'$VALID_TAG'/g' charts/json-server/Chart.yaml
sed -i 's/{{ image_tag }}/'$VALID_TAG'/g' charts/json-server/values.yaml
- |
helm package ./charts/json-server
- |
helm plugin install https://github.com/chartmuseum/helm-push
- |
helm repo add \
--username $GIT_USERNAME \
--password $GIT_APIKEY \
spamasaurus \
https://code.spamasaurus.com/api/packages/$GIT_USERNAME/helm
- |
helm cm-push \
json-server-*.tgz \
spamasaurus
environment:
GIT_APIKEY:
from_secret: git_apikey
GIT_USERNAME: djpbessems
- name: Semantic Release
depends_on:
- Container image (Harbor)
- Container image (docker.io)
- Helm chart (Gitea)
image: bv11-cr01.bessems.eu/proxy/library/node:20-slim
pull: always
commands:
- |
export VALID_TAG=$(cat .version 2> /dev/null) && [ -n "$VALID_TAG" ] || (echo 'No release tag - exiting'; exit 0)
- |
apt-get update
- |
apt-get install -y --no-install-recommends \
git-core \
ca-certificates
- |
npm install \
semantic-release \
@semantic-release/changelog \
@semantic-release/commit-analyzer \
@semantic-release/git \
@semantic-release/release-notes-generator
- |
export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY}
- |
npx semantic-release \
--branches ${DRONE_BRANCH} \
--tag-format "v\$${version}" \
--plugins @semantic-release/commit-analyzer,@semantic-release/release-notes-generator,@semantic-release/changelog,@semantic-release/git
environment:
GIT_APIKEY:
from_secret: git_apikey

27
CHANGELOG.md Normal file
View File

@ -0,0 +1,27 @@
## [0.7.3](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.7.2...v0.7.3) (2023-07-14)
### Bug Fixes
* Missing period in chart template ([0999fdf](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/commit/0999fdf7051d6e8a2161333980bd1aedd9f180ef))
## [0.7.2](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.7.1...v0.7.2) (2023-07-14)
### Bug Fixes
* Adhere to naming convention in templates ([c551a24](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/commit/c551a242c7a49a445da68ba6e1e5966eeb5ce7d7))
## [0.7.1](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.7.0...v0.7.1) (2023-07-14)
### Bug Fixes
* Adhere to naming convention in values.yaml ([614fda9](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/commit/614fda9b7d284862bd84a1eab62ba8144f798199))
# [0.7.0](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/compare/v0.6.0...v0.7.0) (2023-07-14)
### Features
* Add sidecar for continuous polling ([806757a](https://code.spamasaurus.com/djpbessems/ContainerImage.JSONServer/commit/806757a9135341d919b31d4183a84e3870c24f3f))

View File

@ -1,6 +1,6 @@
FROM node:latest
FROM node:lts-slim AS build
RUN npm install -g --no-optional --omit=dev \
RUN npm install -g --omit=optional --omit=dev \
json-server && \
npm cache clean --force

View File

@ -6,10 +6,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v0.5.3
version: v{{ chart_version }}
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.5.3"
appVersion: "v{{ chart_version }}"

View File

@ -0,0 +1,8 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Release.Name }}-clusterrole
rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "list"]

View File

@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ .Release.Name }}-clusterrolebinding
subjects:
- kind: ServiceAccount
name: {{ include "json-server.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
roleRef:
kind: ClusterRole
name: {{ .Release.Name }}-clusterrole
apiGroup: rbac.authorization.k8s.io

View File

@ -1,4 +1,4 @@
{{- if not .Values.seedData.existingConfigMap }}
{{- if not .Values.jsonServer.seedData.existingConfigMap }}
apiVersion: v1
kind: ConfigMap
metadata:
@ -55,5 +55,5 @@ data:
</body>
</html>
db.json: |
{{ include "common.tplvalues.render" ( dict "value" .Values.seedData.configInline "context" $) | indent 4 }}
{{ include "common.tplvalues.render" ( dict "value" .Values.jsonServer.seedData.configInline "context" $) | indent 4 }}
{{- end -}}

View File

@ -29,8 +29,8 @@ spec:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
image: "{{ .Values.jsonServer.image.repository }}:{{ .Values.jsonServer.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.jsonServer.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
@ -52,6 +52,17 @@ spec:
- name: {{ .Release.Name }}-configmap
mountPath: /usr/local/lib/node_modules/json-server/public/index.html
subPath: index.html
- name: {{ .Chart.Name }}-sidecar
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.sidecar.image.repository }}:{{ .Values.sidecar.image.tag }}"
imagePullPolicy: {{ .Values.sidecar.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
command:
- /bin/sh
- -c
- sleep infinity
volumes:
- name: {{ .Release.Name }}-configmap
configMap:

View File

@ -1,18 +1,25 @@
# Default values for json-server.
seedData:
# Not implemented yet
# existingConfigMap: ""
configInline: {}
jsonServer:
seedData:
# Not implemented yet
# existingConfigMap: ""
configInline: {}
image:
repository: bv11-cr01.bessems.eu/library/json-server
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: {{ image_tag }}
sidecar:
image:
repository: alpine/helm
pullPolicy: IfNotPresent
tag: 3.12.1
replicaCount: 1
image:
repository: bv11-cr01.bessems.eu/library/json-server
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: latest
imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

6923
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

10
package.json Normal file
View File

@ -0,0 +1,10 @@
{
"dependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/commit-analyzer": "^10.0.1",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/release-notes-generator": "^11.0.4",
"semantic-release": "^21.0.7"
}
}