You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.7 KiB

Automatically derive defaults versions from checksums (#11906) * Automatically derive defaults versions from checksums Currently, when updating checksums, we manually update the default versions. However, AFAICT, for all components where we have checksums, we're using the newest version out of those checksums. Codify this in the `_version` defaults variables definition to make the process automatic and reduce manual steps (as well as the diff size during reviews). We assume the versions are sorted, with newest first. This should be guaranteed by the pre-commit hooks. * Validate checksums are ordered by versions, newest first * Generalize render-readme-versions hook for other static files The pre-commit hook introduced a142f40e2 (Update versions in README.md with pre-commit, 2025-01-21) allow to update our README with new versions. It turns out other "static" files (== which don't interpret Ansible variables) also use the default version (in that case, our Dockefiles, but there might be others) The Dockerfile breaks if the variable they use (`kube_version`) is a Jinja template. For helping with automatic version upgrade, generalize the hook to deal with other static files, and make a template out of the Dockerfile. * Dockerfile: template kube_version with pre-commit instead of runtime * Validate all versions/checksums are strings in pre-commit All the ansible/python tooling for version is for version strings. YAML unhelpfully consider some stuff as number, so enforce this. * Stringify checksums versions
2 weeks ago
  1. # syntax=docker/dockerfile:1
  2. # Use imutable image tags rather than mutable tags (like ubuntu:22.04)
  3. FROM ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37
  4. # Some tools like yamllint need this
  5. # Pip needs this as well at the moment to install ansible
  6. # (and potentially other packages)
  7. # See: https://github.com/pypa/pip/issues/10219
  8. ENV LANG=C.UTF-8 \
  9. DEBIAN_FRONTEND=noninteractive \
  10. PYTHONDONTWRITEBYTECODE=1
  11. WORKDIR /kubespray
  12. # hadolint ignore=DL3008
  13. RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
  14. apt-get update -q \
  15. && apt-get install -yq --no-install-recommends \
  16. curl \
  17. python3 \
  18. python3-pip \
  19. sshpass \
  20. vim \
  21. rsync \
  22. openssh-client \
  23. && apt-get clean \
  24. && rm -rf /var/lib/apt/lists/* /var/log/*
  25. RUN --mount=type=bind,source=requirements.txt,target=requirements.txt \
  26. --mount=type=cache,sharing=locked,id=pipcache,mode=0777,target=/root/.cache/pip \
  27. pip install --no-compile --no-cache-dir -r requirements.txt \
  28. && find /usr -type d -name '*__pycache__' -prune -exec rm -rf {} \;
  29. SHELL ["/bin/bash", "-o", "pipefail", "-c"]
  30. RUN OS_ARCHITECTURE=$(dpkg --print-architecture) \
  31. && curl -L "https://dl.k8s.io/release/v1.32.0/bin/linux/${OS_ARCHITECTURE}/kubectl" -o /usr/local/bin/kubectl \
  32. && echo "$(curl -L "https://dl.k8s.io/release/v1.32.0/bin/linux/${OS_ARCHITECTURE}/kubectl.sha256")" /usr/local/bin/kubectl | sha256sum --check \
  33. && chmod a+x /usr/local/bin/kubectl
  34. COPY *.yml ./
  35. COPY *.cfg ./
  36. COPY roles ./roles
  37. COPY contrib ./contrib
  38. COPY inventory ./inventory
  39. COPY library ./library
  40. COPY extra_playbooks ./extra_playbooks
  41. COPY playbooks ./playbooks
  42. COPY plugins ./plugins