diff --git a/buildchain/buildchain/config.py b/buildchain/buildchain/config.py index 4647cd8456..05f3bb2ce7 100644 --- a/buildchain/buildchain/config.py +++ b/buildchain/buildchain/config.py @@ -17,7 +17,7 @@ from buildchain import ROOT -# /!\ All the global defined here must be documented in BUILDING.md /!\ +# /!\ All the global defined here must be documented in docs/developer/building/configuration.rst /!\ # Project name. @@ -58,14 +58,11 @@ class ExtCommand(enum.Enum): GIT = os.getenv("GIT_BIN", "git") GOFMT = os.getenv("GOFMT_BIN", "gofmt") HARDLINK = os.getenv("HARDLINK_BIN", "hardlink") - HELM = os.getenv("HELM_BIN", "helm") IMPLANTISOMD5 = os.getenv("IMPLANTISOMD5_BIN", "implantisomd5") MAKE = os.getenv("MAKE_BIN", "make") MKISOFS = os.getenv("MKISOFS_BIN", "mkisofs") SKOPEO = os.getenv("SKOPEO_BIN", "skopeo") - TOX = os.getenv("TOX_BIN", "tox") VAGRANT = os.getenv("VAGRANT_BIN", "vagrant") - KUSTOMIZE = os.getenv("KUSTOMIZE_BIN", "kustomize") @property def command_name(self) -> str: diff --git a/buildchain/buildchain/iso.py b/buildchain/buildchain/iso.py index dc7fd6a0b4..d2b2197d2d 100644 --- a/buildchain/buildchain/iso.py +++ b/buildchain/buildchain/iso.py @@ -52,11 +52,12 @@ FILE_TREES: Tuple[helper.FileTree, ...] = ( helper.FileTree( basename="_iso_add_tree", + source_prefix=Path("examples"), files=( - Path("examples/new-node.yaml"), - Path("examples/new-node_vagrant.yaml"), - Path("examples/prometheus-sparse.yaml"), - Path("examples/loki-sparse.yaml"), + Path("new-node.yaml"), + Path("new-node_vagrant.yaml"), + Path("prometheus-sparse.yaml"), + Path("loki-sparse.yaml"), ), destination_directory=constants.ISO_ROOT, task_dep=["_iso_mkdir_root"], @@ -131,7 +132,7 @@ "DEVELOPMENT_RELEASE": "1" if versions.VERSION_SUFFIX == "-dev" else "0", - "BUILD_TIMESTAMP": dt.datetime.utcnow().strftime( + "BUILD_TIMESTAMP": dt.datetime.now(dt.timezone.utc).strftime( "%Y-%m-%dT%H:%M:%SZ" ), "BUILD_HOST": socket.gethostname(), diff --git a/docs/developer/building/configuration.rst b/docs/developer/building/configuration.rst index 0b94108900..4acd848ab0 100644 --- a/docs/developer/building/configuration.rst +++ b/docs/developer/building/configuration.rst @@ -12,14 +12,14 @@ Available options are: - ``VAGRANT_PROVIDER``: type of machine to spawn with Vagrant - ``VAGRANT_UP_ARGS``: command line arguments to pass to ``vagrant up`` - ``VAGRANT_SNAPSHOT_NAME``: name of auto generated Vagrant snapshot -- ``DOCKER_BIN``: Docker binary (name or path to the binary) - ``GIT_BIN``: Git binary (name or path to the binary) +- ``GOFMT_BIN``: gofmt binary (name or path to the binary) - ``HARDLINK_BIN``: hardlink binary (name or path to the binary) +- ``IMPLANTISOMD5_BIN``: implantisomd5 binary (name or path to the binary) +- ``MAKE_BIN``: Make binary (name or path to the binary) - ``MKISOFS_BIN``: mkisofs binary (name or path to the binary) - ``SKOPEO_BIN``: skopeo binary (name or path to the binary) - ``VAGRANT_BIN``: Vagrant binary (name or path to the binary) -- ``GOFMT_BIN``: gofmt binary (name or path to the binary) -- ``OPERATOR_SDK_BIN``: the Operator SDK binary (name or path to the binary) Default settings are equivalent to the following ``.env``: @@ -29,11 +29,12 @@ Default settings are equivalent to the following ``.env``: export BUILD_ROOT=_build export VAGRANT_PROVIDER=virtualbox export VAGRANT_UP_ARGS="--provision --no-destroy-on-error --parallel --provider $VAGRANT_PROVIDER" - export DOCKER_BIN=docker - export HARDLINK_BIN=hardlink + export VAGRANT_SNAPSHOT_NAME=bootstrap.autosnapshot export GIT_BIN=git + export GOFMT_BIN=gofmt + export HARDLINK_BIN=hardlink + export IMPLANTISOMD5_BIN=implantisomd5 + export MAKE_BIN=make export MKISOFS_BIN=mkisofs export SKOPEO_BIN=skopeo export VAGRANT_BIN=vagrant - export GOFMT_BIN=gofmt - export OPERATOR_SDK_BIN=operator-sdk diff --git a/doit.sh b/doit.sh index 8234d159d3..8e7ee4c7b3 100755 --- a/doit.sh +++ b/doit.sh @@ -10,8 +10,8 @@ BUILDCHAIN=buildchain BUILDENV="${BUILDCHAIN}/.venv" # requirements.txt for the buildchain. REQUIREMENTS="${BUILDCHAIN}/requirements.txt" -# Dummy file to keep track of when the virtual environment was installed. -WITNESS_FILE="${BUILDENV}/installed.tstamp" +# Marker file defined by PEP 405 to keep track of when the venv was created. +MARKER_FILE="${BUILDENV}/pyvenv.cfg" # File containing environment variables. DOTENV=./.env @@ -30,6 +30,7 @@ then exit 1 fi +# Get unix timestamp (seconds since epoch) if [ "$OSTYPE" = "Darwin" ] then GET_FILE_STAMP='stat -f %m' @@ -39,15 +40,14 @@ fi # Can't use `[ file1 -nt file2 ]` directly because it's not POSIX :'( REQ_TSTAMP=$($GET_FILE_STAMP "${REQUIREMENTS}") -WIT_TSTAMP=$($GET_FILE_STAMP "${WITNESS_FILE}" 2> /dev/null || echo '0') +MKR_TSTAMP=$($GET_FILE_STAMP "${MARKER_FILE}" 2> /dev/null || echo '0') # Install/reinstall the virtual environment only if it either doesn't exist or # the requirements have changed since its creation. -if [ "${REQ_TSTAMP}" -gt "${WIT_TSTAMP}" ] +if [ "${REQ_TSTAMP}" -gt "${MKR_TSTAMP}" ] then "${PYTHON_SYS}" -m venv --clear "${BUILDENV}" "${BUILDENV}/bin/pip" install -r "${REQUIREMENTS}" - touch "${WITNESS_FILE}" fi # Load customized environment variables from dotenv file, if exists. @@ -57,4 +57,5 @@ then . "${DOTENV}" fi +# Run doit and pass all arguments to it. exec "${BUILDENV}/bin/python" -m doit "$@"