diff --git a/pipelines/j7s-os-pipeline.yaml b/pipelines/j7s-os-pipeline.yaml index c142c39..1483453 100644 --- a/pipelines/j7s-os-pipeline.yaml +++ b/pipelines/j7s-os-pipeline.yaml @@ -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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/runs/j7s-os-test.yaml b/runs/j7s-os-test.yaml index 84e6467..a1e0d03 100644 --- a/runs/j7s-os-test.yaml +++ b/runs/j7s-os-test.yaml @@ -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 \ No newline at end of file diff --git a/tasks/j7s-os-buildah.yaml b/tasks/j7s-os-buildah.yaml index 605f90a..9fb2e67 100644 --- a/tasks/j7s-os-buildah.yaml +++ b/tasks/j7s-os-buildah.yaml @@ -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: diff --git a/tasks/j7s-os-k8s-deploy.yaml b/tasks/j7s-os-k8s-deploy.yaml new file mode 100644 index 0000000..e0807e6 --- /dev/null +++ b/tasks/j7s-os-k8s-deploy.yaml @@ -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 < 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 +