diff --git a/Makefile b/Makefile index 5099370..7cc6cba 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ ensure-venv: .PHONY: install-deps install-deps: ensure-venv - $(virtualenv_dir)/bin/pip3 install -r requirements.txt + PIP_CONSTRAINTS=./constraints.txt $(virtualenv_dir)/bin/pip3 install -r requirements.txt # The postbuildscript plugin version is "3.1.0-375.v3db_cd92485e1" which cannot be parsed. # So we override to set it to "3.1.0". # jenkins-job-builder only cares if the plugin version is > 2. diff --git a/constraint.txt b/constraint.txt new file mode 100644 index 0000000..876924b --- /dev/null +++ b/constraint.txt @@ -0,0 +1,3 @@ +# Required to fix "AttributeError: cython_sources" from +# setuptools package. Seen with 68.2.2 setuptools as well. +cython<3 diff --git a/jobs/ci-run/integration/gen/README.md b/jobs/ci-run/integration/gen/README.md index 7b063d6..3d7264f 100644 --- a/jobs/ci-run/integration/gen/README.md +++ b/jobs/ci-run/integration/gen/README.md @@ -5,4 +5,5 @@ up waiting for manual wire up to the integration runner. None of the files inside the gen folder should be modified by hand and instead -should be changed in the template file within the tool. \ No newline at end of file +should be changed in the template file within the tool. Use `make gen-wire-tests` +at the top level to generate the files. diff --git a/jobs/ci-run/integration/gen/test-deploy-unstable.yml b/jobs/ci-run/integration/gen/test-deploy-unstable.yml index c31cd22..fd787de 100644 --- a/jobs/ci-run/integration/gen/test-deploy-unstable.yml +++ b/jobs/ci-run/integration/gen/test-deploy-unstable.yml @@ -38,5 +38,3 @@ current-parameters: true - name: 'test-deploy-test-deploy-os-aws' current-parameters: true - - name: 'test-deploy-test-deploy-revision-aws' - current-parameters: true diff --git a/jobs/ci-run/integration/gen/test-deploy.yml b/jobs/ci-run/integration/gen/test-deploy.yml index 6875e89..a01999c 100644 --- a/jobs/ci-run/integration/gen/test-deploy.yml +++ b/jobs/ci-run/integration/gen/test-deploy.yml @@ -46,6 +46,8 @@ current-parameters: true - name: 'test-deploy-test-deploy-os-lxd' current-parameters: true + - name: 'test-deploy-test-deploy-revision-aws' + current-parameters: true - name: 'test-deploy-test-deploy-revision-lxd' current-parameters: true diff --git a/tests/suites/static_analysis/lint_yaml.sh b/tests/suites/static_analysis/lint_yaml.sh index 582230c..380f0e9 100644 --- a/tests/suites/static_analysis/lint_yaml.sh +++ b/tests/suites/static_analysis/lint_yaml.sh @@ -1,7 +1,8 @@ yaml_check() { - FILE="${1}" + FILE="${1}" - py=$(cat <&1 < "${FILE}" || true) - if [ -n "${OUT}" ]; then - echo "" - echo "$(red 'Found some issues:')" - echo "${OUT}" - exit 1 - fi + ) + + OUT=$(python3 -c "${py}" 2>&1 <"${FILE}" || true) + if [ -n "${OUT}" ]; then + echo "" + echo "$(red 'Found some issues:')" + echo "${OUT}" + exit 1 + fi } run_yaml_check() { - FILES="${2}" + FILES="${2}" - echo "$FILES" | while IFS= read -r line; do yaml_check "${line}"; done + echo "$FILES" | while IFS= read -r line; do yaml_check "${line}"; done } run_yaml_deadcode() { - OUT=$(go run tests/suites/static_analysis/deadcode/main.go "$(pwd)" <&1 || true + OUT=$( + go run tests/suites/static_analysis/deadcode/main.go "$(pwd)" <&1 || true files: skip: - .github/workflows/static-analysis.yml @@ -91,18 +93,20 @@ jobs: - lxd-src-command-focal-base - nw-deploy-focal-amd64-lxd - nw-deploy-jammy-amd64-lxd + - test-controllercharm-multijob EOF -) - if [ -n "${OUT}" ]; then - echo "" - echo "$(red 'Found some issues:')" - echo "${OUT}" - exit 1 - fi + ) + if [ -n "${OUT}" ]; then + echo "" + echo "$(red 'Found some issues:')" + echo "${OUT}" + exit 1 + fi } run_yaml_simplify() { - OUT=$(go run tests/suites/static_analysis/simplify/main.go "$(pwd)" <&1 || true + OUT=$( + go run tests/suites/static_analysis/simplify/main.go "$(pwd)" <&1 || true files: skip: - .github/workflows/static-analysis.yml @@ -132,17 +136,18 @@ jobs: - test-secrets_k8s-multijob:IntegrationTests-secrets_k8s - test-secrets_iaas-multijob:IntegrationTests-secrets_iaas EOF -) - if [ -n "${OUT}" ]; then - echo "" - echo "$(red 'Found some issues:')" - echo "${OUT}" - exit 1 - fi + ) + if [ -n "${OUT}" ]; then + echo "" + echo "$(red 'Found some issues:')" + echo "${OUT}" + exit 1 + fi } run_yaml_alphabetise() { - OUT=$(go run tests/suites/static_analysis/alphabetise/main.go "$(pwd)" <&1 || true + OUT=$( + go run tests/suites/static_analysis/alphabetise/main.go "$(pwd)" <&1 || true files: skip: - .github/workflows/static-analysis.yml @@ -150,57 +155,57 @@ files: jobs: ignore: [] EOF -) - if [ -n "${OUT}" ]; then - echo "" - echo "$(red 'Found some issues:')" - echo "${OUT}" - exit 1 - fi + ) + if [ -n "${OUT}" ]; then + echo "" + echo "$(red 'Found some issues:')" + echo "${OUT}" + exit 1 + fi } test_static_analysis_yaml() { - if [ "$(skip 'test_static_analysis_yaml')" ]; then - echo "==> TEST SKIPPED: static yaml analysis" - return - fi - - ( - set_verbosity - - cd .. || exit - - FILES=$(find ./* -name '*.yml') - - go mod download - - # YAML static analysis - if which python >/dev/null 2>&1; then - run "run_yaml_check" "${FILES}" - else - echo "python not found, yaml static analysis disabled" - fi - - # YAML deadcode elimiation - if which go >/dev/null 2>&1; then - run "run_yaml_deadcode" - else - echo "go not found, yaml deadcode disabled" - fi - - # YAML simplify - if which go >/dev/null 2>&1; then - run "run_yaml_simplify" - else - echo "go not found, yaml simplify disabled" - fi - - # YAML alphabetise - if which go >/dev/null 2>&1; then - run "run_yaml_alphabetise" - else - echo "go not found, yaml alphabetise disabled" - fi - ) + if [ "$(skip 'test_static_analysis_yaml')" ]; then + echo "==> TEST SKIPPED: static yaml analysis" + return + fi + + ( + set_verbosity + + cd .. || exit + + FILES=$(find ./* -name '*.yml') + + go mod download + + # YAML static analysis + if which python >/dev/null 2>&1; then + run "run_yaml_check" "${FILES}" + else + echo "python not found, yaml static analysis disabled" + fi + + # YAML deadcode elimiation + if which go >/dev/null 2>&1; then + run "run_yaml_deadcode" + else + echo "go not found, yaml deadcode disabled" + fi + + # YAML simplify + if which go >/dev/null 2>&1; then + run "run_yaml_simplify" + else + echo "go not found, yaml simplify disabled" + fi + + # YAML alphabetise + if which go >/dev/null 2>&1; then + run "run_yaml_alphabetise" + else + echo "go not found, yaml alphabetise disabled" + fi + ) } diff --git a/tools/gen-wire-tests/README.md b/tools/gen-wire-tests/README.md index 1ca8465..68b74f7 100644 --- a/tools/gen-wire-tests/README.md +++ b/tools/gen-wire-tests/README.md @@ -9,10 +9,17 @@ You also need to provide a configuration file (usually `juju.config`) via stdin. We suggest running it as follows: +```bash +cd .. +make gen-wire-tests +``` + +To run by hand, or the hard way: + ```bash cd tools/gen-wire-tests cat juju.config | go run main.go /tests/suites \ - ../../jobs/ci-run/integration/gen + ../../jobs/ci-run/integration/gen ``` or @@ -21,10 +28,10 @@ or cd tools/gen-wire-tests go build main.go cat juju.config | ./main /tests/suites \ - ../../jobs/ci-run/integration/gen + ../../jobs/ci-run/integration/gen ``` where `` is the path to the Juju source tree on your local machine. If you are adding new test suites, you will also need to add a new job to -`jobs/ci-run/integration/integrationtests.yml`. \ No newline at end of file +`jobs/ci-run/integration/integrationtests.yml`. diff --git a/tools/gen-wire-tests/juju.config b/tools/gen-wire-tests/juju.config index bcbe89a..7d8f73f 100644 --- a/tools/gen-wire-tests/juju.config +++ b/tools/gen-wire-tests/juju.config @@ -39,7 +39,6 @@ folders: - test_deploy_charms aws: - test_deploy_os - - test_deploy_revision model: lxd: - test_model_multi