From 87721da198504ba9850455ca42f645e6605c31a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Sun, 31 Jul 2022 21:29:08 +0900 Subject: [PATCH] Use Concourse CI --- concourse/build.yaml | 24 +++++++++++++++++++++ concourse/prepare-deployment-resources.yaml | 21 ++++++++++++++++++ k8s/deployments.yaml | 4 ++-- 3 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 concourse/build.yaml create mode 100644 concourse/prepare-deployment-resources.yaml diff --git a/concourse/build.yaml b/concourse/build.yaml new file mode 100644 index 0000000..ca9a9b4 --- /dev/null +++ b/concourse/build.yaml @@ -0,0 +1,24 @@ +platform: linux + +image_resource: + type: registry-image + source: + repository: concourse/oci-build-task + +inputs: + - name: project-src + path: . + +outputs: + - name: image + +caches: + - path: cache + +params: + CONTEXT: . + # Reference: https://concourse-ci.org/building-an-image-and-using-it-in-a-task.html#build-the-image + UNPACK_ROOTFS: true + +run: + path: build diff --git a/concourse/prepare-deployment-resources.yaml b/concourse/prepare-deployment-resources.yaml new file mode 100644 index 0000000..ab371da --- /dev/null +++ b/concourse/prepare-deployment-resources.yaml @@ -0,0 +1,21 @@ +platform: linux + +image_resource: + type: registry-image + source: + repository: alpine + +inputs: + - name: project-src + path: . + +outputs: + - name: deploy-confs + +run: + path: sh + args: + - -exc + - | + VERSION=$( cat commit.sha ) + sed "s/IMAGE_TAG/$VERSION/g" k8s/deployments.yaml >> deploy-confs/prod.yaml diff --git a/k8s/deployments.yaml b/k8s/deployments.yaml index f3e25f1..83d9f9a 100644 --- a/k8s/deployments.yaml +++ b/k8s/deployments.yaml @@ -26,7 +26,7 @@ spec: mountPath: "/app/cache" containers: - name: web - image: registry.k8s.astropenguin.net/astrojs:2022.04.19 + image: registry.k8s.astropenguin.net/astrojs:IMAGE_TAG securityContext: runAsGroup: 1001 runAsNonRoot: true @@ -54,7 +54,7 @@ spec: - name: redis image: redis:6.0.8-alpine - name: compiler - image: registry.k8s.astropenguin.net/astrojs:2022.04.19 + image: registry.k8s.astropenguin.net/astrojs:IMAGE_TAG securityContext: runAsGroup: 1001 runAsNonRoot: true