Initial copy and move of initial tasks.
This commit is contained in:
commit
7d24fd9c5e
15 files changed
+342
No files matched your search
@@ -0,0 +1,55 @@
|
||||
---
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: j7s-os-buildah
|
||||
namespace: j7s-ci
|
||||
spec:
|
||||
description: Build the deployment container image for j7s-os.
|
||||
params:
|
||||
- name: image
|
||||
description: Reference of the image buildah will produce.
|
||||
- name: commit
|
||||
description: Repo directory to put inside the image.
|
||||
- name: registry
|
||||
description: Registry to push to.
|
||||
- name: version
|
||||
description: Version for the image.
|
||||
- name: registry-secret-name
|
||||
description: Name of secret to get credentials for registry from.
|
||||
workspaces:
|
||||
- name: source
|
||||
steps:
|
||||
- name: build
|
||||
image: quay.io/buildah/stable:v1.23.3
|
||||
workingDir: $(workspaces.source.path)
|
||||
script: |
|
||||
set -x
|
||||
# Login
|
||||
buildah login --tls-verify=false --username=$USERNAME --password=$PASSWORD $(params.registry)
|
||||
# Build
|
||||
buildah --storage-driver=overlay bud --tls-verify=false --no-cache \
|
||||
--build-arg commit=./$(params.commit) \
|
||||
-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:
|
||||
secretKeyRef:
|
||||
name: $(params.registry-login-secret-name)
|
||||
key: username
|
||||
- name: PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: $(params.registry-login-secret-name)
|
||||
key: password
|
||||
volumeMounts:
|
||||
- name: varlibcontainers
|
||||
mountPath: /var/lib/containers
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: varlibcontainers
|
||||
emptyDir: {}
|
||||
@@ -0,0 +1,22 @@
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
metadata:
|
||||
name: j7s-os-image-build
|
||||
namespace: j7s-ci
|
||||
spec:
|
||||
workspaces:
|
||||
- name: source
|
||||
params:
|
||||
- name: image-name
|
||||
results:
|
||||
- name: version-string
|
||||
steps:
|
||||
- image: harbor.internal.jpace121.net/j7s-image-build:latest
|
||||
securityContext:
|
||||
privileged: true
|
||||
script: |
|
||||
set -x
|
||||
sudo chown -R j7s:j7s $(workspaces.source.path)
|
||||
cd $(workspaces.source.path)
|
||||
make $(params.image-name)
|
||||
echo -n `date +%Y%m%d%H%M`-`git describe --no-match --always --dirty` | tee $(results.version-string.path)
|
||||
@@ -0,0 +1,47 @@
|
||||
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: harbor.internal.jpace121.net/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@git.jpace121.net:2222/cd/flux-apps.git 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 HEAD:refs/for/master \
|
||||
-o title="Update j7s-os-deploy to version $(params.version)" \
|
||||
-o topic="j7s-os-deploy-$(params.version)"
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- j7s-os-buildah.yaml
|
||||
- j7s-os-image-build.yaml
|
||||
- j7s-os-k8s-deploy.yaml
|
||||
Reference in new issue
Block a user