From 6c791e0492fd00a0bedf3c9813185e4a2285af4a Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Fri, 23 Dec 2022 15:10:41 +0100 Subject: [PATCH] feat(ci): add Concourse pipeline --- .concourse/pipeline.yml | 39 ++++++++++++++++++++++++++++++++++++++ .concourse/tasks/image.yml | 28 +++++++++++++++++++++++++++ Dockerfile | 4 ++-- deploy/helm/values.yaml | 2 +- 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 .concourse/pipeline.yml create mode 100644 .concourse/tasks/image.yml diff --git a/.concourse/pipeline.yml b/.concourse/pipeline.yml new file mode 100644 index 0000000..36dbcbb --- /dev/null +++ b/.concourse/pipeline.yml @@ -0,0 +1,39 @@ +--- +resource_types: +- name: helm + type: docker-image + source: + repository: ghcr.io/typositoire/concourse-helm3-resource + +resources: +- name: blog.git + type: git + icon: github + source: + uri: https://code.icb4dc0.de/prskr/blog.git + +- name: blog-chart + type: helm + source: + cluster_url: ((k8s-credentials.url)) + cluster_ca: ((k8s-credentials.ca-crt)) + token: ((k8s-credentials.token)) + release: blog + namespace: blog + +jobs: +- name: build + plan: + - get: blog.git + trigger: true + - task: build-container-image + file: blog.git/.concourse/tasks/image.yml + input_mapping: {repo: blog.git} + + - put: blog-chart + params: + chart: blog.git/deploy/helm + override_values: + - key: image.tag + path: blog.git/.git/refs/heads/main + type: string \ No newline at end of file diff --git a/.concourse/tasks/image.yml b/.concourse/tasks/image.yml new file mode 100644 index 0000000..7e29e68 --- /dev/null +++ b/.concourse/tasks/image.yml @@ -0,0 +1,28 @@ +--- +platform: linux + +image_resource: + name: kaniko-debug + type: registry-image + source: + repository: gcr.io/kaniko-project/executor + tag: debug + +inputs: + - name: repo + path: . + +params: + GITEA_USER: ((gitea-credentials.user)) + GITEA_TOKEN: ((gitea-credentials.token)) + +run: + path: sh + args: + - -ce + - | + echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $GITEA_USER $GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json + /kaniko/executor \ + --destination code.icb4dc0.de/prskr/blog:latest \ + --destination code.icb4dc0.de/prskr/blog:$(cat .git/refs/heads/main) \ + --context . \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 4560987..8cb120b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,10 @@ FROM docker.io/alpine:latest as builder WORKDIR /src -COPY . ./ +COPY . /src/ RUN apk add -U hugo && \ - hugo --minify --environment production + hugo --minify --environment production --config config.toml FROM docker.io/caddy:2-alpine diff --git a/deploy/helm/values.yaml b/deploy/helm/values.yaml index b1719d2..c4c82c9 100644 --- a/deploy/helm/values.yaml +++ b/deploy/helm/values.yaml @@ -2,7 +2,7 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. -replicaCount: 1 +replicaCount: 2 image: repository: code.icb4dc0.de/prskr/blog