---
apiVersion: batch/v1
kind: CronJob
metadata:
  name: gh-gl-sync
  namespace: custom
spec:
  schedule: "*/4 * * * *"
  jobTemplate:
    spec:
      backoffLimit: 0
      template:
        spec:
          serviceAccountName: gh-gl-sync
          restartPolicy: Never
          containers:
          - name: sync
            image: ghcr.io/spack/ci-bridge:0.0.28
            imagePullPolicy: IfNotPresent
            env:
            - name: GITHUB_TOKEN
              valueFrom:
                secretKeyRef:
                  name: gh-gl-sync
                  key: github-access-token
            # This secret is double base64 encoded
            - name: GITLAB_SSH_KEY_BASE64
              valueFrom:
                secretKeyRef:
                  name: gh-gl-sync
                  key: gitlab-ssh-key
            args:
              - "spack/spack"
              - "ssh://git@ssh.gitlab.spack.io/spack/spack"
              - "https://gitlab.spack.io"
              - "spack/spack"
              - "--pr-mirror-bucket"
              - "spack-binaries-prs"
              - "--main-branch"
              - "develop"
              - "--prereq-check"
              - "style"
          nodeSelector:
            spack.io/node-pool: base
