job.yaml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. apiVersion: batch/v1
  2. kind: Job
  3. metadata:
  4. name: maintenance-nix-build-container-vendir
  5. annotations:
  6. # Setting spec.force to true will make Flux recreate the Job when any
  7. # immutable field is changed, forcing the Job to run every time the
  8. # container image tag changes.
  9. kustomize.toolkit.fluxcd.io/force: enabled
  10. spec:
  11. backoffLimit: 0
  12. template:
  13. spec:
  14. hostNetwork: true
  15. hostPID: true
  16. restartPolicy: Never
  17. containers:
  18. - command:
  19. - /bin/sh
  20. - -c
  21. - |
  22. nsenter --target "1" --mount --uts --ipc --net --pid --no-fork \
  23. /run/setuid-programs/sudo --user=oleg --login bash <<'EOF'
  24. set -o nounset -o errexit -o pipefail -o xtrace
  25. cd "${HOME}/.local/share/chezmoi" || exit 1
  26. cd dotfiles/nix/vendir || exit 1
  27. out="$(nix build --no-link --print-out-paths --print-build-logs)"
  28. skopeo copy "docker-archive:${out}" "docker://harbor.home.wugi.info/library/vendir:latest"
  29. EOF
  30. image: docker-registry.wugi.info/library/util-linux-with-udev
  31. name: refresh
  32. resources:
  33. limits:
  34. cpu: 14000m
  35. memory: 4096Mi
  36. requests:
  37. cpu: 50m
  38. memory: 512Mi
  39. securityContext:
  40. privileged: true