diff --git a/.config/dictionary.txt b/.config/dictionary.txt index 8eb0f19ec..aa774f21c 100644 --- a/.config/dictionary.txt +++ b/.config/dictionary.txt @@ -1,10 +1,30 @@ +ALS +Anson +Containerfile +Dockal +FQCN +FQCNs +Florian +Launay +Maciążek +OSTYPE +Ondrej +PYTHONBREAKPOINT +PYTHONHOME +Pinkney +Pyenv +Sbarnea +Schwalm +Sorin +TLDR +Testenvs +Tomasz +Webviews aarch ajinkyau akira alefragnani alphanums -ALS -Anson autofix autoupdate backticks @@ -18,18 +38,17 @@ codespell codicon codicons commitlint -Containerfile contentmatch contentmatches copyfiles cygwin +cython dbaeumer dedupe depcheck deps devel direnv -Dockal dpkg eamodio endgroup @@ -39,9 +58,6 @@ eqeqeq esbenp extest fgierlinger -Florian -FQCN -FQCNs fredericgiquel ganeshrn githubcli @@ -55,14 +71,12 @@ jeinwag johndoe keyfile keyrings -Launay lextudio libyaml lightspeed liveserver loglevel lxml -Maciążek markdownlint maxlength mochawesome @@ -73,12 +87,9 @@ myuser noheading npmrc nsible -Ondrej -OSTYPE overridable ovsx parseable -Pinkney piptools pipx precheck @@ -87,20 +98,14 @@ preinstall priyamsahoo projectuser prsahoo -Pyenv pyparsing -PYTHONBREAKPOINT -PYTHONHOME reindent reindented relogin ritwickdey rulebooks -Sbarnea -Schwalm showformat simplejson -Sorin sourcemaps ssbarnea ssydoren @@ -108,14 +113,11 @@ stopendy suboptions sysninja taskfile -Testenvs testenv testhost testorg timonwong -TLDR tomaciazek -Tomasz towerhost tsbuildinfo tsdoc @@ -130,7 +132,6 @@ vscoss vsix vyos watsonx -Webviews webknjaz webpacked whitespaces diff --git a/.config/requirements.in b/.config/requirements.in index 776b06ef2..aaa89c230 100644 --- a/.config/requirements.in +++ b/.config/requirements.in @@ -1,3 +1,4 @@ +cython>=3.0.5; python_version >= "3.12" ansible-core>=2.13.0 ansible-lint>=6.8.7 mypy # used by vscode diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1eb161c0c..8da5115e1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -99,14 +99,14 @@ jobs: ~/.cache/yarn key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/requirements.txt', 'tools/*.*') }} - - name: Enable caching for podman-machine - if: "contains(matrix.os, 'macos')" - uses: actions/cache@v3 - with: - path: | - ~/.local/share/containers - ~/.config/containers - key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/requirements.txt', '**/Taskfile.yml', 'tools/*.*') }} + # - name: Enable caching for podman-machine + # if: "contains(matrix.os, 'macos')" + # uses: actions/cache@v3 + # with: + # path: | + # ~/.local/share/containers + # ~/.config/containers + # key: ${{ runner.os }}-${{ matrix.task-name }}-${{ hashFiles('package.json', 'yarn.lock', '.config/requirements.txt', '**/Taskfile.yml', 'tools/*.*') }} - name: Use NodeJS v18 uses: actions/setup-node@v4 diff --git a/.gitignore b/.gitignore index 9adc216ee..de972b202 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ CHANGELOG.html !.yarn/versions .DS_Store .direnv +.tool-versions diff --git a/tools/test-setup.sh b/tools/test-setup.sh index 1188377cd..461790929 100755 --- a/tools/test-setup.sh +++ b/tools/test-setup.sh @@ -20,6 +20,16 @@ mkdir -p out/log # we do not want pip logs from previous runs : >"${PIP_LOG_FILE}" +timed() { + local start + start=$(date +%s) + local exit_code + exit_code=0 + "$@" || exit_code=$? + echo >&2 "took ~$(($(date +%s)-start)) seconds. exited with ${exit_code}" + return $exit_code +} + # Function to retrieve the version number for a specific command. If a second # argument is passed, it will be used as return value when tool is missing. get_version() { @@ -59,6 +69,16 @@ log() { echo >&2 -e "${prefix}${2}${NC}" } +is_podman_running() { + if [[ "$(podman machine ls --format '{{.Name}} {{.Running}}' --noheading 2>/dev/null)" == *"podman-machine-default* true"* ]]; then + log notice "Podman machine is running." + return 0 + else + log error "Podman machine is not running." + return 1 + fi +} + if [ ! -d "$HOME/.local/bin" ] ; then log warning "Creating missing ~/.local/bin" mkdir -p "$HOME/.local/bin" @@ -321,16 +341,16 @@ log notice "Podman checks..." if [[ "${OSTYPE:-}" == darwin* && "${SKIP_PODMAN:-}" != '1' ]]; then command -v podman >/dev/null 2>&1 || { log notice "Installing podman..." - HOMEBREW_NO_ENV_HINTS=1 time brew install podman + HOMEBREW_NO_ENV_HINTS=1 timed brew install podman } log notice "Configuring podman machine ($MACHTYPE)..." - podman machine ls --noheading | grep '\*' || { + podman machine ls --noheading | grep '\*' >/dev/null || { log warning "Podman machine not found, creating and starting one ($MACHTYPE)..." - time podman machine init --now || log warning "Ignored init failure due to possible https://github.com/containers/podman/issues/13609 but we will check again later." + timed podman machine init --now || log warning "Ignored init failure due to possible https://github.com/containers/podman/issues/13609 but we will check again later." } podman machine ls --noheading log notice "Checking status of podman machine ($MACHTYPE)..." - podman machine ls --format '{{.Name}} {{.Running}}' --noheading | grep podman-machine-default | grep true || { + is_podman_running || { log warning "Podman machine not running, trying to start it..." # do not use full path as it varies based on architecture # https://github.com/containers/podman/issues/10824#issuecomment-1162392833 @@ -340,13 +360,16 @@ if [[ "${OSTYPE:-}" == darwin* && "${SKIP_PODMAN:-}" != '1' ]]; then else qemu-system-aarch64 -machine q35,accel=hvf:tcg -cpu host -display none INVALID_OPTION || true fi + podman machine start + # Waiting for machine to become available n=0 - until [ "$n" -ge 5 ]; do - log warning "Trying to start podman machine again ($n)..." - time podman machine start && break # substitute your command here + until [ "$n" -ge 9 ]; do + log warning "Still waiting for podman machine to become available $((n * 15))s ..." + is_podman_running && break n=$((n+1)) sleep 15 done + is_podman_running } # validation is done later podman info @@ -359,12 +382,14 @@ PODMAN_VERSION="$(get_version podman || echo null)" if [[ "${PODMAN_VERSION}" != 'null' ]] && [[ "${SKIP_PODMAN:-}" != '1' ]]; then log notice "Pull our test container image with podman." podman pull --quiet "${IMAGE}" >/dev/null - # without running we will never be sure it works (no arm64 image yet) + # without running we will never be sure it works + log notice "Retrieving ansible version from ee" EE_ANSIBLE_VERSION=$(get_version \ podman run "${IMAGE}" ansible --version) + log notice "Retrieving ansible-lint version from ee" EE_ANSIBLE_LINT_VERSION=$(get_version \ podman run "${IMAGE}" ansible-lint --nocolor --version) - # Test podman ability to mount current folder with write access, default mount options + log notice "Test podman ability to mount current folder with write access, default mount options" podman run -v "$PWD:$PWD" ghcr.io/ansible/creator-ee:latest \ bash -c "[ -w $PWD ] && echo 'Mounts working' || { echo 'Mounts not working. You might need to either disable or make selinux permissive.'; exit 1; }" fi