zuul-operator/playbooks/zuul-operator-functional/tasks/git_setup.yaml
James E. Blair 1b699279a4 Run a git server in k8s for functional tests
To make the functional tests easier to run locally, run a git server
in k8s instead of on the local machine.

Also, update the secret creation to work with kind as well as minikube.

Change-Id: I4c00129c7105405b0f6256e769486e79c0b173fe
2021-07-20 13:19:59 -07:00

62 lines
1.5 KiB
YAML

- name: setup gitconfig
shell: |
if ! test -f ~/.gitconfig && ! test -d ~/.config/git ; then
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
fi
- k8s:
namespace: default
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: git-server
spec:
replicas: 1
selector:
matchLabels:
app: git-server
template:
metadata:
labels:
app: git-server
spec:
volumes:
- name: git-repos
emptyDir: {}
containers:
- name: git-server
image: docker.io/sdelrio/git-daemon:latest
ports:
- containerPort: 9418
volumeMounts:
- name: git-repos
mountPath: /git
initContainers:
- name: init-config
image: docker.io/sdelrio/git-daemon:latest
command: ['/usr/bin/git', 'init', '--bare', '/git/config']
volumeMounts:
- name: git-repos
mountPath: /git
- k8s:
namespace: default
definition:
apiVersion: v1
kind: Service
metadata:
name: git-server
labels:
app: git-server
spec:
type: NodePort
ports:
- port: 9418
selector:
app: git-server
- name: Wait for scheduler deployment
command: timeout 10m kubectl rollout status deployment/git-server