diff --git a/deployments/hook-bot.yaml b/deployments/hook-bot.yaml index 708a22e..378d1e0 100644 --- a/deployments/hook-bot.yaml +++ b/deployments/hook-bot.yaml @@ -17,7 +17,7 @@ spec: spec: containers: - name: tekton-hook-bot - image: 192.168.1.128:8443/tekton-hooks-bot:0.7 + image: 192.168.1.128:8443/tekton-hooks-bot:0.8 env: - name: LISTEN_ADDR value: 0.0.0.0:3000 diff --git a/images/Dockerfile_j7s-image-build b/images/Dockerfile_j7s-image-build index 68eedc8..019c52a 100644 --- a/images/Dockerfile_j7s-image-build +++ b/images/Dockerfile_j7s-image-build @@ -1,7 +1,7 @@ FROM quay.io/centos/centos:stream9 RUN dnf install -y 'dnf-command(copr)' && \ dnf copr enable -y @osbuild/osbuild && \ - dnf install -y osbuild osbuild-tools osbuild-ostree make sudo + dnf install -y osbuild osbuild-tools osbuild-ostree make sudo git RUN useradd -m -G wheel -s /bin/bash -u 1000 j7s && \ bash -c 'echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/container' && \ chmod 0440 /etc/sudoers.d/container diff --git a/pipelines/j7s-os-pipeline.yaml b/pipelines/j7s-os-pipeline.yaml index 5b82b7a..39ef988 100644 --- a/pipelines/j7s-os-pipeline.yaml +++ b/pipelines/j7s-os-pipeline.yaml @@ -3,7 +3,7 @@ # Clone the j7s-os repo from gitea. # Call make <> in the repo. # Build and push a new deployment container. -# Deply the deployment container as a service. +# Deploy the deployment container as a service. --- apiVersion: tekton.dev/v1beta1 kind: Pipeline @@ -12,9 +12,12 @@ metadata: spec: description: Build and deploy j7s-os images. params: - - name: image-name + - name: make-image-name type: string - description: The name of the os image to build. + description: The name of image to make in the os repo. + - name: short-name + type: string + description: A short name for this image from which other names a derived. (aka j7-os) workspaces: - name: shared-data description: Shared data. @@ -34,36 +37,40 @@ spec: value: main taskRef: name: j7s-git-clone - - name: call-make + - name: image-build runAfter: ["fetch-repo"] workspaces: - name: source workspace: shared-data params: - name: image-name - value: $(params.image-name) + value: $(params.make-image-name) taskRef: name: j7s-os-image-build - name: build-deploy-image - runAfter: ["call-make"] + runAfter: ["image-build"] workspaces: - name: source workspace: shared-data params: - name: commit - value: $(params.image-name) + value: $(params.make-image-name) - name: image - value: j7s-os-deploy:latest + value: $(params.short-name)-deploy - name: registry value: 192.168.1.128:8443 + - name: version + value: $(tasks.image-build.results.version-string) taskRef: name: j7s-os-buildah - name: patch-deployment runAfter: ["build-deploy-image"] params: - name: deployment - value: j7s-os-app-deployment + value: $(params.short-name)-app-deployment - name: image - value: 192.168.1.128:8443/j7s-os-deploy:latest + value: 192.168.1.128:8443/$(params.short-name)-deploy + - name: version + value: $(tasks.image-build.results.version-string) taskRef: name: j7s-os-k8s-deploy \ No newline at end of file diff --git a/runs/j7s-os-test.yaml b/runs/j7s-os-test.yaml index e3d8b3d..39a9a2e 100644 --- a/runs/j7s-os-test.yaml +++ b/runs/j7s-os-test.yaml @@ -18,6 +18,8 @@ spec: secret: secretName: git-credentials params: - - name: image-name + - name: make-image-name value: cs9-qemu-minimal-ostree.x86_64.repo + - name: short-name + value: j7s-os serviceAccountName: internal-kubectl \ No newline at end of file diff --git a/tasks/j7s-os-buildah.yaml b/tasks/j7s-os-buildah.yaml index bb0d9bc..cb0dd6f 100644 --- a/tasks/j7s-os-buildah.yaml +++ b/tasks/j7s-os-buildah.yaml @@ -12,6 +12,8 @@ spec: description: Repo directory to put inside the image. - name: registry description: Registry to push to. + - name: version + description: Version for the image. workspaces: - name: source steps: @@ -25,9 +27,9 @@ spec: # Build buildah --storage-driver=overlay bud --tls-verify=false --no-cache \ --build-arg commit=./$(params.commit) \ - -f ./hosting/Dockerfile -t $(params.image) . + -f ./hosting/Dockerfile -t $(params.image):$(params.version) . # Push - buildah --storage-driver=overlay push --tls-verify=false $(params.image) docker://$(params.registry)/$(params.image) + buildah --storage-driver=overlay push --tls-verify=false $(params.image) docker://$(params.registry)/$(params.image):$(params.version) env: - name: USERNAME valueFrom: diff --git a/tasks/j7s-os-image-build.yaml b/tasks/j7s-os-image-build.yaml index 5feb5d1..b83f65a 100644 --- a/tasks/j7s-os-image-build.yaml +++ b/tasks/j7s-os-image-build.yaml @@ -7,6 +7,8 @@ spec: - name: source params: - name: image-name + results: + - name: version-string steps: - image: 192.168.1.128:8443/j7s-image-build:latest securityContext: @@ -15,4 +17,5 @@ spec: set -x sudo chown -R j7s:j7s $(workspaces.source.path) cd $(workspaces.source.path) - make $(params.image-name) \ No newline at end of file + make $(params.image-name) + echo -n `date +%Y%m%d%H%M`-`git describe --no-match --always --dirty` | tee $(results.version-string.path) \ No newline at end of file diff --git a/tasks/j7s-os-k8s-deploy.yaml b/tasks/j7s-os-k8s-deploy.yaml index b12ed24..e25d245 100644 --- a/tasks/j7s-os-k8s-deploy.yaml +++ b/tasks/j7s-os-k8s-deploy.yaml @@ -8,6 +8,8 @@ spec: description: The name of the deployment to patch. - name: image description: The image to deploy. + - name: version + description: The version of the image to deploy. steps: - name: kubectl image: gcr.io/cloud-builders/kubectl@sha256:c855d060ac961bc7e6bff42d6b9d9ebebee304eca4cce4a2202e51a5da26c043 @@ -21,5 +23,5 @@ spec: spec: containers: - name: j7s-os-app - image: $(params.image) + image: $(params.image):$(params.version) EOF \ No newline at end of file