general cleanup of j7s-os tasks. Prep hookbot.

This commit is contained in:
James Pace 2022-10-18 20:22:09 -04:00
parent 9b26d06dd2
commit 510e1aa85a
7 changed files with 33 additions and 17 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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)
make $(params.image-name)
echo -n `date +%Y%m%d%H%M`-`git describe --no-match --always --dirty` | tee $(results.version-string.path)

View File

@ -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