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: spec:
containers: containers:
- name: tekton-hook-bot - 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: env:
- name: LISTEN_ADDR - name: LISTEN_ADDR
value: 0.0.0.0:3000 value: 0.0.0.0:3000

View File

@ -1,7 +1,7 @@
FROM quay.io/centos/centos:stream9 FROM quay.io/centos/centos:stream9
RUN dnf install -y 'dnf-command(copr)' && \ RUN dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y @osbuild/osbuild && \ 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 && \ RUN useradd -m -G wheel -s /bin/bash -u 1000 j7s && \
bash -c 'echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/container' && \ bash -c 'echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers.d/container' && \
chmod 0440 /etc/sudoers.d/container chmod 0440 /etc/sudoers.d/container

View File

@ -3,7 +3,7 @@
# Clone the j7s-os repo from gitea. # Clone the j7s-os repo from gitea.
# Call make <> in the repo. # Call make <> in the repo.
# Build and push a new deployment container. # 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 apiVersion: tekton.dev/v1beta1
kind: Pipeline kind: Pipeline
@ -12,9 +12,12 @@ metadata:
spec: spec:
description: Build and deploy j7s-os images. description: Build and deploy j7s-os images.
params: params:
- name: image-name - name: make-image-name
type: string 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: workspaces:
- name: shared-data - name: shared-data
description: Shared data. description: Shared data.
@ -34,36 +37,40 @@ spec:
value: main value: main
taskRef: taskRef:
name: j7s-git-clone name: j7s-git-clone
- name: call-make - name: image-build
runAfter: ["fetch-repo"] runAfter: ["fetch-repo"]
workspaces: workspaces:
- name: source - name: source
workspace: shared-data workspace: shared-data
params: params:
- name: image-name - name: image-name
value: $(params.image-name) value: $(params.make-image-name)
taskRef: taskRef:
name: j7s-os-image-build name: j7s-os-image-build
- name: build-deploy-image - name: build-deploy-image
runAfter: ["call-make"] runAfter: ["image-build"]
workspaces: workspaces:
- name: source - name: source
workspace: shared-data workspace: shared-data
params: params:
- name: commit - name: commit
value: $(params.image-name) value: $(params.make-image-name)
- name: image - name: image
value: j7s-os-deploy:latest value: $(params.short-name)-deploy
- name: registry - name: registry
value: 192.168.1.128:8443 value: 192.168.1.128:8443
- name: version
value: $(tasks.image-build.results.version-string)
taskRef: taskRef:
name: j7s-os-buildah name: j7s-os-buildah
- name: patch-deployment - name: patch-deployment
runAfter: ["build-deploy-image"] runAfter: ["build-deploy-image"]
params: params:
- name: deployment - name: deployment
value: j7s-os-app-deployment value: $(params.short-name)-app-deployment
- name: image - 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: taskRef:
name: j7s-os-k8s-deploy name: j7s-os-k8s-deploy

View File

@ -18,6 +18,8 @@ spec:
secret: secret:
secretName: git-credentials secretName: git-credentials
params: params:
- name: image-name - name: make-image-name
value: cs9-qemu-minimal-ostree.x86_64.repo value: cs9-qemu-minimal-ostree.x86_64.repo
- name: short-name
value: j7s-os
serviceAccountName: internal-kubectl serviceAccountName: internal-kubectl

View File

@ -12,6 +12,8 @@ spec:
description: Repo directory to put inside the image. description: Repo directory to put inside the image.
- name: registry - name: registry
description: Registry to push to. description: Registry to push to.
- name: version
description: Version for the image.
workspaces: workspaces:
- name: source - name: source
steps: steps:
@ -25,9 +27,9 @@ spec:
# Build # Build
buildah --storage-driver=overlay bud --tls-verify=false --no-cache \ buildah --storage-driver=overlay bud --tls-verify=false --no-cache \
--build-arg commit=./$(params.commit) \ --build-arg commit=./$(params.commit) \
-f ./hosting/Dockerfile -t $(params.image) . -f ./hosting/Dockerfile -t $(params.image):$(params.version) .
# Push # 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: env:
- name: USERNAME - name: USERNAME
valueFrom: valueFrom:

View File

@ -7,6 +7,8 @@ spec:
- name: source - name: source
params: params:
- name: image-name - name: image-name
results:
- name: version-string
steps: steps:
- image: 192.168.1.128:8443/j7s-image-build:latest - image: 192.168.1.128:8443/j7s-image-build:latest
securityContext: securityContext:
@ -15,4 +17,5 @@ spec:
set -x set -x
sudo chown -R j7s:j7s $(workspaces.source.path) sudo chown -R j7s:j7s $(workspaces.source.path)
cd $(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. description: The name of the deployment to patch.
- name: image - name: image
description: The image to deploy. description: The image to deploy.
- name: version
description: The version of the image to deploy.
steps: steps:
- name: kubectl - name: kubectl
image: gcr.io/cloud-builders/kubectl@sha256:c855d060ac961bc7e6bff42d6b9d9ebebee304eca4cce4a2202e51a5da26c043 image: gcr.io/cloud-builders/kubectl@sha256:c855d060ac961bc7e6bff42d6b9d9ebebee304eca4cce4a2202e51a5da26c043
@ -21,5 +23,5 @@ spec:
spec: spec:
containers: containers:
- name: j7s-os-app - name: j7s-os-app
image: $(params.image) image: $(params.image):$(params.version)
EOF EOF