Integrate j7s-os deployment with flux.

This commit is contained in:
James Pace 2023-01-30 22:27:50 -05:00
parent 8663653ec3
commit c5d15bcaa6
4 changed files with 60 additions and 7 deletions

View File

@ -16,9 +16,6 @@ spec:
- name: make-image-name
type: string
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)
- name: branch
type: string
default: main
@ -61,10 +58,22 @@ spec:
- name: commit
value: $(params.make-image-name)
- name: image
value: $(params.short-name)-deploy
value: j7s-os-deploy
- name: registry
value: 192.168.1.128:8443
- name: version
value: $(tasks.image-build.results.version-string)
taskRef:
name: j7s-os-buildah
name: j7s-os-buildah
- name: deploy-image
runAfter: ["build-deploy-image"]
workspaces:
- name: ssh-directory
workspace: git-credentials
params:
- name: image
value: 192.168.1.128:8443/j7s-os-deploy
- name: version
value: $(tasks.image-build.results.version-string)
taskRef:
name: j7s-os-k8s-deploy

View File

@ -21,7 +21,5 @@ spec:
params:
- name: make-image-name
value: cs9-qemu-minimal-ostree.x86_64.repo
- name: short-name
value: j7s-os
- name: branch
value: main

View File

@ -31,6 +31,7 @@ spec:
-f ./hosting/Dockerfile -t $(params.image):$(params.version) .
# Push
buildah --storage-driver=overlay push --tls-verify=false $(params.image) docker://$(params.registry)/$(params.image):$(params.version)
buildah --storage-driver=overlay push --tls-verify=false $(params.image) docker://$(params.registry)/$(params.image):latest
env:
- name: USERNAME
valueFrom:

View File

@ -0,0 +1,45 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: j7s-os-k8s-deploy
namespace: j7s-ci
spec:
params:
- name: image
description: The image to deploy.
- name: version
description: The version of the image to deploy.
workspaces:
- name: ssh-directory
steps:
- name: update-with-flux
image: 192.168.1.128:8443/gitssh:latest
script: |
#!/usr/bin/env bash
set -x
cp -r $(workspaces.ssh-directory.path) ~/.ssh
chmod 700 ~/.ssh
chmod -R 400 ~/.ssh/*
git config --global user.name tekton
git config --global user.email tekton@internal.jpace121.net
git clone ssh://git.jpace121.net:2222/cd/flux-apps flux-apps
cd flux-apps
cat <<EOF > j7s-os-deploy/patch.yaml
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: j7s-os-app-deployment
spec:
template:
spec:
containers:
- name: j7s-os-app
image: $(params.image):$(params.version)
EOF
git add ./j7s-os-deploy
git commit -m "Update j7s-os-deploy to version $(params.version)"
git push origin master